DescriptionThis program simulates how many sphere-like objects behave when moving around in a box. The spheres can collide with the box walls and with each other. The box does not have a ceiling because the simulation takes into account gravity, and the spheres can never go upward indefinitely.Simple User GuideThe program has a couple of buttons in the right panel. You can click on the camera buttons to change the camera view; however, I have also implemented a trackball interface if you drag the mouse over the screen, which is much more flexible than the camera views. You can start the simulation by pressing the "Simulate" button, pause it by pressing "Stop", or exit the program with the "Quit" button.ImplementationAll of the spheres are given initial positions and the same initial velocity. When the simulation begins, the only force acting on each of the spheres is the force of gravity. With each time step, the velocities of the spheres are updated only to take into account the gravitational force, unless there has been a collision with another object.For each time step: --> Loop through all spheres --> Check if any sphere has collided with a plane or with another sphere --> If there has been a collision, move simulation to the collision time and update sphere positions and velocities --> If there has not been a collision, move simulation a whole timeStep and update the positions and velocities of the spheres |
_____________________________________________________________ HERE is the source code HERE is the .exe file. _____________________________________________________________ |