Browse Source

EllipseCurve code clean up.

Mr.doob 12 years ago
parent
commit
ed57c76d0c
1 changed files with 12 additions and 12 deletions
  1. 12 12
      src/extras/curves/EllipseCurve.js

+ 12 - 12
src/extras/curves/EllipseCurve.js

@@ -2,9 +2,7 @@
  *	Ellipse curve
  *	Ellipse curve
  **************************************************************/
  **************************************************************/
 
 
-THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius,
-							aStartAngle, aEndAngle,
-							aClockwise ) {
+THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) {
 
 
 	this.aX = aX;
 	this.aX = aX;
 	this.aY = aY;
 	this.aY = aY;
@@ -23,20 +21,22 @@ THREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype );
 
 
 THREE.EllipseCurve.prototype.getPoint = function ( t ) {
 THREE.EllipseCurve.prototype.getPoint = function ( t ) {
 
 
-  var deltaAngle = this.aEndAngle - this.aStartAngle;
+	var angle;
+	var deltaAngle = this.aEndAngle - this.aStartAngle;
+
+	if ( this.aClockwise === true ) {
+
+		angle = this.aEndAngle + ( 1 - t ) * ( Math.PI * 2 - deltaAngle );
+
+	} else {
+
+		angle = this.aStartAngle + t * deltaAngle;
 
 
-	if ( this.aClockwise ) {
-    t = 1 - t;
-    deltaAngle = Math.PI*2 - deltaAngle;
-    var angle = this.aEndAngle + t * deltaAngle;
 	}
 	}
-  else {
-    var angle = this.aStartAngle + t * deltaAngle;
-  }
 
 
 	var tx = this.aX + this.xRadius * Math.cos( angle );
 	var tx = this.aX + this.xRadius * Math.cos( angle );
 	var ty = this.aY + this.yRadius * Math.sin( angle );
 	var ty = this.aY + this.yRadius * Math.sin( angle );
 
 
 	return new THREE.Vector2( tx, ty );
 	return new THREE.Vector2( tx, ty );
-};
 
 
+};