Browse Source

Clean up.

Mr.doob 8 years ago
parent
commit
0513ed03b4

+ 8 - 4
src/extras/curves/CubicBezierCurve.js

@@ -20,18 +20,22 @@ CubicBezierCurve.prototype.constructor = CubicBezierCurve;
 
 
 CubicBezierCurve.prototype.getPoint = function ( t ) {
 CubicBezierCurve.prototype.getPoint = function ( t ) {
 
 
+	var v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;
+
 	return new Vector2(
 	return new Vector2(
-		CubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ),
-		CubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y )
+		CubicBezier( t, v0.x, v1.x, v2.x, v3.x ),
+		CubicBezier( t, v0.y, v1.y, v2.y, v3.y )
 	);
 	);
 
 
 };
 };
 
 
 CubicBezierCurve.prototype.getTangent = function ( t ) {
 CubicBezierCurve.prototype.getTangent = function ( t ) {
 
 
+	var v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;
+
 	return new Vector2(
 	return new Vector2(
-		TangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ),
-		TangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y )
+		TangentCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),
+		TangentCubicBezier( t, v0.y, v1.y, v2.y, v3.y )
 	).normalize();
 	).normalize();
 
 
 };
 };

+ 5 - 3
src/extras/curves/CubicBezierCurve3.js

@@ -19,10 +19,12 @@ var CubicBezierCurve3 = Curve.create(
 
 
 	function ( t ) {
 	function ( t ) {
 
 
+		var v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;
+
 		return new Vector3(
 		return new Vector3(
-			CubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x ),
-			CubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y ),
-			CubicBezier( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z )
+			CubicBezier( t, v0.x, v1.x, v2.x, v3.x ),
+			CubicBezier( t, v0.y, v1.y, v2.y, v3.y ),
+			CubicBezier( t, v0.z, v1.z, v2.z, v3.z )
 		);
 		);
 
 
 	}
 	}

+ 8 - 5
src/extras/curves/QuadraticBezierCurve.js

@@ -18,12 +18,13 @@ function QuadraticBezierCurve( v0, v1, v2 ) {
 QuadraticBezierCurve.prototype = Object.create( Curve.prototype );
 QuadraticBezierCurve.prototype = Object.create( Curve.prototype );
 QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;
 QuadraticBezierCurve.prototype.constructor = QuadraticBezierCurve;
 
 
-
 QuadraticBezierCurve.prototype.getPoint = function ( t ) {
 QuadraticBezierCurve.prototype.getPoint = function ( t ) {
 
 
+	var v0 = this.v0, v1 = this.v1, v2 = this.v2;
+
 	return new Vector2(
 	return new Vector2(
-		QuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ),
-		QuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y )
+		QuadraticBezier( t, v0.x, v1.x, v2.x ),
+		QuadraticBezier( t, v0.y, v1.y, v2.y )
 	);
 	);
 
 
 };
 };
@@ -31,9 +32,11 @@ QuadraticBezierCurve.prototype.getPoint = function ( t ) {
 
 
 QuadraticBezierCurve.prototype.getTangent = function ( t ) {
 QuadraticBezierCurve.prototype.getTangent = function ( t ) {
 
 
+	var v0 = this.v0, v1 = this.v1, v2 = this.v2;
+
 	return new Vector2(
 	return new Vector2(
-		TangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ),
-		TangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y )
+		TangentQuadraticBezier( t, v0.x, v1.x, v2.x ),
+		TangentQuadraticBezier( t, v0.y, v1.y, v2.y )
 	).normalize();
 	).normalize();
 
 
 };
 };

+ 5 - 3
src/extras/curves/QuadraticBezierCurve3.js

@@ -18,10 +18,12 @@ var QuadraticBezierCurve3 = Curve.create(
 
 
 	function ( t ) {
 	function ( t ) {
 
 
+		var v0 = this.v0, v1 = this.v1, v2 = this.v2;
+
 		return new Vector3(
 		return new Vector3(
-			QuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x ),
-			QuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y ),
-			QuadraticBezier( t, this.v0.z, this.v1.z, this.v2.z )
+			QuadraticBezier( t, v0.x, v1.x, v2.x ),
+			QuadraticBezier( t, v0.y, v1.y, v2.y ),
+			QuadraticBezier( t, v0.z, v1.z, v2.z )
 		);
 		);
 
 
 	}
 	}