Part 0: A little geometry

You're going to be doing a simple animation that looks something like a moon orbiting a planet which, in turn, orbits a sun. Just 'cause I don't want you to get caught up worrying about the trig of calculating positions in this scheme, the diagram to the right shows how to do it. If you know the coordinates of your "sun", P0 = (x0,y0), you can calculate the coordinates of your planet when it's at angle a0 in its orbit, P1=(x1,x2). Then, when the moon is at angle a1 in its orbit around the planet, you can calculate its position P2=(x2,y2) from P1 and a1.

Part 1: Circles

Your first job is to make this:

Part 2: Animate

Your next job is to augment your Part 1 program so that pushing the start button starts an animation in which the pink point travels around the pink circle which, since the blue circle is centered at the pink point, means that the blue circle travels with it, while at the same time the blue point travels around the blue circle. To "move" these points, simply keep adding some small fixed amount (e.g. 0.01 to the inner and 0.04 to the outer) to the angles (a0 and a1 in the diagram).

Optional Challenge : stopping and restarting

See if you can modify the program so that once started, the button label changes to "stop", and clicking it again stops the animation, and returns the button label to "start". Clicking again should start the animation again, and so on.

Optional Challenge : tracing

See if you can modify the program so that the path of the dot moving around the blue circle is taced out on the screen. Like this :

Submission

If you have Parts 1 and 2 completed before the end of the lab period, just demo it to your instructor. Make sure he's marked it down as completed. No submission is needed in this case.
Otherwise, submit all the java files you need to compile and run your program under lab12. So, for example, to submit every Java file in the current directory, give the command:
~/bin/ic211-submit lab11 *.java