CIT
591 Assignment
11: Kaleidoscope Fall 2005, David Matuszek 
Imagine, for the moment, that you have an applet with the origin in the
center; that is, the center is We will place an object (the letters " 
You can reflect the object around the Xaxis. Do this by changing the
sign of all Y values. That is, each point (X,Y)
becomes (X,Y) . 

You can reflect the object around the Yaxis. Do this by changing the
sign of all X values. That is, each point (X,Y)
becomes (X,Y) . 

You can reflect the object around the main diagonal. Do this by changing
each (X,Y) point into (Y,X) . 

You can reflect the object around the secondary diagonal. You can do this
by changing each (X,Y) point into (Y,X) . 
Some combinations of reflections are the same as other combinations of reflections;
there are eight possibilities in all. Thus, if the origin were at the center,
you would have, for each (X, Y)
point, the following:
(X,Y) (X,Y) (X,Y) (X,Y) (Y,X) (Y,X) (Y,X) (Y,X)
Since the origin of any Java drawing area is not at the center, but is at the top left corner instead, you will have to make some adjustments to these. The exact values will depend on the width and height of your applet window. Don't use magic numbersask the applet for its height and width. (You can assume that the size of the applet never changes during execution.)
Most of the figures that you draw with java.awt.Graphics
methods
have a width
and a height
as well as an x
and y
starting position. For some reflections, these will have
to be interchanged.
Remember the DRY principle. You should be able to come up with a method or methods that you can use for any figures; this will make it easy if you decide to add a bunch more figures to your display.
Graphics.drawPolygon
for at least one of them). Each of these "main" figures should be allowed
to move anywhere in the window, so that often it will overlap or cross some of
its reflections. Figures will "bounce" off the walls (like the "Bouncing
Ball" applet), but it is OK if they sometimes go partly outside the wallsJava
will "clip" the image to fit the applet. Each figure should move at
a different speed.
Have buttons to start and stop the animation. In addition, have some controls so that the user can interact with the animation to at least a small extent. Some of the things you might want to control are: Speed. Colors. Number of figures. Number of reflections. Randomness of movements. Clearing and restarting. It doesn't really matter much what you do, but do something so that the user has some control; it's more interesting that way.
This is an individual assignmentyou will not have a partner. Turn in your own work.
You are welcome (and encouraged) to discuss the project with other students, and to give and receive help as needed. Do not, however, lend anyone your code, or ask to borrow anyone else's code, or work together with anyone to write code. Program this one by yourself.
You can use my Bouncing Ball Applet as a starting point. Sorry about the lack of comments!
Friday, December 9, by midnight. Late programs (up to a week) will be accepted with the usual 5 points/day penalty. Zip your project up and turn it in via Blackboard, as usual; don't forget to include your HTML file.