提交 f8a1eec1 编写于 作者: M Mr.doob

Merge pull request #6989 from neko1235/fix-ellipse-rotation

Fixing issues introduced in pull request #6953
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册