Title: Phun with Physics
1Phun with Physics
- The basic ideas
- Vector calculus
- Mass, acceleration, position,
2Some defs
- Kinematics
- The status of an object
- Position, orientation, acceleration, speed
- Describes the motion of objects without
considering factors that cause or affect the
motion - Dynamics
- The effects of forces on the motion of objects.
3The basics
- Let p(t) be the position in time.
- Well drop the (t) and just say p
- Other values
- v velocity
- a - acceleration
Velocity is the derivative of position Acceleratio
n is the derivative of velocity
4Vector calculus
- Really, p(t) is a triple, right?
- Think of these equations as three equations, one
for each dimension - This is vector calculus
5Newtons law and Momentum
- We know this one
- Momentum
Note Force is the derivative of momentum
6What about real objects?
- Think of a real object as a bunch of points, each
with a momentum - We can find a center of mass for the object and
treat the object as a point with the total mass - We have
- Mass, position vector, acceleration vector,
velocity vector
7Example Air Resistance
- The resistance of air is proportional to the
velocity - F -kv
- We know F ma, so ma -kv
So, how can we solve?
8Eulers method
9What about orientation?
- Well start in 2D
- Let W be the orientation (angle)
- Easy in 2D, not so easy in 3D well be back
- w is the angular velocity around center of
gravity - a is the angular acceleration
- Then
10Whats the velocity at a point?
Radians are important, here
Perpendicular to cp Same length! Perpendicularized
radius vector
p
Chasles Theorem Velocity at any point is the
sum of linear and rotational components.
11Angular momentum
- Angular momentum
- At a point?
- For the whole thing?
- Mmv
- Momentum equals mass times velocity
- What does this mean?
12We want to know how much of the momentum is
around the center
Angular Momentum of a point around c
rcp
13Torque Angular force
Torque at a point
14Total angular momentum and moment of inertia
I is the moment of inertia for the object.
15Moment of inertia
What are the characteristics? What does large vs.
small mean? How to we get this value?
16Relation of torque and moment of inertia
17Simple dynamics
- Calculate/define center of mass (CM) and moment
of inertia (I) - Set initial position, orientation, linear, and
angular velocities - Determine all forces on the body
- Linear acceleration is sum of forces divided by
mass - Angular acceleration is sum of torques divided by
I - Numerically integrate to update position,
orientation, and velocities
18Object collisions
- Imagine objects A and B colliding
B
Assume collision is point on plane
A
n
19What happens?
B
A
n
20Our pal Newton
- Newtons law of restitution for instantaneous
collisions with no friction - e is a coefficient of restitution
- 0 is total plastic condition, all energy absorbed
- 1 is total elastic condition, all energy reflected
Whats the consequence of no friction?
21Impulse felt by each object
- Newtons third law equal and opposite forces
- Force on A is jn (n is normal, j is amount of
force) - Force on B is jn
- So
B
Well need to know j
A
No rotation for now
n
22Solving for j
Then plug j into
23What about rotation?
24How to determine the time of collision?
- What do I mean?
- Ideas?
- Avoid tunneling objects that move through
each other in a time step
25Eulers method
We can write
26The problem with Eulers method
Taylor series
Were throwing this away!
Error is O(Dt2)
Half step size cuts error to ¼!
27Improving accuracy
- Supposed we know the second derivative?
But, we would like to achieve this error without
computing the second derivative. We can do this
using the Midpoint Method
28Midpoint Method
- 1. Compute an Euler step
- 2. Evaluate f at the midpoint
- 3. Take a step using the midpoint value.
29Example
Step 1
Step 2
Step 3
30Moving to 3D
- Some things remain the same
- Position, velocity, acceleration
- Just make them 3D instead of 2D
- The killer Orientation
- Its possible to prove that no three-scaler
parameterization of 3D orientation exists that
doesnt suck, forsome suitably mathematically
rigorous definition of suck. Chris Hecker
31Orientation options
- Quaternions
- Well use later
- Matricies
- Well use this here.
32Variables
- x(t)
- Spatial position in time (3D)
- Center of mass at time t
- Assume object has center of mass at (0,0,0)
- v(t)
- Velocity in space
- q(t)
- Orientation in time (quaternion)
33Angular velocity
- w(t)
- Angular velocity at any point in time
- This is a rotation rate times a rotation vector
Strange, huh?
34Note
- Angular velocity is instantaneous
- Well compute it later in equations, but we wont
keep it around. - Angular velocity is not necessarily constant for
a spinning object! - Interesting! Can you visualize why?
35Angular velocity and vectors
- Rate of change of a vector is
- This is why they like that notation
- Change is orthogonal to the normal and vector
- Magnitude of change is vector length times
magnitude of w
36Derivative of the rotation quaternion
Normalize this sucker and we can take a Newton
step. Be sure to scale w(t) by Dt.
37Velocity of a point (think vertex)
- Not just v(t), must include rotation!!!
Position of point at time t
Just a reminder
Velocity of point at time t
And the magic
Angular part
Linear part
38Force and torque
- Fi(t)
- Force on particle i at time t
- Vector, of course
Torque on point i
Total Force
Total Torque
39Linear Momentum
Momentum
And, the derivative of momentum is force
40Angular Momentum
- Angular momentum is preserved if no torque is
applied. - L(t) is the angular momentum
41Inertia Tensor
All that work typing this sucker in and its
pretty much useless. Orientation dependent!
42Inertia Tensor for a base orientation
43Base inertia tensor to current inertia tensor
Relation of angular momentum and inertia tensor
44Bringing it all together
Position
Orientation
Linear momentum
Angular momentum
Velocity (may itself be updated)
453D Collisions
- There are now two possible types of collisions
- Not just vertex to face
463D collisions
- Vertex to face
- Edge to edge
47We need
- 3D collision detection
- Well do that later
- Determine when the collision occurred
- Binary search for the time
- Bisection technique
48Velocity at a point
Position (center of gravity)
Position of point
Angular velocity
Velocity (linear)
49Relative velocity
Normal to object b Vertex to face normal for
face Edge to edge cross product of edge
directions
Positive vrel means moving apart, ignore
it Negative vrel means interpenetrating, process
it What does zero vrel mean?
50New velocities for a and b
Vector from center of mass to point
Let
Normal
Velocity (linear) update
Mass
Angular velocity update
Inertia tensor inverse
Equivalent equations for b
51And j
52Contrast 2D/3D
2D
3D
53Questions?
- 2D had two different js
- Linear velocity and angular velocity
- 3D gets by with only one.
- Why is this?
54Other issues
- Resting contact
- Bodies in contact, but e lt vrel lt e
- Must deal with motion transfer