Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I want to move object around point I do:

    point.x *= cosf(timer.timeElapsed);
    point.y *= sinf(timer.timeElapsed);

How to make point move on eight or infinity sign trajectory?

share|improve this question

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:

Lemniscate of Gerono animation

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:

Lemniscate of Bernoulli animation

(Animations made with Maple 13, compressed with GIFsicle.)

share|improve this answer
+1 for the excellent demonstration. – Marton Nov 13 '12 at 14:47
Thank you, everybody, for your support, which has earned me my first gold badge here on gamedev! :-) – Ilmari Karonen Nov 13 '12 at 23:07
+1 for not only posting the links, but also the formulas and graphics ( with sources ). – rootlocus Nov 14 '12 at 7:54
This should be the accepted answer. – S. Tarık Çetin Nov 23 '15 at 15:10

I randomly found another one using this formula:

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.