|
@@ -2,7 +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, aRotation ) {
|
|
|
|
|
|
this.aX = aX;
|
|
this.aX = aX;
|
|
this.aY = aY;
|
|
this.aY = aY;
|
|
@@ -14,6 +14,8 @@ THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle
|
|
this.aEndAngle = aEndAngle;
|
|
this.aEndAngle = aEndAngle;
|
|
|
|
|
|
this.aClockwise = aClockwise;
|
|
this.aClockwise = aClockwise;
|
|
|
|
+
|
|
|
|
+ this.aRotation = aRotation || 0;
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
@@ -39,11 +41,20 @@ THREE.EllipseCurve.prototype.getPoint = function ( t ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- var vector = new THREE.Vector2();
|
|
|
|
|
|
+ var x = this.aX + this.xRadius * Math.cos( angle );
|
|
|
|
+ var y = this.aY + this.yRadius * Math.sin( angle );
|
|
|
|
+
|
|
|
|
+ if ( this.aRotation ) {
|
|
|
|
+
|
|
|
|
+ var cos = Math.cos( this.aRotation );
|
|
|
|
+ var sin = Math.sin( this.aRotation );
|
|
|
|
|
|
- vector.x = this.aX + this.xRadius * Math.cos( angle );
|
|
|
|
- vector.y = this.aY + this.yRadius * Math.sin( angle );
|
|
|
|
|
|
+ // Rotate the point about the center of the ellipse.
|
|
|
|
+ x = ( x - this.aX ) * cos - ( y - this.aY ) * sin + this.aX;
|
|
|
|
+ y = ( x - this.aX ) * sin + ( y - this.aY ) * cos + this.aY;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- return vector;
|
|
|
|
|
|
+ return new THREE.Vector2( x, y );
|
|
|
|
|
|
};
|
|
};
|