<
# Petr's Miracle

This toy explores the
Petrâ€“Douglasâ€“Neumann theorem.
Starting with any N sided polygon, we add a triangle to each side, and
generate a new N sided polygon from the tips of those triangles. The
triangle has a specific angle at the tip, and we repeat this process with a
sequence of angles. After N-2 repetitions, we end up with a regular
N sided polygon.
For details about the sequence of angles, why this works, and how it's
related to the Discreet Fourier Transform (?!?!), check out
this Mathologer video.

### Controls

### Options

### Curvy mode

One of the unanswered questions in the Mathologer video was what happens
in the limit as you try to approximate a curve with polygons with more and
more vertices. Does the regular polygon generated by this process approach
a specific circle?

Curvy mode explores this by turning the N sided polygon defined by the points you create into a smooth curve, then approximating that curve by placing points along it (the teal polygon).

What happens if the approximation points are rotated around the curve? How does this change as you increase the number of points?

- The green polygon is the input. The blue polygon is the output.
- Click and drag a vertex on the green polygon to move it.
- Click on a green line to add a new vertex.
- Right click on a vertex to delete it.
- Scroll to zoom. Click and drag on the background to pan.

Curvy mode explores this by turning the N sided polygon defined by the points you create into a smooth curve, then approximating that curve by placing points along it (the teal polygon).

What happens if the approximation points are rotated around the curve? How does this change as you increase the number of points?