Index

## 1. Equations of motion

• • v is velocity (units m/s)
• a is acceleration (unit )
• t is time (units seconds)
• the final velocity equals the initial velocity + time × acceleration
• if we integrate this equation with respect to time we get:
• • the final position of the object equals the initial position + • • final velocity equals the initial velocity + 2 × the acceleration × the difference in position
• • • force in Newtons (Kg )
• the force required to accelerate one kilogram of mass at the rate of one metre per second squared
• Saturn V rocket generated 34.5 million newtons (lift off) !
• the translunar injection burn propelled the rocket to 10408 m/s (23286 miles per hour)

## 2. Hookes Law

• • the force is equal to × the current position of the spring - the at rest position of the spring
• at rest position of the spring
• current position of the spring
• k is the spring constant
• • • ## 3. PGE and springs

• examine the example code https://github.com/gaiusm/pge/blob/master/examples/springs/simple.py
• creates a two circles, one is fixed, one is moving and a spring between them
• in function main
• https://github.com/gaiusm/pge/blob/master/examples/springs/simple.py

```first = placeBall (wood_light, 0.55, 0.95, 0.03).fix ()
second = placeBall (wood_dark, 0.55, 0.35, 0.03).mass (1.0)
s = pge.spring (first, second, 100.0, 3.0, 0.5).draw (yellow, 0.005)```

• the parameters to the spring method are:
• first object
• second object
• spring constant ( )
• damping constant ( )
• at rest length ( )
• if the at rest length is omitted then it is assumed that the distance between first and second is the at rest value

## 4. Spring damping value

• • is the force of the spring
• is the Hookes constant of the spring
• is the current position of the spring
• is the at rest position of the spring
• if we model the spring using this equation, the spring will bounce an object forever
• we need a method to extract energy out of the spring, to give it realism
• • is the damping force
• is the hookes value of the damping value of the spring
• is the velocity of object 1 at the end of the spring
• is the velocity of object 2 at the other end of the spring
• finally these two equations are joined together
• • is a scalor overall force of the spring at the current position
• is the Hookes constant for the spring
• is the Hookes damping constant for the spring
• and are vectors of the velocity of the two objects connected by the spring
• is a vector of the positional difference between the two objects
• is the distance between the two objects
• notice the dot product, which for a vector of two items is equal to:
• • the input parameters to a dot product operator are vectors and the result is a scalar
• the force acting on object 1 is • the force acting on object 2 is ## 5. Springs in PGE

• take a look at the example bridge.py which implements a simple bridge using 4 non fixed circles and 5 springs
• notice that PGE allows us to define a callback for a spring when it reaches a length
• in the bridge example a spring will snap when it reaches snap_length (0.16)

## Index

1. Equations of motion
2. Hookes Law
3. PGE and springs
4. Spring damping value
5. Springs in PGE
Index

This document was produced using groff-1.22.