diff --git a/src/extras/core/Path.js b/src/extras/core/Path.js index 1c552e7dce85f0c714943a78ad6681fee03a36a4..fd1b9cd8fcf43a87a1f5896f9ffd246a685d6813 100644 --- a/src/extras/core/Path.js +++ b/src/extras/core/Path.js @@ -168,7 +168,13 @@ THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius, THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) { - var args = Array.prototype.slice.call( arguments ); + var args = [ + aX, aY, + xRadius, yRadius, + aStartAngle, aEndAngle, + aClockwise, + aRotation || 0 // aRotation is optional. + ]; var curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ); this.curves.push( curve ); @@ -387,7 +393,7 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) { yRadius = args[ 3 ], aStartAngle = args[ 4 ], aEndAngle = args[ 5 ], aClockwise = !! args[ 6 ], - aRotation = args[ 7 ] || 0; + aRotation = args[ 7 ]; var deltaAngle = aEndAngle - aStartAngle; @@ -419,9 +425,11 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) { if ( aRotation !== 0 ) { + var x = tx, y = ty; + // Rotate the point about the center of the ellipse. - tx = ( tx - aX ) * cos - ( ty - aY ) * sin + aX; - ty = ( tx - aX ) * sin + ( ty - aY ) * cos + aY; + tx = ( x - aX ) * cos - ( y - aY ) * sin + aX; + ty = ( x - aX ) * sin + ( y - aY ) * cos + aY; } diff --git a/src/extras/curves/EllipseCurve.js b/src/extras/curves/EllipseCurve.js index 3655a41cf2d03b3082bb1bc8a2e2c02299fe518d..2ecbd59b539b58619d06d66e3fb5e94f77a9ddc1 100644 --- a/src/extras/curves/EllipseCurve.js +++ b/src/extras/curves/EllipseCurve.js @@ -49,9 +49,11 @@ THREE.EllipseCurve.prototype.getPoint = function ( t ) { var cos = Math.cos( this.aRotation ); var sin = Math.sin( this.aRotation ); + var tx = x, ty = y; + // 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; + x = ( tx - this.aX ) * cos - ( ty - this.aY ) * sin + this.aX; + y = ( tx - this.aX ) * sin + ( ty - this.aY ) * cos + this.aY; }