|
@@ -2,9 +2,7 @@
|
|
|
* 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.aY = aY;
|
|
@@ -23,20 +21,22 @@ THREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype );
|
|
|
|
|
|
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 ty = this.aY + this.yRadius * Math.sin( angle );
|
|
|
|
|
|
return new THREE.Vector2( tx, ty );
|
|
|
-};
|
|
|
|
|
|
+};
|