DEV Community

Peter Teoh
Peter Teoh

Posted on

Great fun playing with hypotrochoid

Introducing a simple formula for experimentation:

x = (R - r) * Math.cos(f1*t) * (1 + Math.cos(f2*t)) + d * Math.cos(((R - r) / r) * t);

y = (R - r) * Math.sin(f1*t) * (1 + Math.cos(f2*t)) - d * Math.sin(((R - r) / r) * t);

where R, r, d, f1, f2 are different tunable parameter. The path of (x,y) as t varies will generate the graphics as shown in the following writeup:

https://hackgptdeveloper.github.io/2024/12/01/hypotrochoid-v3-explore.html

For example:

Image description

Image description

Image description

Image description

Image description

Image description

Top comments (0)