1
\$\begingroup\$

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 ?

ref:How can I move an object in an "infinity" or "figure 8" trajectory?

\$\endgroup\$
0

1 Answer 1

4
\$\begingroup\$

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
\$\endgroup\$
2
  • \$\begingroup\$ so how would I modify the formula to get a rotated figure of 8 ? \$\endgroup\$ Mar 3, 2017 at 18:24
  • \$\begingroup\$ That is a completely different question than the one I answered. I'll edit my answer with a solution to this question. \$\endgroup\$ Mar 3, 2017 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .