Browse Source

Added parameter to Vector2.isZero() and Vector3.isZero(). Fixes #2441.

Mr.doob 13 years ago
parent
commit
f82e9d712c
2 changed files with 4 additions and 5 deletions
  1. 2 2
      src/core/Vector2.js
  2. 2 3
      src/core/Vector3.js

+ 2 - 2
src/core/Vector2.js

@@ -160,9 +160,9 @@ THREE.Vector2.prototype = {
 
 
 	},
 	},
 
 
-	isZero: function () {
+	isZero: function ( v ) {
 
 
-		return ( this.lengthSq() < 0.0001 /* almostZero */ );
+		return this.lengthSq() < ( v !== undefined ? v : 0.0001 );
 
 
 	},
 	},
 
 

+ 2 - 3
src/core/Vector3.js

@@ -470,9 +470,9 @@ THREE.Vector3.prototype = {
 
 
 	},
 	},
 
 
-	isZero: function () {
+	isZero: function ( v ) {
 
 
-		return ( this.lengthSq() < 0.0001 /* almostZero */ );
+		return this.lengthSq() < ( v !== undefined ? v : 0.0001 );
 
 
 	},
 	},
 
 
@@ -483,4 +483,3 @@ THREE.Vector3.prototype = {
 	}
 	}
 
 
 };
 };
-