I'm using the following to get the x and y position of an entity as it travels along an elliptical path over time:
x = Math.cos(time)*width/2
y = Math.sin(time)*height/2
Is there a simple way to rotate the entire thing by a certain amount of degrees, say 45, or 132 for example?
For each point(x, y) you calculated with above equation, you can rotate it theta degree(counter-clockwise) by the following equation
where x and y are the original coordinates before rotation, x' and y' are the coordinates after rotation, theta is the angle to rotate.
coordinate rotation
Yes, just do a 2D rotation on the resulting
x
andy
to rotate your ellipse:And remember that
Radians = Degrees * PI / 180
.You may use a simple rotation transformation:
Where
a
- is the angle to rotate.This Wikipedia article explains that in detail