No battleships this time, but exploding cubes... please download and start the Visual Studio Project BOUNCING CUBES. As the name tells you, this program shows cubes that bounce around in a 3d environment. After a while they explode (to moderate the impression of violence the explosion is modeled by a rotating cube that disappears after a while - you can easily change that, if you want to). You will (hopefully) see something like this:
Your task:
Alter the code in a way that the cubes do not explode after a while, but only if they collide with each other, i.e. any cube colliding with at least one other cube should explode, any non colliding cube survives (until collision occurs).
You can get 1 bonus point by changing the explosion sequence and add something more creative. The best explosion earns 2 bonus points
(About the mode who decides which one's 'the best': as a test for november we will elect it).
You have to use the 'Sort and Sweep' algorithm to detect collision of multiple objects. I will talk about it on friday. You can read about it in my slides (Collision: part III: collision of multiple objects) to prepare.
JAVA programmers:
The flashy application of bouncing cubes is not necessary to program sort and sweep, it's just a nice display. You can hand in the pure sort'n sweep algorithm, working on a set of 3d cubes. Please also hand in some test-data that proofs your code is running correctly.
You can gain 2 bonus points if you get an animated application running, similar to the c code !
Have fun !