Project Description:

The top is constructed using only particles and mass-springs in the following manner:

The following is a list of code modifications and respective locations in the application. This project was created in the particles system framework provided in class for homework three.

Simulating rigid body dynamics traditionally requires knowledge of many different facets of physics and mathematics. In such a simulation we must define the state of the body at any given instance of the simulation. In order to accomplish this we must calculate the following data:

- mass and moments of inertia
- position and velocity of every object
- rotational and angular force/momentum
- torque
- velocity and acceleration, linear and rotational
- numerical integration

Flexible body dynamics calculate position, velocity, acceleration, and force using particles, mass-springs, and a numerical integrator (this project uses 4th order Runge-Kutta), to run the simulation. This requires much less background of physics and mathematics. This is the idea of Dr. John McDonald's paper “On Flexible Body Approximations of Rigid Body Dynamics.” This project attempts to construct the ideas proposed in this paper. Specifically, this project simulates the dynamics of a toy top rotating, slowly loosing momentum, interacting with boundaries in space, and eventually toppling over on its side.

The motion of the top that we are trying to simulate is described by www.wikipeida.com as: “Typically the top will at first wobble until the shape of the tip and its interaction with the surface force it upright. After spinning upright for an extended period, the angular momentum, and therefore the gyroscopic effect, will gradually lessen, leading to ever increasing precession, finally causing the top to topple in a frequently violent last thrash.”

The top is constructed using only particles and mass-springs in the following manner:

Let T = a conical top

Let Mt = the mass of T = 100.0

Let p[14] = an array of particles

Let s[37] = an array of springs

- Place twelve particles in a circle with a radius of 6.
- Place one particle in the center of the center.
- Place one particle as the top’s base a distance of 9 from the center particle.

- The mass of each of the twelve particles around top’s edge:

m = Mt / (2*n)

m = (100 / 2) / 12 = 4.16 - The mass of the top center and base particle:

m = Mt / 4

m = 100 / 4 = 25

- Place twelve springs, one each between adjacent particles in the top circle.
- Place twelve springs, one from each particle in the top circle to the top center.
- Place twelve springs, one from each particle in the top circle to the base particle.
- Place one spring between the top center particle and the base particle.

- Set each spring with a stiff constant of k = 100,000. This gives the object enough of a structure to simulate rigid bodies.

- Setup an initial velocity on each particle in the top’s outer circle. The initial velocity should be tangent to each particle.
- The base particle is given a random velocity in the x and y direction. This gives the top initial movement across the ground surface.
- Apply a random tilt amount to every particle. This starts the gyroscopic and wobbling effect. This was done with a simple translation matrix.

Now that the top is set in motion we add collision detection to the simulation. Collision detection adds friction on the floor’s surface and contains the top within defined boundaries. Collision detection is integrated to the project via the collision class which inherits from force. In the Collision::CalculateForce function we calculate the repulsion force of the floor and wall surfaces, and then calculate the friction force of the floor.

The formula to calculate the repulsion force is Fs = k(H-z). Where k is the strenth of the repulsion, H is the height of the spring that is pushing the force away from the surface (H is also the equilibrium length of the spring), and z is the length of the compressed spring due to collision.

The formula used to calculate the friction force is Ff = -(v-dot(v,n)*n)*sigma. Where n is the surface normal, v is the velocity, and sigma is the friction constant.

The data needed for the collision class included: particle p0 and p1,
spring spr, vector normal, double sigma, LinkedList

A higher friction constant (sigma), resulted in less sliding and bouncing motion on the surfaces. In the repulsion spring, a higher friction coefficient (fricCoef), resulted in the object gripping the surface more tightly, and higher spring stiffness value (k), resulted in less bounce in the collision.

Overall, constructing the basic simulation was easier than originally anticipated. The physical movement of the top appears very realistic, especially the rotational movement. The only portion of the simulation where movement needs some additional adjustment is the last thrash when the top topples over. However, this can probably be tweaked a little more in the numerical setup of the simulation.

Future enhancements would include tweaking the numerical setup a bit. Adding the simulation the renderGL where we can incorporate the physical movement into additional scenes with more advanced texturing and lighting. I especially want to take time and add soft-edged shadows to the scene (my project from GPH595). Once in renderGL, constructing a scene with multiple top’s and several additional objects to collide with would be a very interesting exercise.

The following is a list of code modifications and respective locations in the application. This project was created in the particles system framework provided in class for homework three.

- Application.cpp
- Modified the SetupControls function to create the interface for the top application.
- Added event handler function ApplyParametersButtonPressed.
- Modified SetupSimulation function to setup all initial values for the particles and springs.
- Added ResetSimulation function to reset simulation parameter to default state.

- Collision.cpp and Collision.h
- This class inherits from Force.
- Implementation of CalculateForce functions for friction and repulsion.
- Data members for this class include: two particles, spring, a normal vector, friction constant sigma, and a linked list of particles.

- Matrix.cpp and Matrix.h
- For matrix operations.

- Simulation.cpp
- Added my implementation of 4th order Runge-Kutta.