- Understand how to generate a regular polygon
- Understand how a regular polygon can be used to approximate a circle.

- Create a program and interface that allows a user to explore the accuracy of a circle drawn as a regular n-gon.
Your program should have a canvas which displays a "circle" like object centered in the middle, with diameter 90% of the minimum dimension of the canvas.

**To test this provide the user with the ability to reset the canvas size at runtime.**You should draw a "circle" based on an input provided by the user. This should be a single integer, the number of sides to use in the regular polygon to approximate the circle. This number should be a minimum of three and may be as large as you wish within the following constraint. You should never attempt to draw a line segment with length less than 1 pixel.

For example, if the user enters a 3, the screen should show a circle with an equilateral triangle where each vertex of the triangle is on the circle.

Expected output

- A circle, drawn with
`ctx.arc()`

with the given diameter centered on the middle of the canvas. - A regular polygon inscribed in the above circle. The sides of this polygon should be determined by the user input.
- The circumference of the circle.
- The perimeter of the polygon.
- The ratio of these two, use the circle for the denominator.
- The average length of each polygon segment.

- A circle, drawn with
- Create a program that will draw an approximation of a spiral.
This should be fairly simple. I would start at the center of the screen, with $\Theta = 0, r = 0$. Loop until the point is outside of the screen changing the $\Theta$ by a fixed amount (probably provided by the user) and $r$ by a fixed amount (again provided by the user).

If you want, you might change $r$ some way other than linearly. Make something that looks nice. (And not too expensive.)

- Challenge (Optional, but I will give extra points), Create a five sided star algorithmically. This star should be centered on the canvas with "radius" of 90% of the canvas.
- Double challenge (Double optional, but again I will give extra points): Make this star rotate and twinkel (grow and shrink slightly) with a timer.
Note, this should be done as parameter(s) to computing the star, not with a rotation matrix. Think offset in size and the angle $\Theta$.

- I expect you to build your code based on my examples.

Submit your file to the D2L homework 3 folder by the due date.