Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSGI.GA.2270  Computer Graphics

Fall 2022 Assignments

Simulation Assignment

Due date: 12.07.2022, 11:59pm

The aim of this assignment is to make you get familiar with simple simulation systems. For the scene hierarchy, you will get help from freeglut. glut was superseded by freeglut and it is still used for smaller projects, but I wouldn’t recommend it if you needmore than a quick demo.

OPENGL SETUP

•   This setup is for Visual Studio on Windows OS. You can use a different IDE and OS but a helper doc will not be provided for them.

•    Download shared files

•    Create a new folder, e.g. GL_Folder,  to put the content ( glew and freeglut)

•    Create an empty C++ project in Visual studio (see below).

•    Right click Project à Properties àConfiguration Properties à VC++ Directories àInclude Directories: Select Include folders of both glew and freeglut

•    Configuration Properties à Linker à Input:

Additional Dependencies:

Write: glew32.lib   and  freeglut.lib

•    Configuration Properties à Linker à General:

Additional Library Directories:

Select lib folders of both glew and freeglut

•    Copy glew32.dll   and  freeglut.dll from GL_Folder and paste them to your project folder

Be sure that your subsystem is Windows:

 

And your character set is set to: Not Set

 

PART I: PARTICLES NUMERICAL INTEGRATION SCHEMES

In this part, our ourpose is to create a simple particle system. Please check the empty fields in the given code which are commented with //TO DO line.

TASK 1  INTEGRATION SCHEMES

In this part, you are expected to implement Euler, Euler Cromer and Verlet methods. The first thing you need is taking the current value of position and velocity, then update them according to corresponding scheme and set the position and velocity of the particle with new values. Remember:

Euler:

xt+h  = xt  + hvt

vt+h  = vt  + h  Ft

Euler-Cromer:

vt+h  = vt  + h  Ft

xt+h  = xt  + hvt+h

Verlet:

xt+h   = 2xt  − xt$h  + h2   + 0(h4 )

Velocity independent

if needed:  = vt+h

TAKS 2  ENERGY COMPUTATION

In the second part, you are expected to compute system energies. So, traverse along the particle list, and update kinetic and potential energy accordingly.

Hint: for potential energy, h is computed as: particlePosition.y + halfWorld.getY().

TASK 3  COMPARISON

Try your system with different integration schemes and with different number of particles. Does energy computation result give an idea about the schemes’ stability? Discuss.

PART II: RIGID BODY CUBE

In this part, our purpose is to simulate a simple rigid body cube (see Figure 1). Please check the empty fields in the given code which are commented with //TO DO line.

TASK 1  FORCES

In this part, you are expected to apply forces to particles and springs appropriately (in Simulation.h). First of all, traverse along the particles and apply gravity to all of them. Later, traverse along the spring list and apply spring and damping forces. Please check Hooke’s Law and damping forces.

TAKS 2  ENERGY COMPUTATION

In the second part of the homework, you are expected to compute system energies (in Simulation.cpp).   First of all, traverse along the particle list, update kinetic and potential energy accordingly which is similar to your first programming assignment. Later, traverse along the spring list and compute total spring          energy of the system. Reminder: F = kx, and thus E =  kx2

TASK 3  COMPARISON

Try your system with different integration schemes, increase/decrease spring and damping constants (in Simulation.h). What kind of behavior you observed with different setup? Discuss the results.

 

Figure 1: Simple Rigid Body Simulation