소스 검색

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

Drew Noakes 12 년 전
부모
커밋
52aeb2e270
1개의 변경된 파일3개의 추가작업 그리고 9개의 파일을 삭제
  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 ) );
 
 	},