Tutorial 9: Particle Systems, Spatial Data Structures and Collision Detection
The aims of the tutorial are:
-
to investigate computational performance of a 2D particle
system with collision detection, collision dynamics and
spatial data structures.
The tasks are:
-
Compile, run and examine the source code for the 2D particle
collision and dynamics example from
yallara:/public/courses/RealTimeAnimationAnd3DGames/particles/particles_2D.C
gcc -o p2d particles_2D.C -lglut -lGLU -lGL
-
Modify the program so that it displays the time per frame (s/frame)
as well as the frame rate (frames/s).
-
Reduce the size of the particles to 0.02.
-
Increase the number of particles from 1000 to 16000, doubling each
time. Tabulate the time taken per frame. Plot a graph - use a linear
scale not log scale (which the doubling has).
-
What is the relationship between frame rate and number of
particles? To find this out, graph the data using Open Office.
you will need to use a scatter plot as the samples are not
evenly spaced.
-
Change the collision detection method to uniform grid and
again increase the number of particles from 1000 to 8000
doubling each time. What is the relationship between frame
rate and number of particles?
-
By increasing or decreasing the number of particles work out
the system size where the uniform grid approach becomes faster
than the brute force approach.
-
The grid implementation in the program has an assumption that
particle size is less than voxel/bucket size, and each
particle is stored on only on one voxel object list. Consider
the changes necessary if this assumption is not met. Hint, for
each voxel/bucket store a list of all objects which intersect
it.