WestLangley 10 年之前
父節點
當前提交
56723ec5ab
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      src/math/Vector2.js

+ 7 - 4
src/math/Vector2.js

@@ -417,12 +417,15 @@ THREE.Vector2.prototype = {
 
 	},
 
-	rotateAround: function ( center, rotation ) {
+	rotateAround: function ( center, angle ) {
 
-		var x = this.x - center.x,	y = this.y - center.y;
+		var c = Math.cos( angle ), s = Math.sin( angle );
 
-		this.x = center.x + x * Math.cos(rotation) - y * Math.sin(rotation);
-		this.y = center.y + y * Math.cos(rotation) + x * Math.sin(rotation);
+		var x = this.x - center.x;
+		var y = this.y - center.y;
+
+		this.x = x * c - y * s + center.x;
+		this.y = x * s + y * c + center.y;
 
 		return this;