|
@@ -370,6 +370,18 @@ THREE.Vector2.prototype = {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ angle: function () {
|
|
|
+
|
|
|
+ // 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;
|
|
|
+
|
|
|
+ return angle;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
distanceTo: function ( v ) {
|
|
|
|
|
|
return Math.sqrt( this.distanceToSquared( v ) );
|