Bladeren bron

Using THREE.Math.clamp instead of locally defined version.

Drew Noakes 12 jaren geleden
bovenliggende
commit
52aeb2e270
1 gewijzigde bestanden met toevoegingen van 3 en 9 verwijderingen
  1. 3 9
      src/math/Vector3.js

+ 3 - 9
src/math/Vector3.js

@@ -564,17 +564,11 @@ THREE.extend( THREE.Vector3.prototype, {
 
 	angleTo: function ( v ) {
 
-		// clamp, to handle numerical problems
-
-		function clamp( x ) {
-
-			return Math.min( Math.max( x, -1 ), 1 );
-
-		}
-
 		var theta = this.dot( v ) / ( this.length() * v.length() );
 
-		return Math.acos( clamp ( theta ) );
+		// clamp, to handle numerical problems
+
+		return Math.acos( THREE.Math.clamp ( theta, -1, 1 ) );
 
 	},