Constrained rigid body Collision detection Contact point - - PowerPoint PPT Presentation
Constrained rigid body Collision detection Contact point - - PowerPoint PPT Presentation
Constrained rigid body Collision detection Contact point Colliding contact Resting contact Friction Collision detection Determine whether the collision occurs within a numerical tolerance Determine all pairs of
- Collision detection
- Contact point
- Colliding contact
- Resting contact
- Friction
Collision detection
- Determine whether the collision occurs within
a numerical tolerance
- Determine all pairs of bounding boxes that
- verlap
- Further check contact points between rigid
bodies defined as convex polyhedra
Bisection
Y(t0) Y(t0 + ∆t) Y(t0 + 1 2∆t) Y(tc)
Bounding boxes
- Use bounding boxes to reduce the number of
pairwise collision/contact determinations
- If two bounding boxes have no overlap, no
further comparisons are needed
- Coherence can substantially improve the
performance
Bounding boxes
Sweep and sort algorithm
I1 I2 I3 I4 I5 I6
b3 b5 b1 e5 e1 b6 b2 e3 b4 e6 e4 e2
Bounding boxes
- Each bounding box i can be described as an
interval (bi, ei)
- Find all pairs of interval that intersect
- All the bi and ei are sorted from lowest to
highest in a list
- Maintain an active list which is initially empty
- Whenever bi is encountered, all intervals on the
active list are output as overlapping with i, and i is added to the list
Bounding boxes
Sweep and sort algorithm
I1 I
2
I3 I4 I5 I6
Quiz
- How does sweep and sort extend to 3D cases?
- A: Apply sweep and sort 3 times in x, y, and z
directions, and take the union of overlapped pairs
- B: Apply sweep and sort 3 times in x, y, and z
directions, and take the intersection of
- verlapped pairs
Bounding boxes
- We only need to do a full sort and sweep initially
- What is the cost of the sorting process?
- Subsequent comparisons can be improved by
utilizing coherence
- What is the best sorting algorithm for a nearly
sorted list?
Convex polyhedra
Two polyhedra do not inter-penetrate if and only if a separating plane between them exists
Separating plane
Separating plane
Check all possible edges or faces to find a separating plane at the very first time step or the first time the bounding boxes
- verlap
Y(t0)
Convex polyhedra
Defining face
Utilize coherence by caching defining faces or defining edges
Defining face
Y(t0 + ∆t)
Convex polyhedra
Defining face Defining face
The defining face no longer separate the polyhedra and a new separating plane must be found If no separating plane is found, an inter-penetration has occurred at some earlier time The simulator must back up until the collision time is determined
- Collision detection
- Contact point
- Colliding contact
- Resting contact
- Friction
Contact points
- Once we determine which bodies contact, we
also need to determine the exact contact points
- We consider two types of contacts
- vertex/faces
- edge/edge
Contact points
4 vertex/face 2 vertex/face 2 edge/edge
Contact points
A B A B
ˆ n ˆ n
pa(t) pb(t)
Although pa(t) and pb(t) are coincident at time tc, the velocity of the two points may be different
pa(tc) pb(tc)
Velocity of the contact point
vr = ˆ n(tc) · ( ˙ pa(tc) − ˙ pb(tc))
A B
ˆ n pa pb
˙ pb(tc) = vb(tc) + ωb(tc) × (pb(tc) − xb(tc)) ˙ pa(tc) = va(tc) + ωa(tc) × (pa(tc) − xa(tc))
This quantity gives the component of the relative velocity in the normal direction
Relative normal velocity
vr = 0 vr > 0 vr < 0
A B
˙ pa(tc) − ˙ pb(tc) ˆ n
Separation
A B
˙ pa(tc) − ˙ pb(tc) ˆ n
Resting contact
A B
˙ pa(tc) − ˙ pb(tc)
ˆ n
Colliding contact
- Collision detection
- Contact point
- Colliding contact
- Resting contact
- Friction
Collision process
no force no force
∆t
Impulse:
- fdt = J = M∆v
A soft collision
Force
∆t
Velocity
∆V
A harder collision
Force Velocity
∆t
∆V
∆t = 0
An infinitely hard collision
Force Velocity
fimp = ∞ fimp∆t = J
∆V
Impulse force
- In the rigid body world, we want velocity to
change instantaneously
- use finite impulse to change velocity instead
- f infinite force
- J = ΔP = M Δv
Impulsive torque
- If the impulse acts on a point p, J produces an
impulsive torque
- τimp = (p - x(t)) × J
- impulsive torque gives rise to a change in angular
momentum: τimp = ΔL
Colliding contact
A B
ˆ n jˆ n
For frictionless bodies, the direction of the impulse will be in the normal direction ˆ
n(tc)
J = jˆ n(tc)
Body A is subject to this impulse J, while body B is subject to an equal but opposite impulse -J If we can solve for j, we then can update the linear momentum of the rigid body after the collision
Colliding contact
A B
ˆ n jˆ n
Similarly, we use impulsive torque to update the angular momentum of the rigid bodies after collision
−rb × jˆ n ra × jˆ n
Colliding contact
A B
ˆ n
When two bodies collide, we apply an impulse between them to change their linear and angular momentum such that the penetration doesn’t happen in the next time step:
v+
r = −v− r
vr < 0
The empirical law
Coefficient of restitution: A B
ˆ n V −
r
= 0 = 1
= 0.5
= 0 = 1
Perfect bounce Resting contact
v+
r = −v− r
Colliding contact
A B
ˆ n
A B
ˆ n ˙ p+
a (tc) − ˙
p+
b (tc)
˙ p−
a (tc) − ˙
p−
b (tc)
jˆ n
Relative normal velocity before and after the application of the impulse before collision after collision
v−
r = ˆ
n(tc) · ( ˙ p−
a (t0) − ˙
p−
b (t0))
v+
r = ˆ
n(tc) · ( ˙ p+
a (t0) − ˙
p+
b (t0))
Compute the impulse
Define the displacements from center of mass of the body
rb = pb(tc) − xb(tc) ra = pa(tc) − xa(tc)
and The pre-impulse velocity of pa: The post-impulse velocity of pa: ˙
p+
a = v+ a (tc) + ω+ a (tc) × ra
˙ p−
a = v− a (tc) + ω− a (tc) × ra
Replace with in
v+
a (tc)
v+
a (tc) = v− a (tc) + jˆ
n(tc) Ma ˙ p+
a (tc)
Replace with in
ω+
a (tc) = ω− a (tc) + I−1(tc)(ra × jˆ
n(tc)) ω+
a (tc)
˙ p+
a (tc)
Compute the impulse
˙ p+
a (tc) = ˙
p−
a + j
ˆ n(tc) Ma + (I−1
a (tc)(ra × ˆ
n(tc))) × ra
- v+
r = ˆ
n(tc) · ( ˙ p+
a (tc) − ˙
p+
b (tc))
ˆ n(tc) · (I−1
b (tc)(rb × ˆ
n(tc))) × rb) = ˆ n(tc) · ( ˙ p−
a (tc) − ˙
p−
b (tc)) + j( 1
Ma + 1 Mb + ˆ n(tc) · (I−1
a (tc)(ra × ˆ
n(tc))) × ra+ = v−
r +j( 1
Ma + 1 Mb +ˆ n(tc)·(I−1
a (tc)(ra׈
n(tc)))×ra+ˆ n(tc)·(I−1
b (tc)(rb׈
n(tc)))×rb) v−
r +j( 1
Ma + 1 Mb +ˆ n(tc)·(I−1
a (tc)(ra׈
n(tc)))×ra+ˆ n(tc)·(I−1
b (tc)(rb׈
n(tc)))×rb) = −v−
r
˙ p+
b (tc) = ˙
p−
b − j
✓ ˆ n(tc) Mb + (I−1
b (tc)(rb × ˆ
n(tc))) × rb ◆
Compute the impulse
j = −(1 + )v−
r 1 Ma + 1 Mb + ˆ
n(tc) · (I−1
a (tc)(ra × ˆ
n(tc))) × ra + ˆ n(tc) · (I−1
b (tc)(rb × ˆ
n(tc))) × rb)
Now we can compute the impulse and impulsive torque for body A and B Finally, apply the change in linear momentum and angular momentum to the current state
L(tc + h) = L(tc) + τimp P(tc + h) = P(tc) + J τimp = ra × J J = jˆ n(tc)
A: B:
τimp = rb × J J = −jˆ n(tc)
- Collision detection
- Contact point
- Colliding contact
- Resting contact
- Friction
Resting contact
- In this case, all n contact points have the zero
relative velocity
- At each contact point there is some force ,
where fi is an unknown scalar
- Our goal is to determine what each fi is and all the
fi’s must be determined at the same time
fiˆ n(tc)
Resting contact
- To solve for fi, we need to consider
- three relations between acceleration of the
contact points and the contact forces
- all the fi that are in contact at the same time
Non-penetration
A B
ˆ n
pa(t) pb(t)
di(t) = 0
B
ˆ n pb(t)
A
pa(t)
di(t) < 0
A B
ˆ n pa(t) pb(t)
di(t) > 0
This is what we want to avoid di(t) = ˆ ni(t) · (pa(t) − pb(t))
Non-penetration
˙ di(t) = ˙ ˆ ni(t) · (pa(t) − pb(t)) + ˆ ni · ( ˙ pa(t) − ˙ pb(t)) At time tc, pa(tc) = pb(tc) The definition of two bodies in resting contact: di(tc) = ˙ di(tc) = 0 This means that ˙ di(tc) = vr
Non-penetration
If , the bodies have an acceleration towards each other and the penetration will occur
¨ di(tc) < 0
Therefore, the first condition is
¨ di(tc) ≥ 0 di(tc) = ˙ di(tc) = 0
When
Repulsive force
The contact forces can push bodies apart, but can never act like “glue” and hold bodies together Therefore, each contact force must act outward
fi ≥ 0
Workless force
The contact force at the a contact point becomes zero if the bodies begin to separate If contact is breaking , then fi should be zero
¨ di(tc) > 0
If fi is not zero, then the contact is not breaking
¨ di(tc) = 0
What is the equation that satisfies these two cases?
fi ¨ di(tc) = 0
Resting contact conditions
A B
ˆ n f ˆ n
Condition 1: Non-penetration Condition 2: Repulsive force Condition 3: Workless force
di(t) = ˆ ni(t) · (pa(t) − pb(t))
¨ di(tc) ≥ 0 fi ≥ 0
where
fi ¨ di(tc) = 0
Compute contact forces
¨ di(tc) = ai1f1 + ai2f2 + · · · + ainfn + bi
Step 1: compute A and b
¨ d1(tc) . . . ¨ dn(tc) = A f1 . . . fn + b
Step 2: solve f using quadratic programming
Compute contact forces
¨ di(tc) = ˆ ni(tc) · (¨ pa(tc) − ¨ pb(tc)) + 2 ˙ ˆ ni(tc) · ( ˙ pa(tc) − ˙ pb(tc))
Factor out the terms that depend on fj and assign them to aij Assign the rest of terms to bi
= ai1f1 + ai2f2 + . . . + ainfn+bi
See details in Baraff and Witkin’s course notes
Quadratic programming
Solve for Subject to
f1, f2, · · · , fn fi ≥ 0
A f1 . . . fn + b ≥ 0
(ai1f1 + · · · + ainfn + bi)fi = 0
i = 1 · · · n i = 1 · · · n
- Collision detection
- Contact point
- Colliding contact
- Resting contact
- Friction
Contact friction
- Dry friction occurs when surfaces in contact
are free of any contamination
- Wet friction occurs when the surfaces are
separated by a thin film of lubricants
Dry contact friction
- Coulomb’s law
- if sliding, the kinetic friction is
- if static (|vT|= 0) then stay static as long as
Ffriction = −µk|Fnormal| vT |vT | |Ffriction| ≤ µs|Fnormal|
Coulomb friction cone
static friction dynamic friction
Quiz
- Given µ for static friction, can you compute the angle
- f the friction cone θ?
|Ffriction| ≤ µs|Fnormal| θ
Quiz
- True or False
- Glass has bigger mu value than rubber.
- The larger the mu is, the wider the angle of the
friction cone is.
- Suppose I am pushing a furniture on the floor.
The faster I push horizontally, the more I damage the floor.
Collision friction
- Collision takes place over a very small time
interval with very large forces
- Assume forces don’t vary significantly over that
interval, then we can replace forces in friction laws with impulses
Dry collision friction
- Assume
- Static case is , when
- Sliding case is
µs = µk v+
T = 0
|v−
T | =≤ µ|∆vN|
v+
T = v− T − µ|∆vN| v− T
|v−
T |
Summary
- What’s the physical meaning of the rotation
matrix?
- How is the rotation matrix related to angular
velocity?
- How do you compute inertia tensor efficiently?
- Why do we compute impulse instead of force in