29
1 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 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

Embed Size (px)

Citation preview

Page 1: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

1

Collision prediction for polyhedra under piecewise screw motions

Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing

Georgia Tech, Atlanta, USA

Page 2: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

2

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)

Page 3: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

3

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.

Page 4: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

4

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]

Page 5: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

5

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

• 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)

t1 t2 t3

Page 6: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

6

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

Page 7: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

7

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

Page 8: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

8

• 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]

Complexity of collision prediction

Page 9: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

9

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– (cdca+t(cdv))cb + (cdca+t(cdv))tv)=0– (cdca)cb +t(cdv)cb + (cdca)tv +t2(cdv)v = 0– (cdca)cb +t(cdv)cb + (cdca)tv = 0, because (cdv)v = 0– t = (cacd)cb / ((cdv)cb - (cdv)ca)– t = (cacd)cb / (abcd)v

• Make sure that, at that time, the two edges intersect– Not just the lines

a

b

c

d

v

Page 10: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

10

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

• 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

Scre

w M

otio

n

SEQ

K

Page 11: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

11

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

Page 12: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

12

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 ||KU||) );

d:=K•OO’;

Q:=(O+O’)/2 + (KOO’) / (2tan(b/2));

To apply screw motion: Translate by –Q;

Rotate K to Z;

Rotate around Z by tb;

Translate by (0,0,td);

Rotate Z to K;

Translate by Q;

UOV

U’V’ O’

P

d

b

(O+O’)/2

P’

axis

SL

E L

Q

K

I

Page 13: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

13

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

Page 14: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

14

ScrewBender (with Alex Powell)

• Polyscrew motion: interpolates consecutive poses by screws

• Subdivide using Split&Tweak on screws

Page 15: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

15

Video of ScrewBender

QuickTime™ and aMPEG-4 Video decompressor

are needed to see this picture.

Page 16: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

16

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

Page 17: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

17

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.

QuickTime™ and aVideo decompressor

are needed to see this picture.

EL

SL

OL

P

0 1 d

f(d)1

Decay function

Page 18: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

18

Bender Video

Page 19: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

19

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

Page 20: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

20

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

Page 21: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

21

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

Page 22: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

22

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)

Page 23: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

23

A

Rejecting object pairs

• Build (minimum) bounding spheres around objects

• Region swept by B lies in half of a cylindrical annulus

B If B lies outside of this CSG solid: no collision

Page 24: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

24

Rejecting helix-triangle pairs

• Triangle separated from helix by plane or cylinder

Too high along axis: above plane

Too low along axis: below plane

Too far from axis: outside cylinder

Not in screw angle: outside wedge

Too close to axis: inside cylinder

Page 25: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

25

Rejecting edge/edge pairs

• No collision if green edge lies outside of (wedge-portion of) the annulus containing region swept by red edge

Outside outer cylinder

above

below

Inside inner cylinder

Outside wedge

Page 26: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

26

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

Actual collisions only

50% cases are rejected by cylinder/sphere test

Page 27: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

27

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 speed-ups

Page 28: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

28

Thank you

Questions?

Page 29: 1 Collision prediction for polyhedra under piecewise screw motions Byung-Moon Kim and Jarek Rossignac GVU Center and College of Computing Georgia Tech,

29

Tringhttp://tring.powelltown.com/