# How can I move and rotate an object in an “infinity” or “figure 8” trajectory?

I know that the easiest way to move an object with the figure 8 trajectory is:

x = cos(t);
y = sin(2*t) / 2;


but I just don't know how to rotate it, lets says with a new variable r as rotation, how do I merge it into the above formula ? can anyone please advise me on what is the simplest and cheapest way/formula to move and rotate the figure 8 trajectory ?

## 1 Answer

The object should point in the direction of the derivative, which is [-sin(t), cos(2t)]. Its angle is atan2(cos(2t), -sin(t)).

Edit: OP is apparently asking how to rotate the "trajectory," not the object itself.

To rotate the figure, choose an angle, θ, in radians, that you'd like the trajectory to be rotated. The position along this rotated figure is:

x = cos(θ) * cos(t) - sin(θ) * sin(2t)/2
y = sin(θ) * cos(t) + cos(θ) * sin(2t)/2

• so how would I modify the formula to get a rotated figure of 8 ? – user1998844 Mar 3 '17 at 18:24
• That is a completely different question than the one I answered. I'll edit my answer with a solution to this question. – Drew Cummins Mar 3 '17 at 18:31