浏览代码

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
 		// 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;