I was inspired to make this application by the work of Simon Plouffe. This construction is known as the Cremona generation (after Luigi Cremona). The recipe is: divide p points equally over the circumference of a circle and number them from n = 0 to n = p-1. Then join points n and (n × t) mod p with a straight line segment (a chord). Variable t is a constant factor. We iterate over the times table of t and each time we take the result modulo p. In figure 1:
Envelopes of some of these pencils of lines form Epicycloids. If t = 2, the envelope forms a cardioid. If t = 3, the envelope forms a nephroid. If t = 4, the envelope forms a three-cusped epicycloid (see first 3 figures below).