Phun with Physics The basic ideas Vector calculus
Phun with Physics • The basic ideas • Vector calculus • Mass, acceleration, position, … 1 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Some 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. 2 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
The basics • Let p(t) be the position in time. – We’ll drop the (t) and just say p • Other values: – velocity – a - acceleration Velocity is the derivative of position Acceleration is the derivative of velocity 3 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Vector calculus • Really, p(t) is a triple, right? – Think of these equations as three equations, one for each dimension – This is vector calculus 4 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Newton’s law and Momentum • We know this one… • Momentum 5 Note: Force is the derivative of momentum CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
What 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 6 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Example: 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? 7 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Euler’s method 8 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
What about orientation? • We’ll start in 2 D… • Let W be the orientation (angle) – Easy in 2 D, not so easy in 3 D we’ll be back • w is the angular velocity around center of gravity • a is the angular acceleration • Then… 9 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
What’s 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. 10 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Angular momentum • Angular momentum – At a point? – For the whole thing? – M=mv • Momentum equals mass times velocity • What does this mean? 11 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
We want to know how much of the momentum is “around” the center Angular Momentum of a point around c rcp 12 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Torque – Angular force Torque at a point 13 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Total angular momentum and moment of inertia I is the moment of inertia for the object. 14 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Moment of inertia What are the characteristics? What does large vs. small mean? How to we get this value? 15 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Relation of torque and moment of inertia 16 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Simple 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 17 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Object collisions • Imagine objects A and B colliding Assume collision is point on plane B A n 18 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
What happens? • ? ? ? B A n 19 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Our pal Newton… • Newton’s 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 What’s the consequence of “no friction”? 20 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Impulse felt by each object • Newton’s 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… We’ll need to know j B A n 21 No rotation for now… CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Solving for j… Then plug j into… 22 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
What about rotation? 23 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
How to determine the time of collision? • What do I mean? • Ideas? • Avoid “tunneling”: objects that move through each other in a time step 24 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Euler’s method We can write… 25 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
The problem with Euler’s method Taylor series: We’re throwing this away! Error is O(Dt 2) Half step size cuts error to ¼! 26 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Improving 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 27 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Midpoint Method • 1. Compute an Euler step • 2. Evaluate f at the midpoint • 3. Take a step using the midpoint value. 28 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Example Step 1 Step 2 Step 3 29 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Moving to 3 D • Some things remain the same – Position, velocity, acceleration • Just make them 3 D instead of 2 D • The killer: Orientation – “It’s possible to prove that no three-scaler parameterization of 3 D orientation exists that doesn’t ‘suck’, forsome suitably mathematically rigorous definition of ‘suck’. ” Chris Hecker 30 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Orientation options • Quaternions – We’ll use later • Matricies – We’ll use this here. 31 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Variables • x(t) – Spatial position in time (3 D) – 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) 32 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Angular velocity • w(t) – Angular velocity at any point in time – This is a rotation rate times a rotation vector h? , hu e g n Stra 33 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Note • Angular velocity is instantaneous – We’ll compute it later in equations, but we won’t keep it around. – Angular velocity is not necessarily constant for a spinning object! • Interesting! Can you visualize why? 34 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Angular 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 35 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Derivative of the rotation quaternion • Woa… Normalize this sucker and we can take a Newton step. Be sure to scale w(t) by Dt. 36 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Velocity 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 37 Linear part CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Force and torque • Fi(t) – Force on particle i at time t – Vector, of course Torque on point i: Total Force: Total Torque: 38 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Linear Momentum: And, the derivative of momentum is force: 39 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Angular Momentum • Angular momentum is preserved if no torque is applied. • L(t) is the angular momentum 40 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Inertia Tensor All that work typing this sucker in and it’s pretty much useless. Orientation dependent! 41 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Inertia Tensor for a base orientation 42 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Base inertia tensor to current inertia tensor Relation of angular momentum and inertia tensor: 43 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Bringing it all together • Current state: Position Orientation Linear momentum Angular momentum Velocity (may itself be updated) 44 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
3 D Collisions • There are now two possible types of collisions – Not just vertex to face 45 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
3 D collisions • Vertex to face • Edge to edge 46 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
We need… • 3 D collision detection – We’ll do that later • Determine when the collision occurred – Binary search for the time – Bisection technique 47 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Velocity at a point Position (center of gravity) Position of point Angular velocity Velocity (linear) 48 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Relative 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? 49 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
New 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 50 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
And j… 51 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Contrast 2 D/3 D 2 D 52 3 D CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Questions? • 2 D had two different j’s – Linear velocity and angular velocity • 3 D gets by with only one. – Why is this? 53 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
Other issues • Resting contact – Bodies in contact, but –e < vrel < e – Must deal with motion transfer 54 CSE 872 Dr. Charles B. Owen Advanced Computer Graphics
- Slides: 54