540 likes | 661 Views
Phun with Physics. The basic ideas Vector calculus Mass, acceleration, position, …. 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
E N D
Phun with Physics • The basic ideas • Vector calculus • Mass, acceleration, position, …
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.
The basics • Let p(t) be the position in time. • We’ll drop the (t) and just say p • Other values: • v – velocity • a - acceleration Velocity is the derivative of position Acceleration is the derivative of velocity
Vector calculus • Really, p(t) is a triple, right? • Think of these equations as three equations, one for each dimension • This is vector calculus
Newton’s law and Momentum • We know this one… • Momentum Note: Force is the derivative of momentum
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
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?
What about orientation? • We’ll start in 2D… • Let W be the orientation (angle) • Easy in 2D, not so easy in 3D we’ll be back • w is the angular velocity around center of gravity • a is the angular acceleration • Then…
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.
Angular momentum • Angular momentum • At a point? • For the whole thing? • M=mv • Momentum equals mass times velocity • What does this mean?
We want to know how much of the momentum is “around” the center Angular Momentum of a point around c rcp
Torque – Angular force Torque at a point
Total angular momentum and moment of inertia I is the moment of inertia for the object.
Moment of inertia What are the characteristics? What does large vs. small mean? How to we get this value?
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
Object collisions • Imagine objects A and B colliding B Assume collision is point on plane A n
What happens? • ??? B A n
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”?
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… B We’ll need to know j A No rotation for now… n
Solving for j… Then plug j into…
How to determine the time of collision? • What do I mean? • Ideas? • Avoid “tunneling”: objects that move through each other in a time step
Euler’s method We can write…
The problem with Euler’s method Taylor series: We’re throwing this away! Error is O(Dt2) Half step size cuts error to ¼!
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
Midpoint Method • 1. Compute an Euler step • 2. Evaluate f at the midpoint • 3. Take a step using the midpoint value.
Example Step 1 Step 2 Step 3
Moving to 3D • Some things remain the same • Position, velocity, acceleration • Just make them 3D instead of 2D • The killer: Orientation • “It’s possible to prove that no three-scaler parameterization of 3D orientation exists that doesn’t ‘suck’, forsome suitably mathematically rigorous definition of ‘suck’.” Chris Hecker
Orientation options • Quaternions • We’ll use later • Matricies • We’ll use this here.
Variables • 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)
Angular velocity • w(t) • Angular velocity at any point in time • This is a rotation rate times a rotation vector Strange, huh?
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?
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
Derivative of the rotation quaternion • Woa… Normalize this sucker and we can take a Newton step. Be sure to scale w(t) by Dt.
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 Linear part
Force and torque • Fi(t) • Force on particle i at time t • Vector, of course Torque on point i: Total Force: Total Torque:
Linear Momentum Momentum: And, the derivative of momentum is force:
Angular Momentum • Angular momentum is preserved if no torque is applied. • L(t) is the angular momentum
Inertia Tensor All that work typing this sucker in and it’s pretty much useless. Orientation dependent!
Base inertia tensor to current inertia tensor Relation of angular momentum and inertia tensor:
Bringing it all together • Current state: Position Orientation Linear momentum Angular momentum Velocity (may itself be updated)
3D Collisions • There are now two possible types of collisions • Not just vertex to face
3D collisions • Vertex to face • Edge to edge
We need… • 3D collision detection • We’ll do that later • Determine when the collision occurred • Binary search for the time • Bisection technique
Velocity at a point Position (center of gravity) Position of point Angular velocity Velocity (linear)
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?
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