31
\$\begingroup\$

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?

\$\endgroup\$

4 Answers 4

25
\$\begingroup\$

Some possibilities:

Lemniscate of Bernoulli

Lemniscate of Gerono

Lemniscate of Booth

Watt's curve

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Answers should be self-contained, external links may die some day and would render this answer useless. You should quote the important bits from the links you've provided. \$\endgroup\$ Commented Dec 21, 2017 at 10:09
69
\$\begingroup\$

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.)

\$\endgroup\$
3
  • \$\begingroup\$ Thank you, everybody, for your support, which has earned me my first gold badge here on gamedev! :-) \$\endgroup\$ Commented Nov 13, 2012 at 23:07
  • 1
    \$\begingroup\$ +1 for not only posting the links, but also the formulas and graphics ( with sources ). \$\endgroup\$ Commented Nov 14, 2012 at 7:54
  • 2
    \$\begingroup\$ As is, this should be the accepted answer. \$\endgroup\$ Commented Dec 21, 2017 at 10:09
-2
\$\begingroup\$

I randomly found another one using this formula:

$$x^2 = y^2 + 0.1x^{2.8}$$

As plotted by Wolfram Alpha:

half of an infinity symbol

\$\endgroup\$
1
  • \$\begingroup\$ Unlike the other answers, this one is currently not presented in parametric form that lets us easily step the position forward over time t. I'd recommend including a description of how you would use this formula to position a moving object over time. \$\endgroup\$ Commented Dec 21, 2017 at 14:11
-3
\$\begingroup\$

$$((x+1)^2+y^2)((x-1)^2+y^2)=1$$

half of an infinity symbol

The product of the distances from any point on that curve to (-1, 0) and to (1,0) is constant and equals to 1.

\$\endgroup\$
1
  • 4
    \$\begingroup\$ This answer provides a formula modelling such a curve, but not a method to "move an object" in such a way that it follows that curve. Please consider elaborating on the answer to indicate how you would use this math to move an object in a game. \$\endgroup\$ Commented Jan 13, 2018 at 23:30

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.