Skip to content

Files

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Assignment 5 (Rigid Bodies)

Name: Karthik Ramesh Iyer UIN: 234009250

Prequisites

  • OpenGL 4.x
  • GLM
  • GLEW
  • Eigen

Set the following environment variables:

GLM_INCLUDE_DIR=/Users/karthik/lib/glm-0.9.9.8;GLFW_DIR=/Users/karthik/lib/glfw-3.3.8;GLEW_DIR=/Users/karthik/lib/glew-2.1.0

How to build and run

Clone the project and run the following commands in the root directory of the project:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4

To run the simulator:

./A4 ../resources ../data

Note

  • The simulation and rendering loop are set up in main.cpp. The approach used is to run both threads in parallel and the simulation thread updates the state which is read by the rendering thread. The rendering thread does not wait for the simulation thread. If the timestep used is h and processing one timestep takes time x, the simulation loop waits for time = max(h - x, 0) before processing the next timestep. This makes sure that the simulation is displayed at the expected rate.
  • All geometry is loaded in Scene.cpp, into the Shape class defined in Shape.h/Shape.cpp
  • Rigid body dynamics are handles in the RigidBody class (RigidBody.cpp and RigidBody.h)
  • Point-polygon and edge-edge collision is handled in the detectCollision, detectEdgeCollision and step functions in the the RigidBody class

Credits

This project uses: