Attempting to draw an epicycloid here:
https://en.wikipedia.org/wiki/Epicycloid
I get:
https://tthtlc.github.io/epicycloid_explore_savepng.html
(R=160, r=40)
Now what happened if you combine this R,r=(160,40) with another epicyloid by adding them together?
The result is amazing:
https://tthtlc.github.io/epicycloid_add_epicycloid_explore.html
The formula used:
x = (200) * Math.cos(t) - 96 * Math.cos(5 * t)) + (R + r) * Math.cos(t) - d * Math.cos((R + r) / r * t);
y = (200) * Math.sin(t) - 96 * Math.sin(5 * t) + (R + r) * Math.sin(t) - d * Math.sin((R + r) / r * t);