Collision Detection: and Applications

Ming C. Lin, U.S. Army Research Oce and University of North Carolina, Chapel Hil l, NC, USA

Dinesh Mano cha, University of North Carolina, Chapel Hil l, NC, USA

Jon Cohen, University of North Carolina, Chapel Hil l, NC, USA

Stefan Gottschalk, University of North Carolina, Chapel Hil l, NC, USA

http://www.cs.unc.edu/~geom/collide.html

Fast and accurate col lision detection between general The most challenging problem in a simulation,

geometric models is a fundamental problem in model- namely the collision phase, can b e separated into three

ing, robotics, manufacturing and computer-simulated parts: , contact area determination,

environments. Most of the earlier are either and collision resp onse. In this pap er, we address the

restricted to a class of geometric models, say convex rst two elements by presenting general a purp ose col-

polytopes, or are not fast enough for practical applica- lision detection and contact area determination algo-

tions. We present an ecient and accurate algorithm rithm for simulations. The collision resp onse is appli-

for col lision detection between general polygonal mod- cation dep endent. The algorithm rep orts the contact

els in dynamic environments. The algorithm makes area and thus enables the application to compute an

use of hierarchical representations along with frame to appropriate resp onse.

frame coherencetorapid ly detect col lisions. It is ro-

Our algorithm not only addresses interaction b e-

bust and has been implementedaspart of public domain

tween a pair of general p olygonal ob jects, but also large

packages. In practice, it can accurately detect al l the

environments consisting of hundreds of moving parts,

contacts between large complex geometries composedof

such as those encountered in the manufacturing plants.

hundreds of thousands of polygons at interactive rates.

Furthermore, we do not assume the motions of the ob-

jects to b e expressed as a closed form function of time.

1 Intro duction

Our collision detection scheme is ecient and accurate

to the resolution of the mo dels.

Collision detection is a fundamental problem in

Given the geometric mo dels, the algorithm pre-

rob otics, computer animation, physically-based mo d-

computes the convex hull and a hierarchical representa-

eling, molecular mo deling and computer simulated en-

tion of each mo del in terms of oriented b ounding b oxes.

vironments. In these applications, an ob ject's motion

At runtime, it uses tight tting axis-aligned b ounding

is constrained by collisions with other ob jects and by

boxes to pair down the numb er of ob ject pair interac-

other dynamic constraints. The problem has b een well

tions to only those pairs within close proximity [12].

studied in the literature.

For each pair of ob jects whose b ounding b oxes over-

A realistic simulation system, which couples geomet-

lap, the algorithm checks whether their convex hulls

ric mo deling and physical prototyping, can provide a

are intersecting based on the closest feature pairs [22].

useful to olset for applications in rob otics, CAD/CAM

Finally for each ob ject pair whose convex hulls over-

design, molecular mo deling, manufacturing design sim-

lap, it makes use of oriented b ounding b ox hierarchy

ulations, etc. Such systems create electronic represen-

OBBTree to check for actual contact [18].

tations of mechanical parts, to ols, and machines, which

need to b e tested for interconnectivity, functionality,

and reliability. A fundamental comp onent of sucha Organization: The rest of the pap er is organized as

system is to mo del ob ject interactions precisely. The follows: Section 2 reviews some of the previous work

interactions mayinvolve ob jects in the simulation envi- in collision detection. Section 3 outlines the algorithm

ronment pushing, striking, or smashing other ob jects. for pruning the numb er of ob ject pairs. We brie y

Detecting col lisions and determining contact points is a describ e the closest feature and contact determination

crucial step in p ortraying these interactions accurately. algorithms in Section 4. Finally,we describ e the imple-

leftmark

mentation and p erformance on di erent applications in at every time step can b ecome time consuming as N

Section 5 and M get large. Toachieveinteractive rates, the total

numb er of pairwise intersection tests must b e reduced

b efore p erforming exact collision tests on the ob ject

2 Previous Work

pairs, which are in the close vicinityofeach other. Sev-

eral metho ds dealing with this situation are found in

Collision detection has b een extensively studied in

[7,12, 16]. Most metho ds use some typ e of a hierarchi-

CAD, , rob otics, and computational

cal b ounding b oxscheme. Ob jects are surrounded by

geometry. Since collision detection is needed in a wide

b ounding b oxes. If the b ounding b oxes overlap, indi-

variety of situations, many di erent metho ds have b een

cating the ob jects are near each other, a more precise

prop osed. Most of them make sp eci c assumptions

collision test is applied.

ab out the ob jects of interest and design a solution

based on ob ject geometry or application domain.

As for curved mo dels, algorithms based on inter-

val arithmetic for collision detection are describ ed in

Rob otics literature deals with collision detection in

[15, 17]. These algorithms exp ect the motion of the

the context of path planning. Using sophisticated

ob jects to b e expressed as a closed form function of

mathematical to ols, several algorithms have b een de-

time. Moreover, the p erformance of interval arithmetic

velop ed that plan collision-free paths for a rob ot in

based algorithms is to o slow for interactive applica-

restricted environments [8, 9]. However, in path plan-

tions. Coherence based algorithms for curved mo dels

ners based on p otential eld metho ds, collision detec-

are presented in [24].

tion and distance computation are still considered as

ma jor b ottlenecks [21,10].

In many CAD applications, the input mo dels are

given as collections of p olygons with no top ology in-

Most literature deals with

formation. Such mo dels are also known as `p olygon

collision detection of ob jects in a static environment.

soups' and their b oundaries mayhave cracks, T-joints,

Ob jects are at a xed lo cation and orientation, and

or mayhave non-manifold geometry. In general, no

the algorithms determine whether they are intersecting

robust techniques are known for cleaning such mo dels.

[11, 13]. In most mo deling and graphics applications,

Many of the algorithms describ ed are not applicable

where many ob jects are in motion, such an approach

to such mo dels. Rather techniques based on hierarchi-

would b e inecient. Moreover, the ob jects move only

cal b ounding volumes and and spatial decomp osition

slightly from frame to frame and the collision detec-

are used on such mo dels. Typical examples of b ound-

tion scheme should take advantage of the information

ing volumes include axis-aligned b oxes of which cub es

from the previous frame to initialize the computation

are a sp ecial case and spheres, and they are chosen

for the current frame [3, 23]. Several solutions based

for to the simplicity of nding collision b etween two

on this idea of coherence have b een prop osed in [22].

suchvolumes. Hierarchical structures used for colli-

Approaches that combine collision resp onse with de-

sion detection include cone trees, k-d trees and o ctrees

tection can b e found in [3, 33, 25]. The metho ds in

[31], sphere trees [20,30], R-trees and their variants

[32,33] make use of the b oundary representation to

[5], trees based on S-b ounds [7] etc. Other spatial rep-

detect collisions.

resentations are based on BSP's [27] and its extensions

Collision detection for multiple moving ob jects has

to multi-space partitions [32], spatial representations

recently b ecome a p opular research topic with the in-

based on space-time b ounds or four-dimensional test-

creased interest in large-scaled virtual prototyping en-

ing [1,6,9, 20] and many more. All of these hierarchical

vironments. For example, a vibratory parts feeder can

metho ds do very well in p erforming \rejection tests",

contain up to hundreds of mechanical parts moving si-

whenever two ob jects are far apart. However, when the

multaneously under p erio dical force impulses in a vi-

two ob jects are in close proximity and can havemul-

bratory b owl or tray. In a general simulation environ-

tiple contacts, these algorithms either use sub division

ment, there maybe N moving ob jects and M station-

techniques or checkvery large numb er of b ounding vol-

ary ob jects. EachoftheN moving ob jects can collide

ume pairs for p otential contacts. In such cases, their

with the other moving ob jects, as well as the stationary

p erformance slows down considerably and they b ecome

N

ones. Keeping trackof +NM pairs of ob jects

a ma jor b ottleneck in the simulation, as stated in [19]. 2

Collision Detection: Algorithms & Applications

3 Collision Detection b etween Multiple b ounding b oxes can overlap if and only if their inter-

vals overlap in all three dimensions.

Moving Ob jects

We construct three lists, one for each dimension.

We review our previous algorithm for multiple mov-

Each list contains the values of the endp oints of the

ing convex p olytop es in complex environments. Co-

intervals in each corresp onding dimension. By sorting

herence combined with incremental computation is a

these lists, we can determine whichintervals overlap.

ma jor theme of our algorithms. By exploiting coher-

In the general case, such a sort would take O N log N 

ence, we are able to incrementally trim down the num-

time, where N is the numb er of ob jects. We can re-

b er of pairwise ob ject pairs and feature tests involved

duce this time b ound bykeeping the sorted lists from

in each iteration.

the previous frame, up dating only the interval end-

p oints. In environments where the ob jects make rel-

De nition: Temporal and geometric coherence is

atively small movements b etween frames, the lists will

the prop erty that the state of the application do es not

b e nearly sorted, so we can re-sort using insertion sort

change signi cantly b etween successive time steps or

in exp ected O N  time [26,3]. Graphs 1 { 6 are timings

simulation frames. The ob jects move only slightly from

taken from a multi-ob ject simulation where we com-

frame to frame. This slightmovement of the ob jects

pare the p erformance of using xed versus dynamic

translates into geometric coherence, since their spatial

sized b oxes [12]. Parameters such as the number of

relationship do es not change muchbetween frames.

ob jects, the p olygonal complexity of the ob jects, the

For a con guration of N ob jects, the worst case run-

velo city of the ob jects, etc. were varied as the graphs

2

ning time for any collision detection algorithm is O N 

show.

N is the numb er of ob jects. However, evidence

where Graph 1 Graph 2

suggests that these cases rarely o ccur in simulations

0.18 0.23

[3, 12, 22, 28]. So our algorithm uses a Sweep and 0.16 Dynamic 0.20 Box

0.18

technique to eliminate testing ob ject pairs that

Prune 0.14 Fixed Cube

0.12 0.15

are far apart, and later we show that the technique can 0.10 0.13 b e extended to eliminate testing features that are far 0.08 0.10

0.06 0.08

apart b etween two colliding ob jects. Seconds per Frame

0.04 0.05

e use a b ounding b ox based scheme to reduce the W 0.02 0.03

2 0.00 0.00

O N  b ottleneck of testing all p ossible pairs of ob jects 0 500 1000 1500 2000 0 100 200 300 400

for collisions. In most realistic situations, an ob ject has Number of Polytopes Number of Faces to b e tested against a small fraction of all ob jects in the

Graph 4 vironment for collision. For example, in a simulation en Graph 3

of a vibratory parts feeder most ob jects are in close 0.16 0.14

ximity to only a few other ob jects. It would b e

pro 0.14 0.12

tless and exp ensivetokeep track of all p ossible p oin 0.12

0.10

teractions b etween ob jects at each time step. in 0.10 0.08

0.08 xes surrounding the ob jects Sorting the b ounding b o 0.06 0.06

Seconds per Frame

ey to our Sweep and Prune approach [12]. It is the k 0.04

0.04

tuitively obvious how to sort b ounding b oxes

is not in 0.02 0.02

verlaps. We use a dimension in 3-space to determine o 0.00 0.00

0.0 2.0 4.0 6.0 8.0 10.0 0 102030405060708090

reduction approach. If two b ounding b oxes collide in 3-

% Density of Simulation Volume Rotational Velocity (degrees/frame)

D, then their orthogonal pro jections on the x, y , and z

axes must overlap. The sweep and prune algorithm b e-

gins by pro jecting each 3-D b ounding b ox surrounding

4 Exact Collision Detection

an ob ject onto the x, y , and z axes. Since the b ound-

Given two ob jects in close proximity, the algorithm ini- ing b oxes are axially-aligned, pro jecting them onto the

tially checks whether their convex hulls are overlap- co ordinate axes results in intervals. We are interested

ping. It incrementally computes their closest feature in overlaps among these intervals, b ecause a pair of leftmark

Graph 5

Collision Tests nely discretized paths. In most situations, the algo- 0.11

Sort Lists

rithm runs in expectedconstant time if the p olytop es

0.10 Update Boxes

are not moving at large discrete steps e.g. 180 degrees 0.09

0.08 of rotation p er step.

0.07

Voronoi Regions 0.06 4.1.1

0.05

Each convex p olytop e is pre-pro cessed into a mo d- 0.04

Seconds per Frame

i ed b oundary representation. The p olytop e data

0.03 structure has elds for its features faces, edges, and

0.02

ertices and corresp onding Voronoi regions. Each fea-

0.01 v y its geometric parameters and its 0.00 ture is describ ed b

0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45

neighb oring features, i.e. the top ological information

Rotational Velocity for Dynamic Box of incidences and adjacencies.

Graph 6

De nition: A Voronoi region asso ciated with a fea-

0.05

ture is a set of p oints closer to that feature than any

0.04

other [29].

0.03 oronoi regions form a partition of the space 0.02 The V

0.01 outside the p olytop e, and they form the generalized Seconds per Frame

0.00 Voronoi diagram of the p olytop e. Note that the gener-

0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45

oronoi diagram of a convex p olytop e has linear

Rotational Velocity for Fixed Cube alized V

numb er of features and consists of p olyhedral regions.

A cel l is the data structure for a Voronoi region of a

pairs and check for overlap. If the convex hulls are in-

single feature. It has a set of constraint planes which

tersecting, it checks whether the overlapping features

b ound the Voronoi region with p ointers to the neigh-

b elong to the original mo del or are intro duced by the

b oring cells which share a constraint plane with it in

convex hull computation. Eventually it makes use of

its data structure. If a p oint lies on a constraint plane,

hierarchy of oriented b ounding b oxes to check for exact

then it is equi-distant from the two features which share

contact.

this constraint plane in their Voronoi regions. For more

details on this construction and its prop erties, please

4.1 Collision Detection b etween Convex Poly-

refer to [22].

top es

4.1.2 Closest Feature Tests

The algorithm computes the convex hull of all ob jects

as part of pre-pro cessing. Furthermore, it classi es the

Our metho d for nding closest feature pairs is based

feature of convex hulls into red and green features. The

on Voronoi regions. We start with a candidate pair of

red features corresp ond to the features of the original

features, one from each p olytop e, and check whether

mo del and the green features are intro duced by the

the closest p oints lie on these features. Since the p oly-

convex hull computation.

top es and their faces are convex, this is a lo cal test

involving only the neighb oring features of the current

We use the algorithm describ ed in [22]tokeep track

candidate features. If either feature fails the test, we

of closest features for a pair of convex p olytop es. The

step to a neighb oring feature of one or b oth candidates,

algorithm maintains a pair of closest features for each

and try again. As the Euclidean distance b etween fea-

convex p olytop e pair and calculates the Euclidean dis-

ture pairs must always decrease when a switch is made,

tance b etween the features to detect collisions. This

cycling is imp ossible for non-p enetrating ob jects. An

approach can b e used in a static environment, but is es-

example of the algorithm is given in Fig. 1.

p ecially well-suited for dynamic environments in which

ob jects move in a sequence of small, discrete steps. The Given a pair of features Face1and vertex V ,on

b

metho d takes advantage of coherence: the closest fea- ob jects A and B , as the closest features we test to see

tures change infrequently as the p olytop es move along if vertex V lies within Cel l 1 of of Face1. V violates

b b

Collision Detection: Algorithms & Applications

troid of each convex p olytop e { the

Object B puting the cen

weighted average of all vertices. Then a hyp erplane

from each edge is extended towards the centroid. The

yp erplane tap ers to a p oint, forming a

Cell 1 extended h

yramid-typ e cone over each face. Each of the faces of

CP p

en p olytop e is now used as a constraint plane. V the giv

b t imp osed by

Cell 2 If a candidate feature fails the constrain

the face indicating the closest feature pair lies p ossi-

bly b ehind this face, the algorithm stepping \enters"

wn in Fig. 2. If at any

Face 1 Pa inside of the p olytop e as sho

time we nd one p oint on a feature of one p olytop e

tained within the pseudo internal Voronoi region

Cell 3 is con

this p oint satis es the constraints p osed byan

Object A i.e.

pseudo internal Voronoi region of the other p olytop e,

it corresp onds to a p enetration. A detailed discussion

is presented in [28]

4.1.4 Feature Classi cation

Figure 1: A walk across Voronoi cel ls.

The algorithm highlighted ab ove returns all pairs of

overlapping features b etween the convex hulls. The

the constraint plane imp osed by CP of Cel l 1. The

resulting feature pairs can b e classi ed into:

constraint plane CP has a p ointer to its adjacent cell

Cel l 2, so the walk pro ceeds to test the containmentship

 Red-red feature overlap as shown in Fig. 3a:

of V within Cel l 2. In similar fashion, vertex V has

This corresp onds to an actual collision b etween

b b

a cell of its own, and we see if the nearest p oint P

the original mo dels.

a

on the edge to the vertex V lies within V 's Voronoi

b b

 Red-green feature overlap as shown in Fig. 3b:

cell. Basically,we are p erforming the containmentship

This mayormay not corresp ond to a collision.

tests of a p oint within a Voronoi region de ned by the

The algorithm presented in the next section is used

constraint planes of the region. The constraint plane

to check for exact contact.

causing the containmentship test to fail p oints the next

 Green-green feature overlap as shown in Fig.

direction for the algorithm to advance in the searchof

3c: Same as ab ove. The algorithm presented

a new and closer feature. Eventually,wemust reach

in the next section is used to check for exact con-

the closest pair of features.

tact.

4.1.3 Penetration Detection for Convex Polytop es

4.2 Exact Contact Determination

The key to detecting p enetrations lies in partition-

In this section, we present a robust, ecient and gen-

ing the interior as well as the exterior of the convex

eral purp ose algorithm to compute all contacts b etween

p olytop e. For internal partitioning, internal Voronoi

geometric mo dels comp osed of p olygons. The algo-

regions can b e used. The internal Voronoi regions can

rithms computes a hierarchical representation using

b e constructed for any convex p olytop e by computing

orientedbounding boxes OBBs. An OBB is a rect-

all the equi-distanthyp erplanes b etween two or more

angular b ounding b ox at an arbitrary orientation in 3-

facets on the p olytop e. However the general construc-

space. The resulting hierarchical structure is referred

tion of the internal Voronoi regions is a non-trivial com-

to as an OBBTree. The idea of using OBBs is not new

putation [29]. To detect a p enetration { as opp osed to

and many researchers have used them extensively to

knowing al l the closest features { it is unnecessary to

sp eed up ray tracing and interference detection compu-

construct the exact internal Voronoi regions.

tations [2]. In this pap er, we brie y describ e the algo-

Rather we use an approximation, lab eled as pseudo- rithms for computing tight- tting OBBs and checking

internal Voronoi region. It is calculated by rst com- them for overlap. More details are given in [18]. leftmark

V Inside External Cell

V

V Inside Internal Cell

V

Figure 2: Walk from external to internal Voronoi regions.

4.2.1 Building an OBBTree The eigenvectors of a symmetric matrix, suchasC,

are mutually orthogonal. After normalizing them, they

In this section we describ e algorithms for building an

are used as a basis. We nd the extremal vertices along

OBBTree. The tree construction has two comp onents:

each axis of this basis, and size the b ounding b ox, ori-

rst is the placement of a tight tting OBB around a

ented with the basis vectors, to b ound those extremal

collection of p olygons, and second is the grouping of

vertices. Two of the three eigenvectors of the covari-

nested OBB's into a tree hierarchy.

ance matrix are the axes of maximum and of minimum

Wewant to approximate the collection of p olygons variance, so they will tend to align the b ox with the

with an OBB of similar dimensions and orientation. geometry of a tub e or a at surface patch.

We triangulate all p olygons comp osed of more than

three edges. The OBB computation algorithm makes

use of rst and second order statistics summarizing the

vertex co ordinates. They are the mean, , and the

covariance matrix, C, resp ectively [14]. If the vertices

i i i

of the i'th triangle are the p oints p , q , and r , then

the mean and covariance matrix can b e expressed in

vector notation as:

n

X

1

i i i

 = p + q + r ;

3n

i=0

Figure 4: Building the OBBTree: recursively partition the

n

b ounded p olygons and b ound the resulting groups.

X

1

i i i i i i

p p + q q + r r  ; 1  j; k  3 C = 

jk

j k j k j k

3n

i=0

The basic failing of the ab ove approach is that ver-

i i

i

where n is the numb er of triangles, p = p , q = tices on the interior of the mo del, which ought not in-

i

i i

q , and uence the selection of a b ounding b ox placement, can r = r . Each of them is a 3  1vector,

i i i i

T

have an arbitrary impact on the eigenvectors. For ex- p =p ;p ;p  and C are the elements of the e.g.

jk

1 2 3

ample, a small but very dense planar patchofvertices 3by3 covariance matrix. Collision Detection: Algorithms & Applications

(a)

(b)

(c)

Figure 3: Feature classi cation based on the overlap b etween convex hulls

in the interior of the mo del can cause the b ounding b ox abox with a plane orthogonal to one of its axes, par-

to align with it. titioning the p olygons according to which side of the

plane their center p oint lies on a 2-D analog is shown

We improve the algorithm by using the convex hull

in Figure 4. The sub division co ordinate along that

of the vertices of the triangles. The convex hull is the

axis was chosen to b e that of the mean p oint, ; of

smallest convex set containing all the p oints and e-

the vertices. If the longest axis cannot not b e sub di-

cient algorithms of O n lg n complexity and their ro-

vided, the second longest axis is chosen. Otherwise, the

bust implementations are available as public domain

shortest one is used. If the group of p olygons cannot

packages [4]. This is an improvement, but still suf-

b e partitioned along any axis by this criterion, then the

fers from a similar sampling problem: a small but very

group is considered indivisible.

dense collection of nearly collinear vertices on the con-

vex hull can cause the b ounding b ox to align with that

4.2.2 Fast Overlap Test for OBBs

collection.

Given OBBTrees of two ob jects, the interference al-

Given an algorithm to compute tight- tting OBBs

gorithm typically sp ends most of its time testing pairs

around a group of p olygons, we need to represent

of OBBs for overlap. A simple algorithm for testing

them hierarchically. Most metho ds for building hierar-

the overlap status for two OBB's p erforms 144 edge-

chies fall into two categories: b ottom-up and top-down.

face tests. In practice, it is an exp ensive test. OBBs

Bottom-up metho ds b egin with a b ounding volume for

are convex p olytop es and therefore, algorithms based

each p olygon and merge volumes into larger volumes

on linear programming and closest features computa-

until the tree is complete. Top-down metho ds b egin

tion can b e applied to check for overlap. However, they

with a group of all p olygons, and recursively sub divide

are relatively exp ensive.

until all leaf no des are indivisible. In our current imple-

mentation, wehave used a simple top-down approach.

One trivial test for disjointness is to pro ject the

Our sub division rule is to split the longest axis of boxes onto some axis not necessarily a co ordinate axis

leftmark

in space. This is an `axial pro jection.' Under this pro- when the b oxes are not overlapping, the algorithm

jection, eachbox forms an interval on the axis. If the takes ab out half the op erations in practice. This algo-

intervals don't overlap, then the axis is called a `sep- rithm for overlap detection b etween OBBs is ab out one

arating axis' for the b oxes, and the b oxes must then order of magnitude faster than previous algorithms and

b e disjoint. If the intervals do overlap, then the b oxes implementations to check for overlap b etween OBBs.

mayormay not b e disjoint { further tests may b e re-

quired. We make use of the separating axis theorem

5 Implementation and Performance

presented in [18]tocheck for overlaps. According to

it, two convex p olytop es in 3-D are disjoint i there

All these algorithms have b een implemented and avail-

exists a separating axis orthogonal to a face of either

able as part of general purp ose public domain packages.

p olytop e or orthogonal to an edge from each p olytop e.

These are:

Eachbox has 3 unique face orientations, and 3 unique

I COLLIDE collision detection package available at

edge directions. This leads to 15 p otential separating

http://www.cs.unc.edu/~geom/I COLLIDE.html.

axes to test 3 faces from one b ox, 3 faces from the

It contains routines for the sweep and prune as well

other b ox, and 9 pairwise combinations of edges. If

as the closest distance pair algorithm for convex p oly-

the p olytop es are disjoint, then a separating axis ex-

top es. This package is applicable to environments,

ists, and one of the 15 axes mentioned ab ove will b e a

which can b e describ ed as union of convex p olytop es.

separating axis. If the p olytop es are overlapping, then

It has b een widely used for dynamic simulation, archi-

clearly no separating axis exists. So, testing the 15

tecture walkthrough and other applications.

given axes is a sucient test for determining overlap

status of two OBBs.

RAPID interference detection package available at

http://www.cs.unc.edu/~geom/OBB/OBBT.html.

It contains routines for building the OBBTree data

verlap tests b etween two OBB- A structure and fast o

b22B

Trees. It has b een used for virtual prototyping and ulation-based design applications. More details on

T b11B B sim

their p erformance and robustness issues are given in

a11A , 18].

a22A [12

In practice, the algorithms based on OBBs asymp-

totically p erform much b etter than hierarchies based

rA

on sphere trees or axis-aligned b ounding b oxes like Oc- COLLIDE routines are able to compute

rB trees. The I

all contacts b etween environments comp osed of hun-

vex p olytop es at interactive rates ab out

TL dred of con

=20 of a second. The OBBTree based interference

L 1

detection algorithm available as part of RAPID has

b een applied to two complex synthetic environments to

~

Figure 5: L is a separating axis for OBBs A and B b ecause

demonstrate its eciency as highlighted in Table 1.

~

A and B b ecome disjoint intervals under projection onto L.

These gures are for an SGI Reality Engine 90 MHz

R8000 CPU, 512 MB.

To p erform the test, our strategy is to pro ject the

A simple dynamics engine exercised the collision de-

centers of the b oxes onto the axis, and also to compute

tection system. At each time step, the contact p oly-

the radii of the intervals. If the distance b etween the

gons were found by the collision detection algorithm,

box centers as pro jected onto the axis is greater than

an impulse was applied to the ob ject at each contact

the sum of the radii, then the intervals and the b oxes

b efore advancing the clo ck.

as well are disjoint. This is shown in 2D in Fig. 5.

In the rst scenario, the pip es mo del was used as In practice, this corresp onds to at most 200 arithmetic

b oth the environment and the dynamic ob ject, as op erations in the worst case [18]. Due to early exit

Collision Detection: Algorithms & Applications

Wehave also applied the RAPID library to detect

Scenario Pip es Torus

collision b etween a moving torp edo on a pivot mo del

Environ Size 143690 pgns 98000 pgns

as shown in Fig. 6. These are parts of a torp edo stor-

Ob ject Size 143690 pgns 20000 pgns

age and handling ro om of a submarine. The torp edo

Num of Steps 4008 1298

mo del is 4780 triangles. The pivot structure has 44921

Num of Contacts 23905 2266

triangles. There are multiple contacts along the length

Num of Box-BoxTests 1704187 1055559

of the torp edo as it rests among the rollers. A typical

Num of Tri-Tri Tests 71589 7069

collision query time for the scenario shown in Fig. 6 is

Time 16.9 secs 8.9 secs

100 ms on a 200MHz R4400 CPU, 2GB SGI Reality

Ave. Int. Detec. Time 4.2 msecs 6.9 msecs

Engine.

Ave. Time p er BoxTest 7.9 usecs 7.3 usecs

Ave. Contacts p er Step 6.0 1.7

6 Acknowledgements

Table 1: Timings for simulations

Thanks to Greg Angelini, Jim Boudreaux, and Ken

Fast at Electric Boat for the mo del of torp edo stor-

age and handling ro om. Wewould like to thank

shown in Fig. 7. Both ob ject and environment con-

John Canny, Brian Mirtich and Krish Ponamgi for in-

tain 140,000 p olygons. The ob ject is 15 times smaller

teresting discussions. Brian Mirtich and Krish Pon-

in size than the environment. We simulated a grav-

COLLIDE amgi also help ed in the implementationofI

itational eld directed toward the center of the large

library. This research has b een supp orted in part

cub e of pip es, and p ermitted the smaller cub e to fall

by a Sloan foundation fellowship, ARO Contract

inward, tumbling and b ouncing. Its path contained

P-34982-MA, DARPA contract DABT63-93-C-0048,

4008 discrete p ositions, and required 16:9 seconds to

NSF grant CCR-9319957, NSF Grant CCR-9625217,

determine all 23905 contacts along the path. This is a

ONR contract N00014-94-1-0738, NSF/ARPA Science

challenging scenario b ecause the smaller ob ject is en-

and Technology Center for Computer Graphics &

tirely emb edded within the larger mo del. The mo d-

Scienti c Visualization and NSF Prime contract No.

els contain long thin triangles in the straight segments

8920219.

of the pip es, which cannot b e eciently approximated

by sphere trees, o ctrees, and trees comp osed of axis-

aligned b ounding b oxes , in general. It has no obvious

References

groups or clusters, which are typically used by spatial

partitioning algorithms like BSP's.

[1] A.Garica-Alonso, N.Serrano, and J.Flaquer. Solv-

ing the collision detection problem. IEEE Com-

The other scenario has a complex wrinkled torus en-

puter Graphics and Applications, 133:36{43,

circling a stalagmite in a dimpled, to othed landscap e.

1994.

Di erent steps from this simulation are shown in Fig.

[2] J. Arvo and D. Kirk. A survey of ray tracing ac-

8. The spikes in the landscap e prevent large b ounding

celeration techniques. In An Introduction to Ray

boxes from touching the o or of the landscap e, while

Tracing, pages 201{262, 1989.

the dimples provide numerous shallow concavities into

which an ob ject can enter. Likewise, the wrinkles and

[3] D. Bara . Dynamic simulation of non-penetrating

the twisting of the torus makes it impractical to de-

rigid body simulation. PhD thesis, Cornell Univer-

comp ose into convex p olytop es, and dicult to e-

sity, 1992.

ciently apply b ounding volumes. The wrinkled torus

[4] B. Barb er, D. Dobkin, and H. Huhdanpaa. The

and the environment are also smo oth enough to come

quickhull algorithm for convex hull. Technical Re-

into parallel close proximity, increasing the number of

p ort GCG53, The Geometry Center, MN, 1993.

b ounding volume overlap tests. Notice that the average

numberofbox tests p er step for the torus scenario is [5] N. Beckmann, H. Kriegel, R. Schneider, and

almost twice that of the pip es, even though the number B. Seeger. The r*-tree: An ecient and robust

of contacts is muchlower. access metho d for p oints and rectangles. Proc.

leftmark

Figure 6: Interactive Interference Detection foraTorp edo shown on the top on a Pivot Structure { Torp edo has 4780 triangles;

Pivot has 44921 triangles; Average time to p erform collision query: 100 msec on SGI Reality Engine with 200MHz R4400 CPU

SIGMOD Conf. on Management of Data, pages ternational ConferenceonRobotics and Automa-

322{331, 1990. tion, 1995.

[6] S. Cameron. Collision detection by four- [11] B. Chazelle and D. P. Dobkin. Intersection of con-

dimensional intersection testing. Proceedings of vex ob jects in two and three dimensions. J. ACM,

International ConferenceonRobotics and Au- 34:1{27, 1987.

tomation, pages 291{302, 1990.

[12] J. Cohen, M. Lin, D. Mano cha, and M. Ponamgi.

[7] S. Cameron. Approximation hierarchies and s- I-collide: An interactive and exact collision de-

b ounds. In Proceedings. Symposium on Solid Mod- tection system for large-scale environments. In

eling Foundations and CAD/CAM Applications, Proc. of ACM Interactive 3D Graphics Confer-

pages 129{137, Austin, TX, 1991. ence, pages 189{196, 1995.

[8] S. Cameron and R. K. Culley. Determining the [13] D. P. Dobkin and D. G. Kirkpatrick. A linear

minimum translational distance b etween two con- algorithm for determining the separation of convex

vex p olyhedra. Proceedings of International Con- p ol yhedra. J. Algorithms, 6:381{392, 1985.

ferenceonRobotics and Automation, pages 591{

[14] R.O. Duda and P.E. Hart. Pattern Classi cation

596, 1986.

and Scene Analysis. John Wiley and Sons, 1973.

[9] J. F. Canny. Collision detection for moving p oly-

[15] Tom Du . Interval arithmetic and recursive sub di-

hedra. IEEE Trans. PAMI, 8:200{209, 1986.

vision for implicit functions and constructive solid

[10] H. Chang and T. Li. Assembly maintainability geometry. ACM Computer Graphics, 262:131{

study with motion planning. In Proceedings of In- 139, 1992.

Collision Detection: Algorithms & Applications

Figure 7: Interactive Interference Detection on Complex Interweaving Pip eline : 140; 000 p olygons each; Average time to

p erform collision query: 4.2 msec on SGI Reality Engine with 90MHz R8000 CPU

[16] P.Dworkin and D. Zeltzer. A new mo del for [21] J.C. Latombe. Robot Motion Planning. Kluwer

ecient dynamics simulation. Proceedings Euro- Academic Publishers, 1991.

graphics workshop on animation and simulation,

[22] M.C. Lin. Ecient Col lision Detection for An-

pages 175{184, 1993.

imation and Robotics. PhD thesis, Department

[17] J. Snyder et. al. Interval metho ds for multi-p oint of Electrical Engineering and Computer Science,

collisions b etween time dep endent curved surfaces. University of California, Berkeley, Decemb er 1993.

In Proceedings of ACM Siggraph, pages 321{334,

[23] M.C. Lin and John F. Canny. Ecient algorithms

1993.

for incremental distance computation. In IEEE

[18] S. Gottschalk, M. Lin, and D. Mano cha. Obb-tree: ConferenceonRobotics and Automation, pages

A hierarchical structure for rapid interference de- 1008{1014, 1991.

tection. To App ear in Pro c. of ACM Siggraph'96,

[24] M.C. Lin and Dinesh Mano cha. Ecient contact

1996.

determination b etween geometric mo dels. Inter-

[19] J. K. Hahn. Realistic animation of rigid b o dies. national Journal of Computational Geometry and

Computer Graphics, 224:pp. 299{308, 1988. Applications, 1996. To app ear.

[20] P. M. Hubbard. Interactive collision detection. [25] M. Mo ore and J. Wilhelms. Collision detection

In Proceedings of IEEE Symposium on Research and resp onse for computer animation. Computer

Frontiers in Virtual Reality, Octob er 1993. Graphics, 224:289{298, 1988.

leftmark

[26] M.Shamos and D.Ho ey. Geometric intersection

problems. Proc. 17th An. IEEE Symp. Found. on

Comput. Science, pages 208{215, 1976.

[27] B. Naylor, J. Amanatides, and W. Thibault.

Merging bsp trees yield p olyhedral mo deling re-

sults. In Proc. of ACM Siggraph, pages 115{124,

1990.

[28] M. Ponamgi, D. Mano cha, and M. Lin. Incremen-

tal algorithms for collision detection b etween gen-

eral solid mo dels. In Proc. of ACM/Siggraph Sym-

posium on Solid Modeling, pages 293{304, 1995.

[29] F.P. Preparata and M. I. Shamos. Computational

Geometry. Springer-Verlag, New York, 1985.

[30] S. Quinlan. Ecient distance computation b e-

tween non-convex ob jects. In Proceedings of Inter-

national ConferenceonRobotics and Automation,

pages 3324{3329, 1994.

[31] H. Samet. Spatial Data Structures: Quadtree, Oc-

trees and Other Hierarchical Methods. Addison

Wesley, 1989.

[32] W.Bouma and G.Vanecek. Collision detection and

analysis in a physically based simulation. Pro-

ceedings Eurographics workshop on animation and

simulation, pages 191{203, 1991.

[33] W.Bouma and G.Vanecek. Mo deling contacts in

aphysically based simulation. Second Symposium

on Solid Modeling and Applications, pages 409{

419, 1993.

Figure 8: Interactive Interference Detection for a Complex

Torus { Torus has 20000 p olygons; Environment has 98000

p olygons; Average time to p erform collision detection: 6.9

msec on SGI Reality Engine