To create an animated set of objects based on a dynamic simulation.
You will create a flat rectangular polygon (on the y=0 plane, from -8 .. 8 in X and -4 ... 4 in Z) and position5 spheres in a line on top of it (create 5 spheres of radius 1, whose centers are positioned initially at (-6, 1, 0), (-3, 1, 0), (0,1, 0), (3, 1, 0), and (6, 1, 0)).
The spheres are acted on by two forces: gravity (G) and an upward force applied with a keyboard key. The keys that apply the forces to each of the spheres are "a", "s", "d", "f", and "g", respectively. The force is applied to the sphere while the key is held down, and is equal to (-4G).
The forces are modelled by Newton's Second Law (F = m a), a discussion of which can be found in section 17.4.1 of your text. The mass of the balls should be progressively greater along the line of balls: you should experiment and choose 5 reasonable masses, with the lightest at one end and the heaviest at the other.
Each ball should be a different color (red, green, blue, yellow, orange). The intensity of the color for each ball should be almost white when the ball is not moving (i.e. an intensity of 0.05 on a scale of 0-1). The color should be made more intense the faster the ball is moving (i.e. it should correspond to the absolute value of the velocity: some maximum velocity (your choice) corresponds to full intensity).
Given these parameters, the balls are initially at rest on the plane. When you press the appropriate keys, they are accelerated upward, and when a key is released the corresponding ball begins to slow down and fall back to the surface. In the basic assignment (the balls do not bounce: see the optional parts).
Your program should consist of a set of java files which should be commented with your name (the name you are registered under!) and ID number. One of the java files should implement a class "A4" (so the TA can execute it using the command "java A4".) The files should be emailed as attachments to a single email message to cs4451@cc.gatech.edu.
The time the mail is received will be used to determine whether or not the program is late, so be sure to allow a couple of minutes for the mail system to transmit your file if you are working right up to the deadline.
IMPORTANT: If the TA has to edit your files you will lose points. Similarly, the TA should be able to execute the class "A4", so using any other class as your main class will result in lost points.
This program is due on or before Wednesday, November 15th. This means it must be received by 11:59pm EDT on Wednesday to not be considered late.
You should set up the scene, lights and viewing transformation so that you can see the scene with a reasonable range of motion for the balls. As usual, do not choose a point on a primary axis, but something off center (e.g., look at something like 0,4,0, viewpoint -4, 8, 40 with some appropriate field of view). Create a single ambient light, and one directional light shining from the right of the camera (so that the balls appear to be lit from the right front side).
You will have to use the animated GLComponent: see the Magician manual for instructions on using it. Basically, when you turn animation on, your display routine is called continuously. In your display routine, you should update the simulation based on the time change since the last display update.
Your program should also allow the scene to be rotated with the mouse: a mouse click and drag in the X direction should rotate the world about the Y axis.
You should implement the balls as self-contained objects that have methods to report their vertical position and color at a given time. The object should also have a method to turn a single external force on and off (controlled by the key press/release). Your display routine should ask each ball for its position and color, apply the appropriate transformations, set the color and then draw a sphere for the ball.
For the basic assignment, when the balls reach the ground, they should stop moving.
There are two extra credit options on this assignment. You may do the first one or both, and each is worth a possible one point.