Going Around in Circles

Write a Java program that shows an animation of a shape moving around in a circular path perpetually.

On a computer, animation involves making many tiny changes to a shape's attributes quickly over time. Instead of writing the entire motion directly though, you must concentrate on the tiny changes that happen repeatedly over time. For example, to make a shape appear to trace out the path of a circle, you only need to modify its position by a little bit over time. However, you will need to think carefully about what tiny change, applied repeatedly, will make it appear to move in a circle. The easiest way to do this is to think about the problem from the shape's perspective, like when you are driving your car around a curve in the road, rather than from a strictly mathematical perspective.

Specifications

Use the pre-defined FANG classes Tracker, that automatically updates a shape's attributes over time, Vector, that represents a speed and direction, and Coordinate, that represents an (x, y) corrdinate on the screen. Your program should use a vector to keep track of of your progress along the circle and then translate that movement into an amount to change the actual location of the shape.

You should write all of your code in the methods of the CircleTracker class.

An example can be seen here.

Extra credit will be given if you generalize your circle animation to trace out the path of any regular shape, given a number of sides and a length for each side. A regular shape is one whose sides are all the same length and whose angles between those sides are the same as well. For example, an equilateral triangle is a three-sided regular shape, a square is a four-sided regular shape, then a pentagon, then a hexagon, and so on. We can approximate a circle on the computer by making a regular shape that has 360 sides, each of length one.

Submitting your work Electronically

When you are finished, you should submit your project for grading and update your course web portfolio.

  1. Submit your assignment using Eclipse.
  2. Update your web page by posting your program as an applet.