Просмотр исходного кода

Vector2 function angle performance

gonnavis 6 лет назад
Родитель
Сommit
7968ff9d37
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
 		// 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;
 		return angle;
 
 

粤ICP备19079148号