Homework 3: Circle Logic

Short Description:

Create programs which employs the ideas from the circle notes.

Goals

When you finish this homework, you should

Formal Description

  1. 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

  2. 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.)

  3. 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.

  4. 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$.

Documentation

Please use relative references to your code in the html file. This will allow me to extract the file in my local environment.

Additional Requirements/Comments

Extras

I find that I want to continue to play with simulations/visualizations of this type. Please do so, but only if you have sufficient time, do not enhance this, or any other project at the expense of your other classes.

Submission

When you have finished your assignment, please submit a tar or zip file containing all files needed for this project. Please do not post your project on line until after grades have been assigned.

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