The curve it plots
The pattern is a hypotrochoid: the wheel center orbits the ring center at radius R - r while the pen swings around the wheel center at radius d. Closure depends on the ratio R/r: reduced to lowest terms p/q, the closed curve has p lobes and takes q rotations of the wheel around the ring. The renderer samples points along that parametric curve and joins them into the drawn line.