|
Your assignment is to come up with a class that encapsulates
the above mentioned properties. You will need to instantiate this class
in the form of a simple sphere. The initial motion of the sphere should
be upward. After an amount of time it should slow down, stop and come
back down (gravity). On its downward path, cause it to collide with a
plane (N = <1,5,0> passing through the origin).
The ball should then come to a stop. Remember, in order to display the
plane on screen, you will need to rotate a cube so that it represents a
plane with the normal defined above.
Extra credit:Implement realistic physics using the
principle of reflection -> when the ball collides with the plane,
make it rebound with the appropriate velocity. Remember, the angle of
reflection equals the angle of incidence. In this case, we can find out
the angle of incidence using the old velocity vector and the plane
normal. We then need to construct the new velocity using the principle
of reflection. The angle of reflection is the angle between the plane
normal and the new velocity. You are required to come up with your own
vector class to perform all the operations required.
|