Преглед на файлове

Merge pull request #18622 from gonnavis/Vector2_angle

Vector2.angle() performance
Mr.doob преди 5 години
родител
ревизия
56e662b8c0
променени са 1 файла, в които са добавени 1 реда и са изтрити 3 реда
  1. 1 3
      src/math/Vector2.js

+ 1 - 3
src/math/Vector2.js

@@ -380,9 +380,7 @@ Object.assign( Vector2.prototype, {
 
 		// computes the angle in radians with respect to the positive x-axis
 
-		var angle = Math.atan2( this.y, this.x );
-
-		if ( angle < 0 ) angle += 2 * Math.PI;
+		var angle = Math.atan2( - this.y, - this.x ) + Math.PI;
 
 		return angle;