Accurate and Fast Proximity Queries Between Polyhedra...

18
Accurate and Fast Proximity Queries Between Polyhedra Using Convex Surface Decomposition Stephen A. Ehmann Ming C. Lin Department of Computer Science University of North Carolina Chapel Hill, NC 27599-3175 {ehmann,lin}@cs.unc.edu http://www.cs.unc.edu/ geom/SWIFT++/ Abstract The need to perform fast and accurate proximity queries arises frequently in physically-based modeling, simulation, animation, real-time interaction within a virtual environment, and game dynamics. The set of proximity queries include intersection detection, tolerance verification, exact and approximate minimum distance computation, and (disjoint) contact determination. Specialized data structures and algorithms have often been designed to perform each type of query separately. We present a unified approach to perform any of these queries seamlessly for general, rigid polyhedral objects with boundary representations which are orientable 2-manifolds. The proposed method involves a hierarchical data structure built upon a surface decomposition of the models. Furthermore, the incremental query algorithm takes advantage of coherence between successive frames. It has been applied to complex benchmarks and compares very favorably with earlier algorithms and systems. 1 Introduction Proximity queries are fundamental in a wide range of domains such as simulated environments, virtual prototyping, and robotics. The set of applications include virtual environments, computer games, tolerance verification, simulation-based design, and motion planning. Proximity queries have been extensively studied, and several specialized algorithms have been proposed. These algorithms differ based on model representations, the type of queries, and the characteristics of the simulated environments [19]. Some of the commonly used algorithms are based on spatial data structures or bounding volume hierarchies. They cannot efficiently compute contact regions or perform disjoint contact determination, while our algorithm can. We present a novel approach that can handle multiple types of queries of varying difficulty for general polyhedral models. Our goal is to provide a unified algorithmic framework within which many types of queries can be answered without using specialized data structures and costly postprocessing, such as is the case with many earlier approaches. The types of queries we address, in order of increasing complexity, are: Intersection Detection: returns a boolean value indicating whether a pair of polyhedra is intersecting or not. Tolerance Verification: given a tolerance, returns a boolean value indicating whether the minimum distance between a pair of polyhedra is below the tolerance or not. This type of query is a generalization of intersection detection which has a tolerance of zero. Supported in part by ARO DAAG55-98-1-0322, NSF EIA-9806027, NSF DMI-9900157, NSF IIS-9821067 and Intel 1

Transcript of Accurate and Fast Proximity Queries Between Polyhedra...

Page 1: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

Accurate and FastProximity QueriesBetweenPolyhedraUsing ConvexSurfaceDecomposition

�StephenA. Ehmann Ming C. Lin

Departmentof ComputerScienceUniversityof NorthCarolinaChapelHill, NC 27599-3175{ehmann,lin}@cs.unc.edu

http://www.cs.unc.edu/� geom/SWIFT++/

Abstract

The needto perform fast and accurate proximity queriesarisesfrequentlyin physically-basedmodeling, simulation,animation,real-timeinteraction within a virtual environment,and gamedynamics. The setof proximity queriesincludeintersectiondetection,toleranceverification,exactandapproximateminimumdistancecomputation,and(disjoint) contactdetermination.Specializeddatastructuresandalgorithmshaveoftenbeendesignedto performeach typeof queryseparately.Wepresenta unifiedapproach to performanyof thesequeriesseamlesslyfor general, rigid polyhedral objectswith boundaryrepresentationswhich are orientable2-manifolds.Theproposedmethodinvolvesa hierarchical datastructure built uponasurfacedecompositionof themodels.Furthermore, theincrementalqueryalgorithmtakesadvantageof coherencebetweensuccessiveframes. It hasbeenappliedto complex benchmarksand comparesvery favorably with earlier algorithmsandsystems.

1 Intr oduction

Proximity queriesare fundamentalin a wide rangeof domainssuchassimulatedenvironments,virtual prototyping,androbotics. The set of applicationsinclude virtual environments,computergames,toleranceverification,simulation-baseddesign,andmotionplanning.

Proximityquerieshavebeenextensivelystudied,andseveralspecializedalgorithmshavebeenproposed.Thesealgorithmsdiffer basedon modelrepresentations,thetypeof queries,andthecharacteristicsof thesimulatedenvironments[19]. Someof thecommonlyusedalgorithmsarebasedonspatialdatastructuresor boundingvolumehierarchies.They cannotefficientlycomputecontactregionsor performdisjoint contactdetermination,while our algorithmcan.

Wepresentanovel approachthatcanhandlemultiple typesof queriesof varyingdifficulty for generalpolyhedralmodels.Our goal is to provide a unifiedalgorithmicframework within which many typesof queriescanbeansweredwithout usingspecializeddatastructuresandcostlypostprocessing,suchasis thecasewith many earlierapproaches.Thetypesof queriesweaddress,in orderof increasingcomplexity, are:� Intersection Detection: returnsa booleanvalueindicatingwhethera pair of polyhedrais intersectingor not.� ToleranceVerification: givena tolerance,returnsa booleanvalueindicatingwhethertheminimumdistancebetween

apair of polyhedrais below thetoleranceor not. This typeof queryis ageneralizationof intersectiondetectionwhichhasa toleranceof zero.�

Supportedin partby ARO DAAG55-98-1-0322,NSFEIA-9806027,NSFDMI-9900157,NSFIIS-9821067andIntel

1

Page 2: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

� Exact Minimum Distance: givena tolerance,returnstheminimumseparationdistancebetweenapairof polyhedraifthedistanceis lessthanthetolerance.� Approximate Minimum Distance: givenanabsoluteerror, a relative error, anda tolerance,returnsa distancevaluesuchthat theexactminimumdistancebetweena pair of polyhedrais within eitherof thegivenerrorboundsand thereturneddistancevalueis lessthanthetolerance.� Disjoint Contact Determination: givena tolerance,returnsa setof pairsof featuressuchthateachpair representsalocalminimumin thedistancefunctionbetweenapairof polyhedraandthedistanceat thelocalminimumis lessthanthetolerance.Fromthesepairsof features,distances,nearestpoints,andcontactnormalscanbecomputedyielding asimplegeometricdescriptionof acontactregion thatcanbeusedfor collision response[1, 4, 24].

Thesequeriescanbefurthergroupedinto threeclassesbaseduponthegeneralizationsgiven.Wewill call them:tolerance,distance,andcontactqueries.

1.1 Main Contributions

We presenta family of algorithmsfor efficient proximity queryof generalrigid polyhedra,basedon convex surfacedecom-position.Our approachproceedsin threephases.First, a convex surfacedecompositionof a givenpolyhedronis computed.A hierarchyis createdout of the resultingconvex patches.Eachnodeof the hierarchyis a convex hull which boundsitschildren. At the leavesaretheconvex hulls of theconvex patchesyieldedby thedecomposition.A pair of convex hulls istestedusingamodifiedLin-Canny closestfeaturealgorithm[21]. A pairof hierarchiescanbeefficiently queriedby recursivedescent.

Dueto tighterfitting boundingvolumes(i.e. convex hulls vs.othersimplestructureslike spheres)andfewerdecomposedconvex pieces,theproposedhierarchiescanprunequeriesmoreeffectively thanexisting algorithms.Sincetheatomicqueryfor thisnovel hierarchyis basedonapowerful andversatileminimumdistancecomputationalgorithmfor convex polyhedra,all typesof queriescanbeaddressedefficiently for solids,withoutany costlypostprocessingor otherauxiliarydatastructures.Thequeryperformanceof ouralgorithmcanbefurtherenhancedby severalaccelerationtechniques,whichareapplicabletoboundingvolumehierarchiesin general.Thus,ourkey contributionsare:� A unifiedframework for proximity queriesof varyinglevelsof generality.� An efficient disjoint contactdeterminationalgorithmfor computingpairsof nearestfeaturesandlocal minima in the

distancefunctionbetweenpolyhedra.Theseareusefulin dynamicsfor computingcollision responsesubjectto non-penetrationconstraints.� Theability to performproximity queriesfor solidsin additionto their boundarysurfaces.Our algorithmalsosupportssurfaceswith boundary.� An integratedgeneralizationof queryaccelerations.

Thealgorithmhasbeenimplementedandanalyzedusingvariousbenchmarks.Experimentswereperformedon differentshapesandcombinatorialcomplexity of objectsalongwith severalalgorithmicvariations.Weobserveexcellentperformancefor our algorithm,alongwith anindicationthatouraccelerationtechniquesoffer substantialimprovements.

The next sectionsurveys previouswork. Section3 givesan outlineof our algorithm. Convex surfacedecompositionisdescribedin section4. Hierarchyconstructionis discussedin section5. Sections6 and7 describein detail thequeriesandqueryaccelerationtechniques.Section8 showssomeof thestoragerequirementsandpreprocessingtimesandcomparestheperformanceof our prototypeimplementationagainstotherpublicly availablepackages.Finally, we concludewith futureresearchdirectionsin section9.

2 Previous Work

Proximity querieshave beenwidely studiedin many fields. Many algorithmshave beenproposedfor variousmodelrep-resentations.They areeitherapproximateor exact, andanswerdifferentsubsetsof proximity queries. Similarly, convexdecompositionandhierarchyconstructionhave alsobeeninvestigatedin computergraphics,computationalgeometry, andsolidmodeling.Next, weexamineearlierwork in theseareas.

2

Page 3: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

2.1 ConvexDecomposition

The problemof computingwhat we call a convex solid decompositionof a generalpolyhedronP, hasbeenextensivelyinvestigated[3, 6, 8, 27, 28] andis known to have outputof sizeO

�n2 � wheren is thenumberof boundaryelementsof P.

Thedefinitionof this decompositionis:P ���

i

Cii j : i �� j Ci � Cj �� (1)

wheretheCi aresolidconvex pieces.Anothertypeof decompositionis aconvex surfacedecomposition.Thishasbeenaddressedby [7, 9] andthedefinitionis:

boundary�P� � �

i

ci

i j : i �� j ci � c j ��

ci � boundary�Ci� (2)

wheretheci areconvex surfacepatchesthatlie entirelyon thesurface(boundary)of their convex hull Ci � CH�ci� which is

thecorrespondingconvex piece.This typeof decompositionis of complexity O�r � wherer is thenumberof reflex edgesin

thesurface(boundary)of P. This alsoworksfor surfaceswith boundary(non-solids)sinceno notionof insideor outsideisrequired.Theproblemof finding the minimumnumberof patchesis provento beNP-Completein [7], so they investigatevariousapproximationalgorithmsto find asmallnumberof patches.Someof ourdecompositionalgorithmsarederivedandextendedfrom theirs.

2.2 Hierar chy Construction

Boundingvolumehierarchies(BVHs) haveprovenefficient toolsin thecomputationof proximity information.Thepropertythat they satisfy is that eachnodeof the hierarchyboundsall the geometryin its child subtrees.Therearetwo main ap-proachesto build BVHs: top-down or bottom-up.Top-down constructioninvolvesrecursivesplitting andis fastandsimpleto implement[14, 20]. Bottom-up,ontheotherhand,involvesgroupingprimitiveshierarchicallyandis oftencomputationallymoreexpensive [2]. For themostpart,binary treesareconstructedalthoughtreesof higherdegreearepossible.Analyticalevidenceagainstusingdegreeshigherthantwo is presentedin [17].

2.3 Proximity Query

2.3.1 ConvexPolyhedra

Muchof theprior work onproximity querieshasfocusedon algorithmsfor solidconvex polyhedra.A numberof algorithmswith goodasymptoticperformancehave beenproposed,includinganO

�log2n� algorithmby [10]. This elegantapproachis

difficult to implementrobustly in 3D, however. Goodtheoreticalandpracticalapproachesbasedon the linear complexityof thelinearprogrammingproblemareknown [23, 29]. Minkowski differenceandconvex optimizationtechniquesareusedin [13] to computethe distancebetweenconvex polyhedraby finding the closestpoint betweenthe Minkowski polytopeand the origin. In applicationsinvolving rigid motion, geometriccoherencehasbeenexploited to designalgorithmsforconvex polyhedrabasedon eithertraversingfeaturesusinglocality or convex optimization[5, 21, 22, 25]. Thesealgorithmsexploit spatialandtemporalcoherencebetweensuccessivequeries,andwork well in practice.Multiresolutionrepresentationshave beenusedto furtherspeedup queriesbetweenconvex polytopes[11, 15]. For a morethoroughdiscussionof convexpolyhedralproximity query, see[12]. We useaminimumdistancecomputationalgorithmbasedon“Voronoimarching”asasubroutineto testtheproximity of a pair of convex polyhedra.It is powerful andgeneralin that it yieldsanswersto all fiveproximity querytypesfor convex polyhedra,with just onequery.

3

Page 4: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

2.3.2 GeneralPolygonal Models

Boundingvolumehierarchiesarepresentlyregardedasoneof the mostgeneralmethodsfor performingproximity queriesbetweengeneralpolyhedra.Specifically, spheretrees,AABB trees,OBB trees,andk-dopshavebeenusedfor fastintersectiondetectionqueries[2, 14, 16, 17, 26]. Sweptspherevolumes(SSVs)have beenusedfor intersectiondetection,toleranceverification,andexact andapproximateminimum distancequeries[20]. Thesealgorithmsdo not assumeconnectivity orconvexity of theinput, thustheir queriesarepurelybasedon boundaryrepresentationsandcannotdiscriminatebetweenthecaseof onesolid entirely within anotheranddisjoint solids. With the exceptionof [4], mostof themdo not performthecontactanalysisrequiredfor physically-basedsimulation.

3 Algorithm Overview

We assume,for simplicity, and without loss of generality, that a polyhedron’s boundaryis composedof triangles. Ouralgorithmconsistsof threemajorcomponents.Thefirst two arepreprocessingandthelastis thequery, happeningat runtime.Next, a brief overview of eachis given.

3.1 ConvexSurfaceDecomposition

Thefirst phaseis thedecompositionof ageneral(possiblynon-convex) polyhedron’ssurfaceinto asmallcollectionof convexpatches.We havedevelopedanapproachbasedon graphsearchingmethods[7]. A seedpoint is usedto starta graphsearchwhichincludesfacesinto thecurrentconvex patchif certaincriteriaaremet.Theresultingdecompositionis similar to Eqn.2.This is in contrastto aconvex soliddecomposition.A convex pieceis formedfrom aconvex patchby takingits convex hull.Moredetails,alongwith ourexperiences,aregivenin section4.

3.2 Hierar chy Construction

Basedon the decomposition,a BVH is built with the convex piecesasits leaves. We focuson the top-down constructionof binaryboundingvolumehierarchies.Therearevarioussplitting axesandrulesthatwe coulduse.Typically, BVHs haveprimitivesat theleavesthataretrianglesandinternalnodeswhicharecertainsimpleboundingvolumes.Sinceweuseconvexhull boundingvolumes,a convex polyhedronis the only type of geometrystoredin our BVH. BVHs constructedusingour algorithmhave substantiallyfewer levelsandaretighterfitting thanotherBVHs. Furthermore,we have a potentialforpruningrelationshipsbetweenany internalnodeandits leaves. More detailson the hierarchyconstructionin generalaregivenin section5.

3.3 Query

Without loss of generality, the proximity of two modelsis queried. Given that the geometryin the hierarchyis convex,geometriclocality is exploitedto speedup queriesin a unifiedmanner. A recursive traversalalgorithmthatyields thesameansweras if all pairs of primitiveswere tested,is usedto test a pair of hierarchies. Due to the structureof our BVHs,we only requirea test betweena pair of convex polyhedra. More detailson the query algorithm in general,along withpossibleaccelerationtechniques,aregivenin sections6 and7. In section8, we benchmarkvariousquerieswith andwithoutoptimizations.

4 Convex SurfaceDecomposition

We consideran orientablepolyhedralsurfaceS. If it is closed,then it is the surfaceof somepolyhedralsolid P: S �boundary

�P� . A constraintis addedto Eqn.2 to decomposea polyhedralsurfaceS:

S � Ci � ci (3)

Thatis, Scanonly meetthesurfaceof any convex piece(Ci) in exactly theconvex patch(ci) usedto createthepiece.If S isclosed,thepiecesarecontainedentirelywithin P but their uniondoesnot necessarilyequalP. Whetherit is closedor not,S

4

Page 5: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

S

convex edge

non-convex edge

seed face

excluded by criterion 1

excluded by criterion 2

AB S

AB

v

Figure 1. Creation of a convex patch

is asubsetof theunionof theboundariesof thepieces:S ��� i boundary�Ci� . This is importantin orderto ensurecorrectness

of thequery.Thereare two main typesof algorithmsthat canbe usedto createa decompositionlike this. The first is local and is

basedon exploring facerelationshipsasa patchis beingcreated. It usesa graphsearchandan incrementalconvex hullalgorithm.Theothersetof methodsis global in thatall pairwisefacerelationshipsareinitially explored,followedby facesbeinggroupedtogetherinto patchesthatagreewith therelationships.

We have noticedthat thereis a tradeoff betweenthe numberof piecescreatedand the numberof newly createdfaceswhena patchis convertedto a piece. Thegoal is not necessarilyto produceasfew patchesaspossible.It canbe the casethatverticesarehighly sharedbetweenpatches,increasingtheoverall facecountafter takingtheconvex hull of thepatchesto yield the pieces. The global methodstendto producefewer piecesbut more faces,whereasthe local methodstendtocreatemorepiecesbut fewer faces.Theinteractionbetweenadecompositionmethodandthequeryperformanceis complex,difficult to characterizein practice,andhighly dependenton theenvironmentsandcontactscenarios.Therefore,we takeasagooddecompositionfor now, onewhosecollectionof piecestakesup asmallamountof memory.

4.1 Local Searching Algorithms

We extendthe surfacedecompositionalgorithmsof [7] to handlethe additionalnon-intersectionconstraint(Eqn. 3), andproposea better“seeding”technique.

The graphof a polyhedralsurfaceis simply its edgesand vertices. The dual of this graphis a graphwith the sameedgesbut with the rolesof verticesandfacesreversed.A depth-firstsearch(DFS) or breadth-firstsearch(BFS) is usedtotraversethedualgraphof S, while aconvex hull C, is maintainedasfacesareaddedto thecurrentconvex patchc. Whenthesearchterminates,c is thecollectionof facesof S thatwereaddedduringthesearch.Theconvex hull C is theconvex piececorrespondingto c. In general,whenthe searchentersa candidateface f (which is triangular),thereis a vertex v, on theoppositesidefrom theedgee, of entry. Theadditionof v to C is identicalto theadditionof f to c. Not every facevisitedbythegraphsearchcanbeincludedhowever.

To meettherequiredconstraints,thecriteriaby which to addv to C to getC� are:

1. e is not a reflex edge

2. no facesfrom Sthatarein c arevisible from v

3. theadditionof v to C doesnot causeC� to intersectwith any partof Snot in c

which if satisfied,allow theadditionof v to C and f to c. Figure1 shows a searchthatstartsat a faceS andformsa patch.FaceA cannotbe includedbecausethe searchcrossesa reflex edgeto get to it (first criterion violated). FaceB cannotbeincludedbecauseS (alreadyin the patch)is visible to v (secondcriterion violated). The first two criteria canbe checkedbeforeconstructingthenew convex hull. Thenew convex hull C� is thenconstructedby addingv toC andtaggingfacesonSthatarecommonto thenew facesof C� . Thethird criterioncanthenbechecked.

We alsotried usingDFSandBFSwith “flood andretract”[7] in which facesareinitially allowedto belongto morethanonepatch. After the search,the patchesare“retracted”,or movedback,so that eachfacebelongsto exactly oneof them.Becausethis allows for disconnectedpatches,thetotal numberof patchesis reduced.However, we foundthat theflood andretractmethodsrequiremorestoragedueto a highernumberof newly createdfaceswhenconvertingpatchesto pieces.

Flood and retractdecompositionsproducefewer pieces,becausethe startingpoint of the searchdoesnot dictatethecoverage.With eitherBFSor DFSalone,thetraversalmaybeblockedby facesalreadyin otherpieces.Evenif a facemay

5

Page 6: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

bea goodstartingpoint,yieldinga largepatch,it mayendup belongingto a smallpatchdueto beingblockedby previouslycreatedpatches.

To achieveasmallnumberof pieceswithoutahighermemoryrequirement,weproposeanew methodof measuringgoodstartingfaces.We call a goodstartingfacea “crest” of a patch.For eachface,wefirst find thenumberof edgesor “hops” inthedualgraphto thenearestreflex edge.Thefacesareplacedin apriority queuewith thenumberof hopsusedasthepriority.Eachtime a patchis to be started,the highestpriority elementis removedfrom the queueandusedto start it. The searchmethodusedin conjunctionwith this initializationschemeis BFS.Thismethodyieldsasmallerdecomposition.Wethereforeuseit for all of theperformancecomparisons.An experimentalcomparisonof thedecompositionmethodspresentedhereisgivenin section8.1.

4.2 Global Pairwise Analysis

Theotherclassof decompositionalgorithmsis global. All pairsof facesareexaminedanda sparsematrix indicatingwhichpairs of facesare allowed in the samepatchis created. Using this matrix and a priority queue,facesare groupedintopatches(possiblydisconnected).Thesemethodsgeneratemorenewly createdfacesandrequiremorestorage,but producesubstantiallyfewerpiecesthanthesearchingalgorithms.Thus,they canbeusedasatheoreticaltool to analyzethecomplexityof anoptimalsurfacedecomposition(in termsof thenumberof pieces),boundingit bothaboveandbelow. Therunningtimeis O�n2 � .

Thefirst stepis to deriveall valid pairwisefacerelationships.A pair of facescancoexist in thesamepatchif bothof thefollowing conditionsaresatisfied:

1. all verticesof onefaceareinsideor on thesupportingplaneof theotherface

2. theconvex hull of thetwo facesdoesnot intersectSexceptat thefacesthemselves.

If apair of facesmeetsthesecriteria,it is insertedinto thesparsematrix representingrelationshipsbetweenpairsof faces.Thesecondphaseinvolvesorderingthefacesin apriority queuebasedon thenumberof otherfacesthey cancoexist with.

Whenstartingapatch,thehighestpriority face f (theonewith themostpairsof coexistingfaces),is removedfrom thequeueandprocessed.Let its setof coexisting facesbedenotedby Af . Eachfacein Af is comparedagainsttheotherfacesin Af

anda list of facesthat it cannotcoexist with is built. The requiredrelationshipsarelookedup in thematrix. All the facesof Af areplacedinto anotherpriority queuebasedon the numberof facesin Af that they cannotcoexist with. This queueis thenprocessedandfacesareremovedfrom Af until all of thefacesremainingin thesetcancoexist. During this process,bothpriority queuesaswell asthelistsmustbeupdatedto reflectthechangingfacerelationships.

The above algorithm,althoughexpensive, canyield somevaluableinsight into how well onecanhopeto do with anydecompositionalgorithmin practice.Theabove algorithmyieldsa substantiallytighterupperboundthanwe canget witha searchingalgorithm. Given the pair matrix computedby the first stepabove, a lower boundon the minimumnumberofpiecescanbecomputed.We have implementedtwo differentlowerboundcomputations:

1. any faceallowedin any patch

2. facesin a patchmustbeconnectedin thedualgraph.

Thesecondlower boundgivesa measureof how goodit is possibleto do if connectedpatchesaredesiredasa constraint,which is thecasefor someof thesearchingalgorithms.

5 Top-Down Hierar chy Construction

To createa binaryhierarchytop-down, a recursivesplitting of thelist of primitivesis done.Recallthattheprimitivesin thiscontext areconvex pieces.Algorithm 1 demonstratestheprocess.First, therecursiondescends,splitting asit goes.As therecursionunwinds,theboundingvolumesarecreatedandfacesharingandclassificationarecomputed.

5.1 Splitting

Thereare many ways to split a setof primitives into two groups. We assignasa representative point to eachprimitiveits centerof mass(COM). The covariancematrix of the convex hull of the COMs is computed.Using eigen-analysis,the

6

Page 7: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

Algorithm 1: Construct_Hierarchy(L )

Input: list L of primitives

1. if L is of length1 then2. returnNew_Leaf_Node(L )3. Split( L, L1, L2 )4. H1 = Construct_Hierarchy(L1 )5. H2 = Construct_Hierarchy(L2 )6. H = New_Internal_Node(H1, H2 )7. CH = Compute_Convex_Hull( H1, H2 )8. for all thefacesin CH do9. if thefaceis in H1 then10. storea pointerto theH1 facein H11. elseif thefaceis in H2 then12. storea pointerto theH2 facein H13. else14. createa copy of theCH facein H15. returnH

maximumspreaddirectionis foundandthis becomesthesplitting axis. EachCOM is projectedontothesplitting axis. TheprojectedCOMsarethensortedalongit. Theproblemhasnow beenreducedto a sortedlist of realvalues.Therearemanypossiblewaysto go aboutsplitting thevaluesinto two groups.We consideredthefollowing:� Median: split at themedianvalue.� Midpoint: split at themidpointof thefirst andlastvalue.� Mean: split at themeanof thevalues.� Gap: split ata “well-defined”gapin thevalues.

TheGaprule is subjectivein its meaning.For our implementation,awell-definedgapmeansthatit mustbewithin thecentral60%of thevalues,mustbe2 timesaslargeasthesecondlargestgap,andmustspanat least10%of theentirerangeof values.If suchagapcannotbefound,thenwe fall backon theMeanmethod.Of course,theparameterscouldbechosendifferently,but we areprimarily investigatingif usinga gapmethodhasany merit. Of coursetherearemany othermethodsthatcanbeused.An optimalsplittingstrategy for top-down constructionof BVHs remainsanopenresearchissue.

5.2 FaceSharing and Classification

In Algorithm 1, lines8-14computethefacesharingbetweenlevels. If a faceis sharedby morethanoneconvex polyhedron,only onecopy of it exists. This cutsdown thememoryrequirements.The faceadjacency informationmuststill becopiedsincetheface’sneighborscouldbedifferentfor eachconvex polyhedronit resideson.

Eachfaceis givenoneof threeclassifications.Theseclassificationsarethefacerelationshipsbetweenaboundingvolumeataninternalnodeandtheconvex piecesat its leaves.They areimportantfor makingthequeryefficient. Theclassificationslistedin orderof decreasingpruningpowerare:

1. ORIGIN AL: facesfrom theoriginal surface.

2. CONTAINED: facescreatedwhenconvertingpatchesto piecesby convex hull. Accordingto thedefinitionof convexsurfacedecompositionthatweuse,all thesefacesarecontainedin theoriginal solid if thesurfaceis closed.

3. FREE: facescreatedwhenconstructingthehierarchy. Thesearecreatedin line 14 of Algorithm 1. They arefree inthesensethatthey donot belongto any of theconvex pieces.

7

Page 8: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

��������

��������������������������������������������������������������������������������������������������������

���������������������������������������������� � � � � � � !�!�!!�!�! "�"�""�"�"#�##�#

$�$�$�$$�$�$�$$�$�$�$$�$�$�$$�$�$�$%�%�%%�%�%%�%�%%�%�%%�%�%&�&�&�&&�&�&�&&�&�&�&&�&�&�&'�'�''�'�''�'�''�'�'

(�((�()�))�)*�**�**�**�*+�++�++�++�+

,�,�,�,,�,�,�,,�,�,�,,�,�,�,-�-�--�-�--�-�--�-�-

.�.�..�.�..�.�./�/�//�/�//�/�/

0�00�00�00�01�11�11�11�12�2�2�22�2�2�23�3�33�3�3 4�44�45�55�5

6�678�88�88�88�89�99�99�99�9

FREE

CONTAINED

ORIGINAL

Figure 2. Hierarchy with face classifications

Theseclassificationsarepropagatedup thehierarchyasfar asthey cango dueto thefacesharing,which is desirable.Thus,every facein every convex polyhedronin thehierarchyhasoneof theclassifications.SeeFigures2, 9, and10. Eachlowerdimensionalfeature(vertex or edge)mustalsohaveaclassification.No verticeswerecreatedduringeitherthedecompositionor thehierarchyconstruction.Therefore,all verticesareimplicitly treatedasORIGIN AL . We consideranedgeto bea partof both facesit is adjacentto. Thus,we classifyanedgethesameasits neighboringfaceof highestpruningpower. Theseclassificationsareusedin thequery, which is describedin thenext section.

6 Hierar chical Query

In this section,the runtimequery algorithm is explainedin detail. First, the core routine that performsa proximity testbetweenapairof convex polyhedrais described.Then,wedescribeanalgorithmfor traversingapair of hierarchies.A basictraversalis outlined,followedby anelaborationfor eachtypeof query.

6.1 Atomic Query UsingVoronoi Mar ching

We usean iterative distanceminimizationalgorithmbasedon Voronoi marching(VM) [11] to performatomicqueriesbe-tweenpairsof convex polyhedra.VM is a techniquethatperformssurfacewalkingon apairof convex polyhedrausingtheirexternalVoronoi regionsto find thepair of nearestfeaturesbetweenthem.Fromthis pair, all theinformationthat is neededfor all typesof queries(tolerance,distance,andcontact)canbederived.If intersectionis detected,thedistanceis consideredto benegative. Thetestis doneon convex polyhedralsolids. Thus,evenif theboundaryof oneis containedentirelywithinthe other, intersectionis still detected.Oneissuerelating to this subroutineis its initialization. We proposea simpleyeteffective directionallookuptablescheme[12] for caseswithout high temporalcoherence.If temporalcoherenceis present,thepreviousclosestfeaturesfor a pair of convex polyhedraareusedto initialize wherepossible.

6.2 Hierar chical Traversal

Algorithm 2 is the generictraversalalgorithmusedto querya pair of polyhedraby usingtheir hierarchies.Here,we willonly focuson the threefundamentaltypesof queries:tolerance,distance,andcontact.The traversalhasdifferentpruningconditionsanddifferentconditionsunderwhich to find an answerfor the differenttypesof query. In general,not all thefeatureson theboundingvolumesat theinternalnodesareFREE. If bothof thenearestfeaturesarenon-FREE (conditionsat line 3 andline 7 arebothfalse),thentherecursionterminates,andananswercanbegivenfor thepair of sub-hierarchies.Eachquerytypeis examinednext.

6.2.1 ToleranceQuery

Tolerancequeriesinvolve returninga booleananswer, givena tolerance,indicatingwhethertwo polyhedrahave a minimumdistancelessthanthe tolerance.The tolerancemustbegreateror equalto zero. If it is zero,thenthequeryis the sameasintersectiondetection.Therecursionis prunedfor this typeof queryif thedistanceyieldedby theVM subroutineis greater

8

Page 9: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

Algorithm 2: Traverse_Hierarchies(H1, H2 )

Input: thehierarchies,H1 andH2, to traverse

1. PerformVM teston therootsof H1 andH2 to getnearestfeaturesf1 andf2

2. if not prunedthen3. if f1 is FREE then4. Traverse_Hierarchies(H1.left_child,H2 )5. if queryis resolvedthenreturnanswer6. Traverse_Hierarchies(H1.right_child,H2 )7. elseif f2 is FREE then8. Traverse_Hierarchies(H1, H2.left_child)9. if queryis resolvedthenreturnanswer10. Traverse_Hierarchies(H1, H2.right_child)11. returnanswer

thanthetolerance.If this is thecase,weknow thatnopairsin thesub-hierarchiescanpossiblybecloser. Theanswerreturnedwould be false. If theminimumdistanceis lessthanthetoleranceandbothof thenearestfeaturesarenon-FREE, thenthepolyhedrafailedthetolerance,andtrue is returned.Otherwise,recursionis performed.

6.2.2 DistanceQuery

Givenanabsoluteerrorεa, a relativeerrorεr , andatolerance,distancequeriesreturnadistancethatis lessthanthetoleranceandis within thegivenerrorof theexactminimumdistance.If theerroris zero,thenexactminimumdistanceis computed.If the toleranceis zero, thenthe queryis equivalentto intersectiondetection.Eachrecursive call receivesasa parametertheminimumdistance,Dmin, foundsofar. Therecursionis prunedfor this typeof queryif thedistanceyieldedby theVMsubroutine,d, is greaterthanthetoleranceor if no pairsin thesub-hierarchiescanaffect thedistance.If d : εa ; Dmin andd < � 1 : εr

� ; Dmin, thenthereis noneedto recur. Therecursionhasreachedthebasecaseif bothof thenearestfeaturesarenon-FREE. If this is thecaseandthenearestfeaturesareintersecting,thenanegativedistanceis returnedsincethepolyhedraareintersectingandthedistancecannotbefurtherminimized.Otherwise,d is comparedto Dmin. Thenew minimumdistanced is assignedto Dmin if d : εa = Dmin or d < � 1 : εr

� = Dmin. On the otherhand,if at leastoneof the nearestfeaturesisFREE, thenrecursionis performedandDmin is passedon.

6.2.3 Contact Query

Givena tolerance,contactqueriesrecordpairsof featuresat local minima in thedistancefunctionbetweentwo polyhedra.Thisis themostgeneraltypeof query. Its recursivestructureis identicalto thatof theexactminimumdistancequery. At eachrecursive invocation,theVM subroutineis performedandthenearestfeaturesanddistanceareevaluated.The recursionisprunedif thedistanceis greaterthanthetolerance.Therecursionhasreachedthebasecaseif bothof thenearestfeaturesarenon-FREE. If thisis thecaseandthenearestfeaturesareintersecting,thentheentirequeryterminatesandreportsintersectionsincecontactsareonly computedwhenthepolyhedraaredisjoint. Otherwise,thenearestfeaturepair is addedto thecontactlist. On theotherhand,if at leastoneof thenearestfeaturesis FREE, thenrecursionis performed.

7 Query Acceleration

In this section,we describethreetechniquesfor acceleratinghierarchicalqueries.We presentthemin orderof increasingsophistication.An evaluationof themis given in section8. They arederived from somerelatedwork but extendedandgeneralizedfor our framework. Eachexploits oneof two typesof coherence:spatialor temporal.Theformertypereferstothecoherencethatis inherentin thespatialstructureof asinglepolyhedron.Sinceit is rigid, this typeof coherenceexistsforany query. Thelatter typeis coherencefor a pair acrossqueries.In a sense,it refersto thechangesin relative positionsandorientationsof two polyhedra.

9

Page 10: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

7.1 PieceCaching

Piececachingis an ideasimilar to trianglecachingin [20] which exploits temporalcoherence.It canbeusedfor toleranceanddistancequeriessincethey only requirea singleanswer. The idea is to rememberthe pair of convex polyhedrathatansweredthe last query. If therewasnot muchrelative movementbetweenthe last queryandthe currentone,it is highlylikely thatthesamepair canyield somevaluableinformationthatcanspeedup thequery. Thepair of nearestfeaturesfoundin thepreviousquerycanbeusedto initialize theatomicqueryfor thecachedpair of convex pieces.

For tolerancequeries,thepair from thepreviousqueryis not storedif thepolyhedraaresufficiently distant. Otherwise,thepreviousqueryfailedandthepair wherefailurewasdetectedis testedbeforeany otherpair. If thecurrentqueryfails onit, we aredone.Otherwise,anordinaryqueryis performed.

For distancequeries,thepairthatyieldedtheminimumdistancefrom thepreviousqueryis testedfirst. If thepairof nearestfeaturesareboth non-FREE, thenthe minimum distanceis initialized to be the distancecomputedby the test. This doesnot entirelyanswerthequery, but providesfor increasedpruningdueto Dmin beingsmaller. Otherwise,Dmin is initialized toinfinity andtheordinaryqueryis performed.

7.2 Priority Dir ectedSearch

Thistypeof optimizationis derivedfrom [20] andtakesadvantageof spatialcoherencewithin thegeometryof asingleobjectandcanbeusedevenwhentemporalcoherenceis not present.It speedsup distancequeriesby honingin on theminimumdistancemorequickly. Theideais to alwaysprocessnext, thepair of sub-hierarchieswhoserootboundingvolumeshavethesmallestdistance.A priority queueof outstandingpairsof sub-hierarchiesis maintainedwith thehighestpriority going tothepair with theminimumdistancebetweenits roots’ boundingvolumes.

This accelerationtechniquecountson thefact that it is likely thata smalldistancecanbefoundbetweensub-hierarchieswhoserootshave a smalldistancebetweentheir boundingvolumes.Thus,thepriority directedsearchtendsto first exploretherecursionbranchesthataremostpromising,with thehopeof loweringDmin andpruningrecursionbranchesthatwouldotherwisehavebeentaken.

To illustratehow priority directedsearchworks,assumethatthepairat theheadof thequeueis to betested.It is removedfrom thequeueandthetwo root boundingvolumesaretestedusingthesubroutinefor convex polyhedra.If the testprunesawayany moretestsbetweenthetwo sub-hierarchies,or if bothof thenearestfeaturesarenon-FREE, wearedone(sincetherecursionbranchterminated).Otherwise,oneor bothof thenearestfeaturesis FREE. It is decidedwhich sub-hierarchytodescendon,andthetwo recursivepairsareinsertedinto thequeue.If thequeueis toofull to accommodatethesecondpair (itcanalwaysaccommodatethefirst dueto theremoval of thehead),thenthesecondpair is immediatelyresolvedrecursivelylikewould bedonewithoutpriority directedsearch.

7.3 GeneralizedFront Tracking

Our mostpowerful andsophisticatedmethodis calledgeneralizedfront tracking andis a queryaccelerationtechniquethatexploits temporalcoherence.It canbeappliedto all typesof queries.Front trackingis a termoriginally coinedby [18] forcachinga singleboundingvolumewith respectto onehierarchyduringa hierarchicaltraversal.Generalizedfront trackingextendsthis ideato cachingmultiplepairsof BVs.

Themainideais thatwhentwo objectsarein closeproximity, we would like to avoid having to traversetheupperlevelsof their BVHs eachtime. If therootsof sub-hierarchieswhereimportanteventshappenedin a querycouldberemembered,thenthesespotsin thetraversalcanbeusedasstartingpointsfor futuretraversals.In ourcase,pairsin therecursionfoundtointersectareimportant.

A front refersto the leavesof a specialrecursiontreethat is built andmodifiedasqueriesprogress.This treeis akin totheboundingvolumetesttree(BVTT) thatwasusedasananalysistool in [20]. TheBVTT representsthehierarchyof testsperformedduring a query. Eachnodein the BVTT correspondsto a singletestbetweena pair of BVs. Eachnodein theBVTT representsa pair of convex polyhedrafrom thehierarchieswhich eitherhasno children(it is a leaf), or exactly twochildren.If a pair existsin thetree,thenoneof thefollowing conditionsholdsfor it:� it wasintersectingthelasttime it wastested� its sibling wasintersectingthelasttimeandthispair existsto ensurethatits parenthastwo children

10

Page 11: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

Model DFS BFS BFS(CR) DFS(FR) BFS(FR)Tris Time Pieces Faces Time Pieces Faces Time Pieces Faces Time Pieces Faces Time Pieces Faces

WrinkledTorus 2000 1.22 414 2000 1.19 414 2000 1.25 412 2000 1.84 412 2004 2.05 412 2006BentTorus 2000 1.59 312 1860 1.52 306 1848 1.55 310 1804 8.36 289 2070 13.72 282 1982SpiralPeg 8040 6.12 1812 8040 6.12 1812 8040 6.47 1817 8040 9.26 1812 8040 15.70 1812 8040Cup 8452 5.93 2077 7786 5.83 2076 7772 6.33 2075 7714 25.05 2008 8628 51.52 1992 8670Head 21764 23.81 3336 14980 25.28 3327 14992 26.96 3339 14518 67.52 3249 16000 163.61 3197 16246LowerTeeth 40180 25.76 11422 34564 26.42 11356 34323 27.84 11403 33954 81.28 11354 36046 97.93 11004 36826UpperTeeth 47339 30.95 14358 40667 31.45 14292 40516 33.20 14347 40071 94.77 13176 42487 159.07 13787 43841

Table 1. Performance of Decomposition. Times are in seconds.

Model DFS BFS BFS(CR) DFS(FR) BFS(FR)Tris Time Size Time Size Time Size Time Size Time Size

WrinkledTorus 2000 1.58 1.80 1.60 1.80 1.59 1.79 1.55 1.80 1.54 1.80BentTorus 2000 1.78 1.72 1.74 1.64 1.70 1.64 1.67 1.71 1.57 1.62SpiralPeg 8040 8.16 2.07 8.07 2.07 8.15 2.08 8.10 2.05 8.12 2.05Cup 8452 8.77 1.91 8.76 1.91 8.78 1.92 9.05 2.01 8.99 2.01Head 21764 20.10 1.32 19.13 1.32 20.11 1.32 19.80 1.35 19.79 1.36LowerTeeth 40180 54.94 1.76 53.66 1.76 54.82 1.75 53.40 1.80 52.98 1.78UpperTeeth 47339 76.57 1.80 74.81 1.80 75.87 1.80 71.03 1.79 74.86 1.82

Table 2. Performance of Hierarchy Construction. Times are in seconds. Sizes are in kB per original model triangle.

� neitherit nor its sibling areintersecting.Sincethe front is only raisedonelevel at a time, the front hasnot yet beenraisedto its parent

Thefront is usedto initialize multiple recursionbranches,whoseoverall effect is identicalto startingat theroot of thetwohierarchies.Eachitem in thefront canalsopossiblystorea pair of featuresusedto initialize theatomicquerysubroutineforits pair of convex polyhedra.

Theissueof how to modify theBVTT is explainednext. As therecursiondeepens,thetreegrowsby thecreationof newchildren.This is termed“dropping” thefront andnormallyoccurswhenthepolyhedramoveclosertogether. Usually, whenthepolyhedramove apart,thefront mustbe“raised”. We only raiseit onelevel perquerysinceraisingit recursively incursthecostof additionalboundingvolumetests.

Generalizedfront tracking,aswe have presentedit here,works well acrossdifferenttypesof queries.As an example,if intersectionis queried,followedby contact,the front generatedby the intersectionqueryis a goodstartingpoint for thecontactquery.

8 Implementation and Experiments

WeimplementedouralgorithmsincludingthevariousaccelerationtechniquesusingC++. Thesourcecodeis availableto thepublicat ourprojectwebsite:

http://www.cs.unc.edu/> geom/SWIFT++/

We usedthepublicly availableQHULL packageto performconvex hull computations.We alsocreatedour own rigid bodydynamicssimulatorwhich wasusedto preparebenchmarksandverify the overall correctnessof the implementation.WeusedanOpenGLfront-endto visualizethevariousphasesof our algorithm.

8.1 PreprocessingResults

Table1 shows someof the resultsobtainedfrom our decompositionalgorithm. For variousmodelswe give their time andspacestatisticsfor differentsurfacedecompositions.For eachmethodwe give the time it took in seconds,the numberofconvex piecescreated,andthenumberof additionalfacesneededwhenconvertingpatchesto pieces.Themethodsthatareshown arebasedon whetherDFSor BFStraversalsof thedualgraphof thepolyhedronweredoneaswell aswhetherfloodandretract(FR) wasusedor not. The BFS methodthat takesadvantageof crests(CR) is alsoshown. The FR methodsproducethefewestpiecesbut themostadditionalfaces.TheBFS(CR)methoddoesthebestin termsof numberof additional

11

Page 12: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

Scenario OBB 18-dop 18-dop(FT) CH CH (FT)InterlockedTori 2.711 1.609 7.857 1.510 0.696CupandSpoon 0.8761 0.584 0.660 0.840 0.505SpiralPeg – LargeTori 0.276 N/A N/A 9.865 3.505SpiralPeg – SmallTori 0.459 N/A N/A 1.410 0.966TeethShifting 0.514 24.69 91.67 43.42 0.177TeethOpenandClose 0.841 17.79 20.65 14.32 4.190

Table 3. Performance of Various Algorithms on Intersection Detection.

Scenario SSV(TC) SSV(PD) CH CH (PC) CH (PD) CH (FT) CH (PC,PD) CH (PC,FT) CH (PD,FT) CH (PC,PD,FT)InterlockedTori 7.492 11.16 4.424 2.452 2.562 2.414 2.498 2.444 1.602 1.612CupandSpoon 3.931 3.814 1.728 1.234 1.284 1.058 1.266 1.070 0.923 0.919SpiralPeg – LargeTori 34.91 43.16 11.81 10.99 11.88 4.938 11.78 4.975 5.105 5.113SpiralPeg – SmallTori 36.61 47.67 2.720 1.910 2.009 1.572 1.969 1.599 1.513 1.526TeethShifting 0.604 1.780 54.73 11.53 7.152 0.184 1.466 0.114 5.529 5.653TeethOpenandClose 1.733 3.432 20.23 10.43 9.937 7.980 9.285 8.090 7.740 7.957

Table 4. Performance of Various Algorithms on Exact Distance Computation.

facesproducedandis roughly equivalentto the non-FRmethodsin termsof numberof pieces.No resultsareshown forglobalsurfacedecompositionsdueto thetimecostinvolved.

Someresultsfor thehierarchyconstructionphaseof our algorithmareshown in Table2. Resultsareshown only for theMidpoint splitting methodsincetheothersplitting methodsyield similar results.Thetime shown is thenumberof secondsto takeadecompositionandcreateaconvex hull boundingvolumehierarchyfrom it alongwith all theauxiliarydatarequiredfor efficient query. The sizeis the numberof kB per trianglein the original (non-decomposed)input model. For a givenmodel,thereis notmuchvariationin eitherthesizeor thetimeacrossthedifferentdecompositionmethods.

The numberof facescreatedis the dominatingfactor in the sizeof a decomposition.Thus,asmentionedearlier, theBFS(CR) methodyields thesmallestdecompositions.However, whenthepiecesaregroupedinto a hierarchy, thenumberof piecesmaymattermore(Table2), anda smallernumberof piecesmaycompensatefor moreadditionalfacesin overallhierarchysize. In general,we have not noticedthat thedifferencesin thepreprocessingmake a substantialdifferencein thequeryperformance.

8.2 Query Benchmark Design

For performancecomparison,wecreated6 scenarios(seeFigures3– 8):

1. a pair of interlockedtori, onebent,theotherwrinkled

2. a fixedcupandaspoonbeingdroppedinto thecup

3. a fixedspiralpeg andthreelargebenttori moving on it

4. a fixedspiralpeg andthreesmallbenttori moving on it

5. a fixedupperteethmodelanda lower teethmodelthatshiftslaterally

6. a fixedupperteethmodelanda lower teethmodelthatopensandcloses.

For the first four, we generatedsequencesof transformationsby runninga dynamicsimulationwith non-penetrationcon-straints.For thelasttwo, we generatedtransformationsprocedurally. Eachof thetori is composedof 2000triangles,andthespiralof 8000.Thecuphas8000trianglesandthespoonconsistsof 84. Theteetharescannedmodels,andhaveover40,000triangleseach.Pleasereferto theprojectwebsitefor videoclips of oursimulations.

Eachscenariowasrun andquerieswereperformedfor intersectiondetection,approximatedistancecomputation(10%relative error),andexactdistancecomputation,all usingour implementationof convex hull (CH) boundingvolumehierar-chies.For intersectiondetection,wealsotestedBVHs composedof OBBs[14] and18-dops[17]. For distancecomputation,wealsotestedSSVBVHs [20]. Implementationsof all threetypesof BVHs arepublicly availableasRAPID, QuickCD,andPQPrespectively.

12

Page 13: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

8.3 Query Resultsand Analysis

All timings wereperformedon a 450 MHz Intel PIII. Timings aregiven in millisecondsandcorrespondto averagequerytime. We only show timings for our algorithmwith the Midpoint splitting methodsinceall the splitting methodsyieldedsimilar results.

Intersectiondetectionresultsarereportedin Table3. Our implementation,usingCH BVHs, wasrun with all the com-binationsof piececaching(PC) andgeneralizedfront tracking(FT) optimizations. Sinceour benchmarksdo not includemuchintersection,thePCresultsdo not yield muchadditionalinsight, thereforewe do not show them. BVHs usingOBBsand18-dopsweretestedusingidenticalinput data.The18-dopBVHs weretestedwith andwithout thefront tracking(FT)optimizationavailablein QuickCD.SinceQuickCDis unableto handlesceneswith multiplemoving objects,thoseentriesinthetablearedenoted“N/A”.

The performanceof approximatedistance(10% relative error) andexact distancecomputationarevery similar, so wejust reporttheexactdistanceresultsin Table4. Our implementationwasrun with all combinationsof PC,FT, andprioritydirectedsearch(PD).SSVBVHs werealsotestedusingidenticalinput data,oncewith theoptimizationof trianglecaching(TC), andoncewith theoptimizationof priority directedsearch(PD),eachavailablein PQP.

OBB BVHs arewell-suitedto intersectiondetection.They performbetterthanoursonsomeof thebenchmarks.However,they arevery inefficientatdistancecomputation[20], andcannotbeusedto docontactdeterminationwithoutadditionalpost-processingwhich canbecostly. Eachof our boundingvolumetestsyieldsmuchmoreinformationthaneitherthe OBB orthe 18-dopoverlap test, allowing us to answerthe more complex querieswithout additionalcomputation. Furthermore,generalizedfront trackingworkswell in parallelcloseproximity situationsasdo OBBs,ascanbeseenin theshifting teethbenchmark.

Our algorithmoutperformsthe18-dopimplementationon every benchmark.The18-dopimplementationperformsbetterwithout FT. We conjecturethat this could be due to the fact that its front tracking techniquewas designedto handleacomplex staticscenewith asinglerelatively simplerdynamicobject.Ourgeneralizedfront tracking,ontheotherhand,givesaperformancegainon all of thebenchmarks,thusit is applicableto varioustypesof environments.

For exactdistancecomputation,SSVBVHs areoutperformedby ouralgorithmconsistentlyin four of thebenchmarks.Intheshifting teethbenchmark,generalizedfront trackingonceagaingivesa noticeablespeedupandis thebestoverall. Ourdistancecomputationin generalis very efficient, partly dueto the largeconvex groupingat the leavesof thehierarchy, andpartlydueto theVM subroutinewhich is quiteefficientatcomputingdistance.All of thequeryoptimizationsyield improve-mentsin all thebenchmarks.Generalizedfront trackingcombinedwith priority directedsearchis thebestcombinationin thefirst two benchmarkswhile front trackingaloneis thebestin theothers.

It is interestingto noticethatof thespiralbenchmarks,queriesareperformedfasterwith thesmallertori. This is duetoincreasedlocality onthespiral’shierarchy. Also of interest,is theconsistentspeeduponthepartof generalizedfront tracking,which doesa goodjob of keepingthemostrecentlyuseddatain a moreefficient level of thememoryhierarchy. Therefore,notonly doesit reducecomputation,it is alsocache-friendlyin thatit providesdatalocality.

9 Conclusion

Wehavepresentedanunifiedalgorithmicframework thatprovidesmultipletypesof proximity queriesbetweengeneralpoly-hedralsolids. Thethreephasesof thealgorithmwerediscussedandtheresultingperformanceevaluated.A new algorithmfor disjoint contactdeterminationwaspresented,aswell assomequeryaccelerationtechniques.

Thereis still openresearchin eachof theareas.For convex surfacedecomposition,otherheuristicsfor startingthesurfacesearchingmayyield performancegains.Optimalhierarchyconstructionremainsa hardproblemdueto the vastdifferenceamongmodels.A combinationof bottom-upandtop-down constructionmayyield betterhierarchiesthanapurelytop-downapproach,at a reasonablecost. To make the query run even faster, a hierarchicalboundingbox schememay be devisedsimilar to thepopularsweepandprunealgorithm. Finally, thememoryrequirementsof our algorithmarehigherthanmostcommonlyusedboundingvolumehierarchiesandit maybepossibleto performlazy evaluationwith almostno degradationin speed,ratherthanstoringtheentirehierarchiesin memoryduringprecomputation.

Perhapsamultiresolutionhierarchycanbebuilt directlyontopof theoriginalsurfacefor generalpolyhedra.Theextensionof thismethodto deformablemodelsis anexciting challengeaswell.

13

Page 14: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

References

[1] D. Baraff. DynamicSimulationof Non-PenetratingRigidBodySimulation. PhDthesis,CornellUniv., 1992.

[2] G. Barequet,B. Chazelle,L. Guibas,J. Mitchell, andA. Tal. BOXTREE: A hierarchicalrepresentationof surfacesin3D. Proc.Eurographics, 1996.

[3] C. Bajaj andT. K. Dey. Convex decompositionof polyhedraandrobustness.SIAMJ. Comp., 21:339–364,1992.

[4] W. BoumaandG. Vanecek,Modelingcontactsin a physicallybasedsimulation.Proc.SolidModeling, 409-419,1993.

[5] S. Cameron.EnhancingGJK: Computingminimumandpenetrationdistancebetweenconvex polyhedra.Proc. IEEEICRA, 3112–3117,1997.

[6] B. Chazelle.Convex partitionsof polyhedra:a lowerboundandworst-caseoptimalalgorithm.SIAMJ. Comp., 13:488–507,1984.

[7] B. Chazelle,D. Dobkin,N. Shouraboura,andA. Tal. Strategiesfor polyhedralsurfacedecomposition:An experimentalstudy. Comp.Geom.TheoryAppl., 7:327–342,1997.

[8] B. ChazelleandL. Palios. Triangulatinganon-convex polytope.DiscreteComp.Geom., 5:505–526,1990.

[9] B. ChazelleandL. Palios. Decomposingtheboundaryof a nonconvex polyhedron.Algorithmica, 17:245–265,1997.

[10] D. P. DobkinandD. G. Kirkpatrick. Determiningtheseparationof preprocessedpolyhedra– aunifiedapproach.Proc.17thIntl. Colloq.AutomataLang. Program., volume443of LectureNotesComp.Sci., 400–413.Springer-Verlag,1990.

[11] S. A. EhmannandM. C. Lin. Acceleratedproximity queriesbetweenconvex polyhedrausingmulti-level Voronoimarching.Proc. IEEEIROS, 2000.

[12] S. A. EhmannandM. C. Lin. Acceleratedproximity queriesbetweenconvex polyhedrausingmulti-level Voronoimarching.Tech.ReportTR00-026,Departmentof ComputerScience,Univ. of NorthCarolina,2000.

[13] E. G. Gilbert, D. W. Johnson,and S. S. Keerthi. A fast procedurefor computingthe distancebetweenobjectsinthree-dimensionalspace.IEEEJ. RoboticsandAutomation, 4:193–203,1988.

[14] S. Gottschalk,M. Lin, andD. Manocha. OBB-Tree: A hierarchicalstructurefor rapid interferencedetection. Proc.ACM SIGGRAPH, 171–180,1996.

[15] L. Guibas,D. Hsu,andL. Zhang. H-Walk: Hierarchicaldistancecomputationfor moving convex bodies.Proc. ACMComp.Geom., 1999.

[16] P. M. Hubbard.Interactivecollision detection.Proc.of IEEE SymposiumonResearch Frontiers in VR, 1993.

[17] J.Klosowski,M. Held,J.S.B. Mitchell, K. Zikan,andH. Sowizral. Efficientcollisiondetectionusingboundingvolumehierarchiesof k-DOPs.IEEE TVCG, 4(1):21–36,1998.

[18] J. Klosowski. EfficientCollision Detectionfor Interactive3D GraphicsandVirtual Environments. PhD thesis,StateUniv. of New York at Stony Brook,1998.

[19] M. Lin andS. Gottschalk,Collision detectionbetweengeometricmodels:a survey. Proc. IMA Conf. on Mathematicsof Surfaces, 37–56,1998.

[20] E. Larsen,S. Gottschalk,M. Lin, andD. Manocha.Fastproximity querieswith sweptspherevolumes.Tech.ReportTR99-018,Departmentof ComputerScience,Univ. of North Carolina,1999.

[21] M. C. Lin andJ.F. Canny. Efficientalgorithmsfor incrementaldistancecomputation.In IEEEConferenceonRoboticsandAutomation, pages1008–1014,1991.

[22] M. C. Lin. EfficientCollisionDetectionfor AnimationandRobotics. PhDthesis,Univ. California,Berkeley, 1993.

14

Page 15: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

[23] N. Megiddo. Linear-timealgorithmsfor linearprogrammingin R3 andrelatedproblems.SIAMJ. Computing, 12:759–776,1983.

[24] B. Mirtich andJ.Canny. Impulse-basedsimulationof rigid bodies.Proc.ACM I3D, 1995.

[25] B. Mirtich. V-Clip: Fastandrobustpolyhedralcollision detection.ACM ToG, 17(3):177–208,July1998.

[26] S.Quinlan.Efficientdistancecomputationbetweennon-convex objects.Proc. IEEEICRA, 3324–3329,1994.

[27] A. Rappoport.Theextendedconvex differencestree(ECDT) representationfor N-dimensionalpolyhedra.Int. Journ.on Comp.Geom.& Apps., 1(3):227–241,1991.

[28] J. RuppertandR. Seidel. On thedifficulty of triangulatingthree-dimensionalnon-convex polyhedra.DiscreteComp.Geom., 7:227–253,1992.

[29] R. Seidel.Linearprogrammingandconvex hullsmadeeasy. Proc.ACM Comp.Geom., 211–215,1990.

15

Page 16: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

Figure 3. Two interlocked tori

Figure 4. A cup and a spoon

Figure 5. Spiral peg and three large bent tori

16

Page 17: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

Figure 6. Spiral peg and three small bent tori

Figure 7. Scanned teeth model (over 40k polygons) shifting laterally

Figure 8. Scanned teeth model (over 40k polygons) opening and closing

17

Page 18: Accurate and Fast Proximity Queries Between Polyhedra ...gamma.cs.unc.edu/SWIFT++/EhmannLinTR01.pdfconvex polyhedra based on either traversing features using locality or convex optimization

Figure 9. The surface decomposition of a head composed of over 20k triangles. The different colors are randomlyassigned to the different patches. Regions of higher non-convexity result in more patches like in the ear and eye. Thetop of the head is fairly convex, yielding few patches.

Figure 10. A level of the hierarchy built for the head model. The convex hulls have been translated outwards for easiervisualization. Green denotes ORIGIN AL faces, yellow is for CONTAINED faces, and the red faces are FREE.

18