Skip to content

tizian/Spinning-Top-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spinning-Top-Simulation

Course project for 'Physically-Based Simulation in Computer Graphics' at ETH Zürich.

YouTube

https://www.youtube.com/watch?v=vEoIFi5xuzk

Installation

The recommended way to compile is using CMake. Clone the repository with all dependencies and use CMake to generate project files for your favourite IDE or build system.

git clone https://github.com/tizian/Spinning-Top-Simulation.git --recursive
cd Spinning-Top-Simulation
mkdir build
cd build
cmake ..
make
./SpinningTops
# SpinningTops.app is also in this folder

Pre-compiled binaries for Windows x64 and macOS are available here:

Windows x64

macOS

Usage

The program is controlled via keyboard inputs. The currently active spinning top is highlighted with a green tint.

Camera movement

Space Move the camera up.
Move the camera down.
W, A, S, D Move the camera: Forward, to the left, backward and to the right.
, , , Rotate the camera: Pitch up, yaw left, pitch down and yaw right.

C Reset the camera position and orientation to the default setting.

Spinning top control

0, ..., 6, 9 Create and drop different spinning top into the scene.
E + Number Create the corresponding spinning top, which rotates.
G + Number Create the corresponding spinning top, which is upside down.
V + Number Create 4 instances of the corresponding spinning top simultaneously.

E, G and V can be combined arbitrarily.

TAB Switch the currently active spinning top.
Remove the current spinning top from the scene.
Q Remove all spinning tops from the scene.

R Rotate the current spinning top counterclockwise.
T Rotate the current spinning top clockwise.

Z Add a force the current spinning to move it upwards.
U, H, J, K Add a force to the current spinning top to move it forwards, to the left, backwards and to the right relative to the default camera position.
I Add a force at the top of the current spinning top which points to the right (relative to the default camera position).

Visual

F Render the spinning tops as wireframes.
O Render the octrees of the spinning tops.
. Render the center of mass of the spinning tops.

Simulation control

X Slow down the simulation by a factor of 8.

P Pause the simulation.
When the simulation is paused you can press:
N Do a single forward step in the simulation.
B Do a single backward step in the simulation.
M + N or B Continuously do forward or backward steps in the simulation.

Used Libraries

  • gl3w - OpenGL core profile loading
  • glfw - Window and OpenGL context creation
  • glm - Math library
  • stb - PNG texture loading
  • tinyobjloader - OBJ mesh parser

About

A physically-based spinning top simulation.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages