답변:
As Marton notes, there are several "figure of eight" curves that might fit your needs. Perhaps the simplest is the lemniscate of Gerono, which has the parametrization:
x = cos(t);
y = sin(2*t) / 2;
and looks like this:
However, the lemniscate of Bernoulli may be visually more pleasing; it has a parametrization very similar to the lemniscate of Gerono, except that both axes are scaled by a factor of 1/(sin(t)^2 + 1) = 2/(3 - cos(2*t))
:
scale = 2 / (3 - cos(2*t));
x = scale * cos(t);
y = scale * sin(2*t) / 2;
It looks like this:
(Animations made with Maple 13, compressed with GIFsicle.)
t
. I'd recommend including a description of how you would use this formula to position a moving object over time.