Rigid Body Simulation

In the course Advanced Computer Graphics we implemented a rigid body simulator. It is relatively simple, but a lot of work lies behind. The simulation consists of two parts: a collision detection method and a collision response method.

The first uses the GJK (Gilbert–Johnson–Keerthi) and EPA (Expanding Polytope Algorithm) algorithms to find any collisions between any two objects. The domain is also discretized into a grid so that we make sure to only check for collisions between objects that are nearby one another. The collision response is made with the LCP (Linear Complementarity problem) method, which comes down to an optimization problem. This makes it possible for us to resolve several contact point at one time.

The course emphasises a lot on parallel computing. The code uses OpenMP to parallelize the computations as much as possible. The clip below shows an example where a large amount objects are being used.