diff --git a/src/math/Vector2.js b/src/math/Vector2.js index 39c899bcc49054c7b910afe0fe43e75743bd4d08..925b6a0036f7e9f21e243d63bb5b5c37b25dc7a0 100644 --- a/src/math/Vector2.js +++ b/src/math/Vector2.js @@ -379,15 +379,9 @@ THREE.Vector2.prototype = { }, - setLength: function ( l ) { + setLength: function ( length ) { - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - - } + this.multiplyScalar( length / this.length() ); return this; diff --git a/src/math/Vector3.js b/src/math/Vector3.js index d53f32ed4a40ca8698470d1f571f254a69757673..78b2c7d71902a2f8c8f71d3be917247f7f891409 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -584,15 +584,9 @@ THREE.Vector3.prototype = { }, - setLength: function ( l ) { + setLength: function ( length ) { - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - - } + this.multiplyScalar( length / this.length() ); return this; @@ -701,7 +695,7 @@ THREE.Vector3.prototype = { angleTo: function ( v ) { - var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) ); + var theta = this.dot( v ) / Math.sqrt( this.lengthSq() * v.lengthSq() ); // clamp, to handle numerical problems diff --git a/src/math/Vector4.js b/src/math/Vector4.js index ce39b1bd12b24fc1afb28ff43a0549a27b52f3b4..00f9c491c2afb2e7f65349fff8e971fccd9c93b3 100644 --- a/src/math/Vector4.js +++ b/src/math/Vector4.js @@ -589,15 +589,9 @@ THREE.Vector4.prototype = { }, - setLength: function ( l ) { + setLength: function ( length ) { - var oldLength = this.length(); - - if ( oldLength !== 0 && l !== oldLength ) { - - this.multiplyScalar( l / oldLength ); - - } + this.multiplyScalar( length / this.length() ); return this;