Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech, Atlanta, USA.

Download Report

Transcript Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech, Atlanta, USA.

Collision prediction for polyhedra
under piecewise screw motions
Byung-Moon Kim and Jarek Rossignac
GVU Center and College of Computing
Georgia Tech, Atlanta, USA
1
The problem
Compute the time and place of collision between moving bodies
MOTIVATION
• Increase speed & accuracy of 3D animation and simulation
SCOPE
• Limited to polyhedral (triangulated) shapes
• Limited to rigid body motions (no deformation)
– (see [Von Herzen & Zatz’ 90] for collision of deforming shapes)
2
Prior art: Examples of pioneering work
•
•
•
•
•
•
•
•
•
S. Udupa, Collision detection and avoidance in computer controlled
manipulators. Proc. 5th Int. Conf. Artif. lntel.,1977.
J. W. Boyse. Interference detection among solids and surfaces.
Communications of ACM, 22(1):3–9, January 1979.
N. Ahuja, R. T. Chien, R. Yen, and N. Bridwell. Interference detection and
collision avoidance among three dimensional objects. Conference on AI,
Stanford University, August 1980.
D.P. Dobkin, D.G. Kirkpatrick, Fast detection of polyhedral intersection,
Theoret. Comput. Sci. 27, 1983.
J. U. Korein. A Geometric Investigation of Reach. The MIT Press, 1984.
S. A. Cameron and R. K. Culley. Determining the minimum translational
distance between two convex polyhedra. In Proceedings of IEEE International
Conference on Robotics and Automation, April 1986.
J. F. Canny. Collision detection for moving polyhedra. IEEE Transactions on
Pattern Analysis and Machine Intelligence, 8(2), March 1986.
…
P. Jimenez, F. Thomas, and C. Torras. 3D collision detection: a survey.
Computers and Graphics, 25(2), 2001.
3
Detecting interferences at each frame
Most approaches simulate the motions of all the objects and
after each time step, check if any pair of objects interfere
• O(n2) static interference detections between pairs of objects
– Each checks whether an edge of one stabs the face of another
• Quick rejections of distant pairs of objects
– Use bounds (boxes, spheres) around each object [Rimon&Boyd’97]
– Use velocity and distance [Culley&Kempf’86]
– Track minimum distances over time [Lin&Canny’91]
• Quick rejection of disjoint portions of the objects
–
–
–
–
Decompose shapes into convex parts [Bajaj&Dey’92]
Use hierarchy of bounds around object or its surface [Hubbard’96]
Partition space [Bandi&Thalmann’95] [Gottschalk&Lin&Manocha’96]
Track mobile data [Basch&Guibas&Hershberger’97]
4
Detection versus Prediction
• Detection: Simulate motion step-by-step and test for static
interference between parts at each key-frame
– Stop when interference is detected
– Search for correct collision time
• Binary split of last time-step
– Expensive (O(n2) per time step)
– Can easily miss collisions
t1
t2
t3
• Prediction: Compute time when the objects will first collide
– Test all pairs of surface elements that could collide
• Vertex-triangle, triangle-vertex, edge-edge
– Report the first collision to occur
– Fast
– Exact (can’t miss)
5
Reducing the problem to a single motion
• Assume solid A (bus) moves by a(t)
• Assume solid B (taxi) moves by b(t)
• a(t) and b(t) are parameterized rigid body transformations
– Can be represented by 4x4 matrix or pose (origin + orthonormal basis)
• Express everything in the moving CS of A (the bus)
– See the accident from the perspective of a passenger of the bus
– A (the bus) is now static
– The pose of B (the taxi) is defined by M(t)=b(t)*a–1(t)
• Two body collision problem may be reduced to the detection
of the collision of a single moving body with a static obstacle
6
Predicting polyhedral collisions
•
•
•
•
•
Assume solids A and B are initially disjoint
Assume A is static and B moves by rigid-body motion M(t)
First collision occurs at time t
The boundary of A and of B@M(t) intersect
The intersection must contain either:
– a vertex of A in a face of B@M(t) or
– a vertex of B@M(t) in a face of A or
– the intersection of an edge of A in an edge of B@M(t)
From Boyse’79
7
Complexity of collision prediction
• Vertex/face collision
–
–
–
–
V(t)=V@M(t) is a parametric curve.
Find its intersection with plane PV(t)•N=0: solve for t
Complexity of finding the roots ti depends on nature of M(t)
Then check which V(ti) lie inside the face
• Face/vertex collision
– Swap the role of A and B
• Edge/edge collision
–
–
–
–
When does edge (a@M(t),b@M(t)) collide with edge (c,d)?
They are coplanar when cd•((c–b@M(t))(c–a@M(t)))=0
Solve for roots ti (more complex than vertex/face)
Then check that (a@M(ti),b@M(ti)) intersects with (c,d)
• Complexity of root finding depends on nature of M
– Translation [Boyse’79, Cameron’85]
– Rotation (both objects around same axis) [Schomer&Thiel’95]
– Linear translation+variable speed rotation
• [Canny’86, Jimanez&Torras’85, Schomer & Thiel95]
8
Special case of pure translation
• Assume A moves with constant velocity v and B is fixed
• Collision may occur between
– A vertex p of A and a triangle T of B
• Intersect Ray(p,v) with T
– A triangle T of A with a vertex p of B
• Intersect Ray(p,-v) with T
– An edge (a,b) of A with an edge (c,d) of B
• Check when the volume of tetrahedron (a+tv,b+tv,c,d) becomes zero
–
–
–
–
–
–
–
solve (cd(ca+tv))(cb+tv)=0 for t
(cd(ca+tv))cb + (cd(ca+tv))tv)=0
(cdca+t(cdv))cb + (cdca+t(cdv))tv)=0
(cdca)cb +t(cdv)cb + (cdca)tv +t2(cdv)v = 0
(cdca)cb +t(cdv)cb + (cdca)tv = 0, because (cdv)v = 0
t = (cacd)cb / ((cdv)cb - (cdv)ca)
t = (cacd)cb / (abcd)v
• Make sure that, at that time, the two edges intersect
d
b
– Not just the lines
v
a
c
9
Use approximating piecewise screw-motions
• Screw motions are great!
–
–
–
–
–
Uniquely defined by start pose S and end pose E
Independent of coordinate system
Subsumes pure rotations and translations
Minimizes rotation angle & translation distance
Natural motions for many application
Q
S
E
K
• Simple to apply for any value of t in [0,1]
– Rotation by angle tb around axis Axis(Q,K)
– Translation by distance td along Axis(Q,K)
– Each point moves along a helix
• Simple to compute from poses S and E
– Axis: point Q and direction K
– Angle b
– Distance d
10
Screw history
(Ceccarelli [2000] Detailed study of screw motion history)
• Archimede (287–212 BC) designed helicoidal screw for water pumps
• Leonardo da Vinci (1452–1519) description of helicoidal motion
• Dal Monte (1545–1607) and Galileo (1564–1642) mechanical studies on
helicoidal geometry
• Giulio Mozzi (1763) screw axis as the “spontaneous axis of rotation”
• L.B. Francoeur (1807) theorem of helicoidal motion
• Gaetano Giorgini (1830) analytical demonstration of the existence of the
“axis of motion” (locus of minimum displacement points)
• Ball (1900) “Theory of screws”
• Rodrigues (1940) helicoidal motion as general motion
• ….
• Zefrant and Kumar (CAD 1998) Interpolating motions
11
Computing the screw parameters
From initial and final poses M(0) and M(1)
K:=(U’–U)(V’–V);
K:=K / ||K||;
b := 2 sin–1(||U’–U|| / (2 ||KU||) );
d:=K•OO’;
Q:=(O+O’)/2 + (KOO’) / (2tan(b/2));
P’
V’
K
Translate by –Q;
Rotate K to Z;
Rotate around Z by tb;
Translate by (0,0,td);
Rotate Z to K;
Translate by Q;
Q
axis
To apply screw motion:
U’
O’
d
(O+O’)/2
I
b
P
V
SL
O
U
12
Split&Tweak Subdivision
•
•
•
•
Split: Insert a new vertex in the middle of each edge
Cubic B-spline tweak: Tuck old vertices in
4-point tweak: Bulge new vertices out
Jarek tweak: Do half of each
13
ScrewBender (with Alex Powell)
• Polyscrew motion: interpolates consecutive poses by screws
• Subdivide using Split&Tweak on screws
14
Video of ScrewBender
QuickTime™ and a
MPEG-4 Video decompressor
are needed to see this picture.
15
Volume swept during screw motion
Computing and visualizing pose-interpolating 3D motions
Jarek R. Rossignac and Jay J. Kim (Hanyang University, Seoul, Korea), CAD, 33(4)279:291, April 2001.
SweepTrimmer: Boundaries of regions swept by sculptured
solids during a pose-interpolating screw motion
Jarek R. Rossignac and Jay J. Kim
16
Space warp based on a screw motion
“Twister: A space-warp operator for the two-handed editing of 3D shapes”, Llamas,
Kim, Gargus, Rossignac, and Shaw. Proc. ACM SIGGRAPH, July 2003.
P
OL
SL
f(d)
1
QuickTime™ and a
Video decompressor
are needed to see this picture.
0
1 d
Decay function
17
Bender Video
QuickTime™ and a
Sorenson Video 3 decompressor
are needed to see this picture.
18
Proposed approach
• For each pair of objects A and B do
– Approximate relative motion by a piecewise screw motion
• Insert intermediate poses as needed adaptively
– For each screw motion segment do
• Use quick rejection test to quickly identify collision-free situations
• If collision may not be discarded, then do
– For each vertex of A and each triangle of B do
» If collision cannot be discarded using bounds
» Then find time of first collision (if one occurs)
– For each vertex of B and each triangle of A do
» If collision cannot be discarded using bounds
» Then find time of first collision (if one occurs)
– For each edge of B and each edge of A do
» If collision cannot be discarded using bounds
» Then find time of first collision (if one occurs)
– Stop if collision was found and report time of first collision
19
Vertex-face (helix-plane intersection)
• Helix is V(t) = rcos(tb)i+rsin(tb)j+tdk in screw coordinates
– where V(0) lies on the i axis and the k-axis is parallel to s
• The screw intersects plane d +V(t)•n = 0 for values of t satisfying
– d +(rcos(tb), rsin(tb),td)•n = 0
• We compute all roots and check if they correspond to points in triangle
– Reduces to finding roots of f(t)=A+Bt+Ccos(bt+c)
– Separate roots using f’(t)=0, which requires solving B/bC=sin(bt+c)
– We use Newton iterations
20
Edge-edge intersection
• Requires roots of f(t)=A+(B+Ct)cos(bt+c)+(D+Et)sin(bt+c)
– We use Newton iterations from carefully computed seeds
• Angle or rotation < 180 degrees
• Check which roots corresponds to true E/E intersections
21
Early rejections
• Decide early that some pairs of objects cannot intersect
• Use simple bounds on objects and their swept regions
– Balls, cylindrical annuli
• Avoid most root-findings by rejecting pairs of elements
• Use bounds on elements and their swept regions
– Vertex (helix), edge (annulus)
22
Rejecting object pairs
• Build (minimum) bounding spheres around objects
• Region swept by B lies in half of a cylindrical annulus
A
–
B
If B lies outside of this CSG solid: no collision
23
Rejecting helix-triangle pairs
• Triangle separated from helix by plane or cylinder
Not in screw angle:
outside wedge
Too close to axis:
inside cylinder
Too high along axis:
above plane
Too far from axis:
outside cylinder
Too low along axis:
below plane
24
Rejecting edge/edge pairs
• No collision if green edge lies outside of (wedge-portion of)
the annulus containing region swept by red edge
Inside inner
cylinder
above
Outside outer cylinder
Outside
wedge
below
25
Early rejection tests: 55% speed up
•
Test setup
– A move along a fixed screw motion
– B is randomly placed and oriented in a in a box
• 50,000 different poses were tested
– Actual collision happened in about 10% of cases
– 50% cases rejected using bounding spheres around objects
• 50% of V/T cases and 66% of E/E cases rejected early
– A and B have about 160 triangles vertices
– 26,540 triangle/vertex and 58,266 edge/edge pairs
– Takes average of 4x10–7 sec per V/T or E/E rejection test
– Exact collision computation takes about 10–5 sec
50% cases are rejected by
cylinder/sphere test
Actual
collisions
only
26
Conclusions
• Perform exact prediction, rather than interference detection
• Approximate relative motion by screws (better than other types
of simple motions)
• Uses simple geometric rejection tests to identify cases where
objects do not collide, they reduce overall cost by half
• Uses simple geometric rejection test to discard more than half
of the V/T and E/E collision candidates
• Uses Newton to solve for exact collision time when needed: 10–
5 sec per V/T, T/V, or E/E collision
• Could be combined with hierarchical culling and other speedups
27
Thank you
Questions?
28
Tring
http://tring.powelltown.com/
29