diff --git a/src/math/Vector2.js b/src/math/Vector2.js index 75cf640cb6c234d11bfb25483d886fe8bcea527a..9bb3b8ca9682cb7a0c16416dcf12885238acfc13 100644 --- a/src/math/Vector2.js +++ b/src/math/Vector2.js @@ -118,7 +118,7 @@ THREE.Vector2.prototype = { divideScalar: function ( s ) { - if ( s ) { + if ( s !== 0 ) { this.x /= s; this.y /= s; @@ -244,7 +244,7 @@ THREE.Vector2.prototype = { var oldLength = this.length(); - if( oldLength ) { + if ( oldLength !== 0 && l !== oldLength ) { this.multiplyScalar( l / oldLength ); } diff --git a/src/math/Vector3.js b/src/math/Vector3.js index dd50e236952db98742101b08d7457ff904f130cf..c937d5ca26a1f795ba0f27b9c787d1053f8781f1 100644 --- a/src/math/Vector3.js +++ b/src/math/Vector3.js @@ -168,7 +168,7 @@ THREE.Vector3.prototype = { divideScalar: function ( s ) { - if ( s ) { + if ( s !== 0 ) { this.x /= s; this.y /= s; @@ -312,7 +312,7 @@ THREE.Vector3.prototype = { var oldLength = this.length(); - if( oldLength ) { + if ( oldLength !== 0 && l !== oldLength ) { this.multiplyScalar( l / oldLength ); } diff --git a/src/math/Vector4.js b/src/math/Vector4.js index 1b1d15b16663a41a52e58485f946f2bde01558ea..d2d1c55074a65c10e3994a947811eac4180af556 100644 --- a/src/math/Vector4.js +++ b/src/math/Vector4.js @@ -153,7 +153,7 @@ THREE.Vector4.prototype = { divideScalar: function ( s ) { - if ( s ) { + if ( s !== 0 ) { this.x /= s; this.y /= s; @@ -321,7 +321,7 @@ THREE.Vector4.prototype = { var oldLength = this.length(); - if( oldLength ) { + if ( oldLength !== 0 && l !== oldLength ) { this.multiplyScalar( l / oldLength ); }