Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects...

9
Fast Penetration Depth Estimation for Elastic Bodies Using Deformed Distance Fields Susan Fisher Ming C. Lin Department of Computer Science University of North Carolina at Chapel Hill http://www.cs.unc.edu/ geom/DDF/ Abstract We present a fast penetration depth estimation algo- rithm between deformable polyhedral objects. We assume the continuum of non-rigid models are discretized using standard techniques, such as finite element or finite differ- ence methods. As the objects deform, the distance fields are deformed accordingly to estimate penetration depth, allowing enforcement of non-penetration constraints be- tween two colliding elastic bodies. This approach can au- tomatically handle self-penetration and inter-penetration in a uniform manner. We demonstrate its effectiveness on moderately complex simulation scenes. 1 Introduction Due to recent advancements in both hardware technol- ogy and modeling of the physical world, simulation tech- niques have been increasingly used to improve the effi- ciency and effectiveness of robotics in virtual prototyp- ing and design automation. These techniques produce mo- tion sequences directly from input objects (robots and ob- stacles), simulating their motion based on mathematical models that specify their physical behavior, their complex structures and the interaction among them. However, most of the existing robotic simulation tech- niques are restricted to rigid objects, due to the computa- tional challenges in modeling complex deformation among colliding bodies. But, many real-world objects are not rigid. Automatic, predictable and robust simulation of real- istic deformation is one of the many challenges for robotics and intelligent systems. Some examples include realistic motion generation of soft tissues and organs for surgical planning of tele-robots, interaction among non-rigid bod- ies, and the use of elastic tubes for the design of miniature medical robots. One of the most difficult issues in gen- erating realistic motion of non-rigid objects is to simulate contact between between them. When two flexible objects collide, they exert reaction forces on each other resulting in the deformation of both objects. Similarly when one flexible body self collides, multiple portions of the object may deform. The reaction force is called contact force, and where the two surfaces touch is often called the contact surface. Simulating such events is non-trivial. It is known as the contact problem in computational mechanics, and has been actively inves- tigated for decades [5]. The difficulty of this problem for modeling deformation of non-rigid bodies arises from un- clear boundary conditions; neither the contact force nor the position of the contact surface is known a priori. Ideally, no two objects should share the same space. This is the non-penetration constraint. The non- penetration constraint can be imposed using techniques such as constrained optimization techniques or penalty- based methods. Due to dual unknowns in the contact problem for deformable models mentioned above, penalty- based methods are often preferred. When using a penalty based method, we need to first define a penetration poten- tial energy that measures the amount of intersection be- tween two models, or the degree of self-intersection of a deformable body. One of the more accurate measurements of the amount of intersection is the penetration depth, com- monly defined as the minimum (translational) distance re- quired to separate two intersecting objects. No general and efficient algorithm for computing penetration depth be- tween two non-convex objects is known. In fact, an time bound can be obtained for computing the Minkowski sum of two rigid, non-convex polyhedra to find the min- imum penetration depth in 3D [7]. No complexity bound for this problem is yet established for deformable models. 1.1 Main Contribution We present an efficient approach for estimating the pen- etration depth between non-penetrating elastic bodies. The underlying geometric models are composed of polygonal meshes. Models consisting of implicit representations or parametric surfaces, such as NURBS, can be tessellated into polygonal meshes with bounded error.

Transcript of Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects...

Page 1: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

FastPenetration Depth Estimation for Elastic BodiesUsingDeformed DistanceFields

SusanFisher Ming C. Lin

Departmentof ComputerScienceUniversityof NorthCarolinaat ChapelHill

http://www.cs.unc.edu/� geom/DDF/

Abstract

We presenta fast penetration depth estimationalgo-rithm betweendeformablepolyhedral objects.We assumethe continuumof non-rigid modelsare discretizedusingstandard techniques,such asfinite elementor finite differ-encemethods.As the objectsdeform,the distancefieldsare deformedaccordingly to estimatepenetration depth,allowing enforcementof non-penetration constraints be-tweentwo colliding elasticbodies.Thisapproach canau-tomatically handleself-penetration and inter-penetrationin a uniform manner. We demonstrate its effectivenessonmoderatelycomplex simulationscenes.

1 Intr oduction

Dueto recentadvancementsin bothhardwaretechnol-ogy andmodelingof the physicalworld, simulationtech-niqueshave beenincreasinglyusedto improve the effi-ciency and effectivenessof robotics in virtual prototyp-ing anddesignautomation.Thesetechniquesproducemo-tion sequencesdirectly from input objects(robotsandob-stacles),simulating their motion basedon mathematicalmodelsthatspecifytheir physicalbehavior, their complexstructuresandtheinteractionamongthem.

However, mostof the existing roboticsimulationtech-niquesarerestrictedto rigid objects,dueto the computa-tionalchallengesin modelingcomplex deformationamongcolliding bodies. But, many real-world objectsare notrigid. Automatic,predictableandrobustsimulationof real-istic deformationis oneof themany challengesfor roboticsandintelligent systems.Someexamplesincluderealisticmotion generationof soft tissuesandorgansfor surgicalplanningof tele-robots,interactionamongnon-rigid bod-ies,andtheuseof elastictubesfor thedesignof miniaturemedicalrobots. One of the most difficult issuesin gen-eratingrealisticmotionof non-rigidobjectsis to simulatecontactbetweenbetweenthem.

When two flexible objectscollide, they exert reactionforceson eachother resultingin the deformationof both

objects. Similarly when one flexible body self collides,multiple portionsof the objectmay deform. The reactionforce is calledcontactforce, andwherethe two surfacestouchis oftencalledthecontactsurface. Simulatingsucheventsis non-trivial. It is known as the contactproblemin computationalmechanics,andhasbeenactively inves-tigatedfor decades[5]. Thedifficulty of this problemformodelingdeformationof non-rigidbodiesarisesfrom un-clearboundaryconditions;neitherthecontactforcenor thepositionof thecontactsurfaceis known a priori.

Ideally, no two objectsshouldsharethe samespace.This is the non-penetration constraint. The non-penetrationconstraintcan be imposedusing techniquessuch as constrainedoptimization techniquesor penalty-basedmethods. Due to dual unknowns in the contactproblemfor deformablemodelsmentionedabove,penalty-basedmethodsareoftenpreferred.Whenusinga penaltybasedmethod,we needto first definea penetrationpoten-tial energy that measuresthe amountof intersectionbe-tweentwo models,or the degreeof self-intersectionof adeformablebody. Oneof themoreaccuratemeasurementsof theamountof intersectionis thepenetrationdepth,com-monly definedastheminimum(translational)distancere-quired to separatetwo intersectingobjects. No generalandefficientalgorithmfor computingpenetrationdepthbe-tweentwo non-convex objectsis known. In fact,an

��������time boundcanbeobtainedfor computingtheMinkowskisumof two rigid, non-convex polyhedrato find the min-imum penetrationdepthin 3D [7]. No complexity boundfor this problemis yet establishedfor deformablemodels.

1.1 Main Contrib ution

Wepresentanefficientapproachfor estimatingthepen-etrationdepthbetweennon-penetratingelasticbodies.Theunderlyinggeometricmodelsarecomposedof polygonalmeshes.Modelsconsistingof implicit representationsorparametricsurfaces,suchas NURBS, can be tessellatedinto polygonalmesheswith boundederror.

Page 2: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

We assumethat eachnon-rigid body is modeledus-ing finite elementmethods(FEM) [19] in our currentim-plementation[10], but the algorithm itself is applicableto otherdiscretizationtechniquessuchasfinite differencemethodsor spring-masssystems. We employ the fastmarchinglevel-setmethod[17, 18] to precomputethe in-ternaldistancefield of eachundeformedmodel.Whentwoflexible bodiescomeinto contactanddeform,thedistancefieldsarelikewisedeformedto computetheestimatedpen-etrationdepthbetweentwo deformingobjects. This pen-etrationmeasurecanbe incorporatedinto a penalty-basedformulation to enforcethe non-penetrationconstraintbe-tweentwo elasticbodies. This enablesefficient compu-tation of the contactforce and helps to yield a versatileandrobustcontactresolutionalgorithm.We have success-fully integratedourpenetrationdepthestimationalgorithmto computecollision responseof two elasticbodieseffi-ciently. Specifically, our penetrationdepthestimational-gorithmhasthefollowing characteristics: Both self-collisionsand contacts betweensoft ob-

jectsarehandledin a uniformmanner. No prior assumptionor knowledgeaboutthe loca-tionsof contactsis required. The algorithmcan trade off accuracy for speedorstoragerequirementif desired.

1.2 Organization

Therestof thepaperis organizedin thefollowing man-ner. We briefly survey the stateof the art in section2. Insection3,wegiveanoverview of ouralgorithmandtheba-sicterminologiesusedin thispaper. Section4 describesthenumericalmethodusedto pre-computethe distancefieldand how it is updatedon the fly as the objectsdeform.Section5 presentsour new penetrationdepthestimationmethodfor deformableobjectsbasedon linear interpola-tion of precomputeddistancefieldsandtheresultingcolli-sionresponse.Section6 describesthesystemimplementa-tion anddemonstratestheeffectivenessof our algorithm.

2 RelatedWork

2.1 Penetration Depth Computation

The notion of penetrationdepthbetweenoverlappingobjects was introducedby Buckley and Leifer [2] andCameronand Culley [4]. Several algorithms[7, 8, 14]have beenproposedfor computinga measureof penetra-tion depthusingvariousdefinitions. The enhancedGJKalgorithm can also be modified to computepenetrationdepthbetweentwo convex polytopes[3]. Recently, Agar-wal, et al. proposeda randomizedalgorithm that com-putespenetrationdepthbetweentwo convex polyhedrain

������ ����� �� ������ ��� ����� ��� ��� � expectedtimefor any con-stant ����� [1]. However, all of themassumethatat leastoneof theinput modelsis aconvex polytope.

It is well known that if two polytopesintersect,thenthe differenceof their referencevectorslies in their con-volution or Minkowski sum [9]. The problemof pene-tration depthcomputationreducesto calculatingthe min-imum distancebetweenthe boundaryof Minkowski sumof two polyhedraanda point insideit. However, thecon-structionof theMinkowski sumcanbequiteexpensive. Inthree-dimensionalspace,the sizecanbe easilyquadraticevenfor two convex polyhedra.An

������� �time boundcan

beobtainedfor computingtheMinkowski sumof two non-convex polyhedrato find the minimum penetrationdepth[7]. Thereseemsto be little hopeto computethe pene-tration depthat interactive ratesbasedon someof thesewell-known theoreticalalgorithms.

Few methodshavebeenproposedto computethepene-trationdepthfor NURBSmodelsor othernon-rigidmodelrepresentations.As it standstoday, interactivecomputa-tion of penetrationdepthbetweentwo generalgeometricmodelsof highcomplexity remainsanopenresearchissue.

2.2 DistanceField

Computingtheminimumgeodesicdistancefrom apointto a surfaceis a well known complex problem[15]. OsherandSethian[17, 18], introduceda new perspective on thisproblemby usinga partial differentialmethodto performcurve evolution. Hoff, et al. introducedthe useof graph-icshardwareto computegeneralizedVoronoidiagramandits correspondingdiscretizeddistancefield [11]. Recently,thisapproachhasbeenappliedto performgeneralproxim-ity queriesin 2D [12].

3 Preliminaries

In this section,we definebasicnotationsandmethod-ologiesusedin thispaper, giveabrief overview of thesim-ulation framework usedto testour algorithm,andgive anoutline of our approachfor estimatingpenetrationdepthbetweendeformablemodels.

3.1 Discretization Methods

Deformationinducesmovementof everyparticlewithinan object. It can be modeledas a mappingof the posi-tions of all particlesin the original object to thosein thedeformedbody. Eachpoint ! is movedby thedeformationfunction " �$# � :

!&%'" ��(*) ! �

where! representstheoriginalposition,and " ��(*) ! � repre-sentsthepositionat time

(. We limit thediscussionto the

Page 3: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

staticanalysis,hence(

is omitted: !&%'" � ! � .Simulatingdeformationis in fact finding the " �+#,� that

satisfiesthe laws of physics. Sincethereare an infinitenumberof particles, " �$# � hasinfinite degreesof freedom.In order to model a material’s behavior using computersimulation, sometype of discretization methodmust beused. For simulation of deformablebodies,spring net-works, the finite differencemethod(FDM), the bound-aryelementmethod(BEM), andthefinite elementmethod(FEM) haveall beenusedfor discretization.

In ourprototypesimulator, we havechosenFEM asthediscretizationmethoddue to its generalityand diversity.The FEM usesa piecewise approximationof the defor-mation function " �+#,� . Each“piece” is calledan element,which is definedby several nodepoints. The elementsconstitutea mesh. Sincethe FEMs poserelatively smallrestrictionsonthemeshtopology, they aresuitablefor rep-resentinga varietyof shapesandtopology.

3.2 Tetrahedral Elements

Our algorithmusesa FEM with 4-nodetetrahedralel-ementsand linear shapefunctions. However, other non-linear shapefunctionscanbe usedaswell. But, this willaffect the updateof the distancefield computation,astheobjectsdeform(section5).

The deformationfunction " �+#,� mapsa point in a tetra-hedralelementat !.-0/ 1 )$23)547698 to a new position " � ! � .As shown in Fig. 1, by definition, " �$# � movesfour nodesof anelementfrom their originalpositions

:�; -./ ��<>=?)5��<A@�)5��<ABC6 8 )EDGFIHJF�KL)to thenew positions

M: ; -./�N� <>= ) N� <A@ ) N� <AB 6 8 )EDGFIHJF�KLOThedisplacementsof thefour nodesdueto deformationis

P ; - /,Q <>=?) Q <>@�) Q <>BE6 8- /�N��<A=SRT��<>=?) N��<A@URT��<>@V) N��<ABWRT��<>BX6 8 )EDYFIHJFIKZO

Clearly this deformationis anaffine transformationof theform: " � ! � -\[]! �_^where [ is a `baT` matrix and ^ is `ca D

columnvectorrepresentingtranslationaldisplacement.

M:d; and :d; satisfythelinearsystem:

M:fe -\[ :ge �h^M:di -\[ :fi �h^M:�j -\[ :dj �h^M:�k -\[ :�k �h^

n

n

U

U

nn

1

4

2

n

n

U 2

1

4

n1 2

3

4

U3n3

~

~

~~

Figure1: " �$# � mapsfour nodesof a tetrahedralelement,: e )EO>O>OA) :�k to their new positionatM: e )COAO>O>) M:�k .

P e )EO>OAO>) P karethecorrespondingdisplacementvectors.

Since , representingthetranslationalcomponents,hasnoeffect on the elasticenergy, it is omitted from the restofderivation.By solvingthelinearsystem,wehave

[l-nmporq � - � o �_s � o q � - s o q � �_twhereI is a `�au` identity matrixand

o - / :di R :ge ) : j R :fe ) : k R :ge 6m - / M:di R M:ge ) M: j R M:fe ) M: k R M:ge 6s - / P i R P e ) P j R P e ) P k R P e 6

with :d; R :Lv representingvectordifferences.[ is knownasthedeformationgradient[5]. Theright Cauchy-Greenten-sor, wx-.[zy{[ , is oftenusedto characterizedeformation,andis insensitive to rigid motions.

3.3 Simulation Framework

Giventhebasicsof FEM,wereformulatetheproblemofsimulatingdeformableobjectsasa constrainedminimiza-tion problemusingConstitutive Law [20]. Detailsof thesimulatoraregivenin [10]. Herewe givea brief overviewof the simulatorusedto testour algorithmfor computingestimatedpenetrationdepthbetweenflexible models:

1. Given the input models,constructa tetrahedralele-mentmeshfor eachobject.

2. Generatean internaldistancefield for eachinput ob-jectusingthefastmarchinglevel setmethod(sec.4).

3. Apply finite elementanalysis:

(a) Estimatethepenetrationdepthbasedon thede-formed distancefields (sec.5) for penetrationavoidance.

Page 4: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

(b) Minimize the total energy due to deformation,taking into accountall materialpropertiesandexternalforces,usingoursynthesizednumericalmethod[10].

4. Incrementallyupdateportionsof the distancefields,given the new positionsand orientationsof the de-formedbodies.

Figure2 shows theflow of oursystem.

Field Update

MeshGeneration

Distance FieldComputation

Finite Element Analysis

External Forces

AvoidancePenetrationEnergy

Minimization

PositionalConstraints

Input Modelsw/ Material Prop.

Partial Distance

Figure2: A systemoverview showing variouscomponentsof thesimulatorusedto testouralgorithm

3.4 Algorithm Overview

Given the finite elementmeshesof two flexible bod-ies,ouralgorithmprecomputeaninternaldistancefield foreachundeformedmodelusingthe fastmarchinglevel-setmethod(sec.4). As thetwo objectscomeinto contactanddeform,thealgorithmuse

1. A hierarchical sweep-and-prune[13] when theNURB representationsof themodelsaregiven;

2. A lazy evaluation of possible intersectionsusingboundingvolumehierarchiesof axis-alignedbound-ing boxes[21].

Thecollisiondetectionmoduleidentifiesthe“regionsofpotentialcontacts”,aswell asthe intersectingtetrahedralelements. The intersectingtetrahedralelementsare thenusedto computetheestimatedpenetrationdepthbasedonthe pre-assigneddistancevaluesat the nodesof eachel-ement(sec.5). This is a fast output-sensitive computa-tion requiring

���}|T�time,where

|is thenumberof pairs

of intersectingtetrahedralelements,andis normallysmallcomparedto thenumberof elementswithin eachmodel.

Sincethe pre-assigneddistancevaluesat eachnodeofthe tetrahedralelementsmay no longerbe valid after thedeformation,we needto either recomputeor adaptivelyupdatethesedistancevalues. Sincerecomputationof theentireinternaldistancefield for eachdeformedmodelcanberatherexpensive,weperformapartialrecomputationofdistancefield only atandneartheregionsof potentialcon-tactsindicatedby thecollision detectionmoduleandFEMsimulation.We alsoensurethecontinuityanddifferentia-bility of thedistancefield at theboundaryof theseregions.Thevaluesof updateddistancefieldsarethenusedfor thenext simulationstep.

This processcontinuesiteratively to estimatethepene-trationdepthbetweenelasticbodiesquickly andefficientlyduringthesimulation.

4 Inter nal DistanceFields

TheFastMarchingLevel SetMethodwasfirst designedto tracktheevolution of fronts througha 3D space.In ourapplication,thesurfaceof anarbitrary3D objectis treatedasa front. Thesurfaceis propagatedinwards, oppositeofthedirectionof thesurfacenormal.As thesurfaceevolveswith uniform speed,distancevaluesfrom the surfaceareassignedto pointson a discretizedgrid.

The Fast Marching Level Set Method input to the al-gorithm consistsof a polygonal mesh. Models consist-ing of implicit representationsor parametricsurfaces,suchasNURBS,canbetessellatedinto polygonalmesheswithboundederror. The usermay alsospecify the resolutionof the 3D grid, tradingaccuracy for speed.Theoutputofthe methodis a discretizeddistancefield for the volumeencompassedby the3D surface.In practice,interpolationmethodsareusedwhensamplingthedistancefield for pen-etrationdepthcomputations.

Severalkey termsareusedin thepresentationof thisal-gorithm. A gridp oint may be marked with oneof threelabels: ALIVE, NARROW BAND, or FAR AWAY. AnALIVE point representsagrid point whohasalreadybeenassigneda distancevalue.A NARROW BAND point rep-resentsa point on theevolving front. A FAR AWAY pointrepresentsa pointwithoutanassigneddistancevalue.

4.1 Initialization

To computedistancevaluesfor an arbitraryobject re-quiresinitializing the locationof the surfacewithin a 3Dgrid. For eachtriangle of the polygonalmesh,an axis-alignedboundingbox is created.Distancevaluesfor eachgrid point in theboundingbox arethendefined.Whentheinitialized value is greaterthanor equalto zero, the grid

Page 5: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

point lies outsideof the objector on the surface. Thesegrid pointsaremarked ALIVE. Whenthe distancevalueis negative, it lies inside the object,andthe grid point ismarkedNARROW BAND.

The set of NARROW BAND points representsthosewithin a neighborhoodof the zero level set. Restrictingwork to only thisneighborhoodof thezerolevel setyieldsaconsiderablereductionin computationalcost.Thismethodof computationis knownasthenarrowbandapproach, andis discussedin detail in [18].

4.2 Marching

Oncethesurfacehasbeeninitialized in the3D grid, themarchingphaseof thealgorithmmaycommence.At eachstep,thegrid pointwith theminimumdistancevalueis ex-tractedfrom thesetof NARROW BAND grid points.Thedatastructureunderlyingthisphaseof thealgorithmis dis-cussedin section4.3. Uponselectionof theminimumval-uedNARROW BAND grid point,it is markedALIVE, andany FAR AWAY neighborsaremovedto thesetof NAR-ROW BAND points. The distancevalue for eachneigh-boringNARROW BAND point is thenupdatedby solvingfor ~ in thefollowing equation,selectingthelargestpossi-blesolutionto thequadraticequation:D

� <,��� -�� � �_��� �where

�0���9�S�E�V���p��� �����U�� �p��� �V�C�{�$�S�?�C�����U�� �S�L�X�?�C�{�+������

wherethefinite differencesaregivenby� � = - ~ < � � R ~  1� q

=- ~ R ~ < q �  1� � = � = - ~ < ��¡ R£¢ ~ < � � � ~¢   1� q

=q=

- ~ R£¢ ~ < q � � ~ < q ¡¢   1Similarly,

¤.�l�9�S�X�?���p�V¥*���\�U¦� �p�V¥E�V¥*�J�$�S�?¥*���n�U¦� �S�L¥§�L¥§�{�$������¨ ���9�S�E�?���p��©*�u�\�«ª� �p�V©*�V©§�{�+�S�?©§���n�«ª� �S�?©��?©��{�$������

The term� <,���

representsthe speedof the propagatingfront. Becausewewishto find thedistancefrom eachpointto thesurface,thisvalueis uniform(constant)in ourappli-cation.

Theequationsuseasecondorderschemewheneverpos-sible to producehigheraccuracy. That is, both ~ < ��¡ and

~ < � � mustbeALIVE in orderto compute� � = � = ,

� � @ � @or

� � B � B , where ~ < ��¡ �¬~ < � � . The choiceof when tousethe secondorderschemesimply dependson whethertwo known (ALIVE), monotonicallyincreasingvaluesex-ist asneighborsof thetestpoint. If not, thenthefirst orderschemeis used.

Thisprocessof selectingaminimumNARROW BANDpoint, markingit ALIVE, andupdatingneighborscontin-uesuntil no NARROW BAND pointsremain. This algo-rithm to computeaninternaldistancefield for eachobjectcanbesummarizedasfollows.

GridPoint G;InitializeGrid();heap = BuildHeap(); //NARROW_BAND POINTSwhile (heap.isEmpty() != TRUE){

G = heap.extractMin();G.status = ALIVE;markNeighbors(G);updateNeighbors(G);

}

4.3 Data Structur es

With eachstepof the algorithm, the minimum valuedNARROW BAND grid point mustbeextracted.Theneedfor anefficient extractionoperation,aswell asanefficientinsertionoperationmakestheuseof aheapideal.However,once the minimum valuedgrid point NARROW BANDgrid point hasbeenidentified,the algorithmupdateseachneighboringpoint. Thus, in addition to the needfor anefficient sorteddatastructure,we mustalsoretainspatialinformation.

Our solution is simply to use both a minimum heapstructureanda3D array. Eachheapnodecontainsapointerto the3D arraygrid point thatit references.Similarly, eachNARROW BAND grid point in the 3D arraypoints to anodein the heap. ALIVE and FAR AWAY points haveNULL pointersas only NARROW BAND points are in-cludedin theheap.

4.4 Partial Updateof DistanceField

Whenanobjectdeforms,thesimulatoridentifiesthere-gionsof deformationusingthecollisiondetectionmodule.This informationis thenusedto quickly updateportionsoftheinternaldistancefield.

4.4.1 Collision DetectionFor collision detection,we usethehierarchical sweep-

and-prunedescribedin [13], when the original, corre-spondingNURB representationsof the modelsareavail-able.Eachsurfacepatchis subdividedinto smallerpatchesandrepresentedhierarchically. Eachleafnodecorresponds

Page 6: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

to a splinepatchwhosesurfaceareais lessthanan inputparameter

 usedin generatingthe polygonalmeshesof

thepatch.Theresultingtreehasa shallow depthandeachnodecanhave multiple children. An axis-alignedbound-ing box is computedfor thecontrolpolytopeof eachpatchanddynamicallyupdated.At eachlevel of hierarchy, thesweep-and-prune[6] is usedto checkfor overlap of theprojectionsof the boundingboxesonto 1 RG)$23RG)�4LR

axes.Only whentheboxesoverlapin all threedimensions,apo-tentialcontactis returned.Coherenceis exploited to keeptheruntimelinearto thenumberof boundingboxesateachlevel. The resultinghierarchicalsweep-and-prunecanbeefficiently employedto checkfor potentialoverlapsof thehierarchies.

If theNURB representationsof themodelsarenotavail-able,we lazily constructtheboundingvolumehierarchies(BVHs) basedon axis-alignedboundingboxes for eachmodelon thefly andcheckfor collision betweenthemus-ing thesebinaryBVHs. Formoredetails,werefertheread-ersto [21].

4.4.2 Lazy EvaluationGiventheregionsof potentialcontactsreturned(asone

or moreboundingboxes)by the collision detectionmod-ule,weperformpartialupdateof theinternaldistancefieldby only recomputingthedistancevaluesat eachgrid pointwithin theseregions. With suchmethodsasFEM andfi-nite differencemethods,this informationis easyto obtain.Thesemethodstreatobjectsvolumetrically, andthereforethey retaininformationon how far theeffectsof deforma-tion havepropagatedthroughouttheobject.

Given the boundingbox, a second3D grid is createdthatoverlaysthefirst. Thealgorithmto computethispartialgrid is the samealgorithmpreviously described;the sav-ings in computationtime comesfrom thereductionof thenumberof grid pointsbeingcomputed.Oncethemarchingcompletes,we have two datasetsthatneedto becombinedwhile preservingthecontinuityanddifferentiabilityof thesolutions.

In practice,theseseparatedatasetsarealmostalwayscontinuous.We verify continuityby examiningthegradi-ent acrossthe borderof the two sets. In rarecaseswherethedatasetsarediscontinuous,otheroptionsareavailable.

Oneoption is to linear interpolatethe two datasetstoobtain a continuoussolution. This option is only viablewhenthedegreeof discontinuityis low. In caseswheretheresultingdatasetis highly discontinuous,theentireobjectis recomputed.In our testapplications,thissituationneveroccurred.Thisis dueto theaccuracy of theboundingboxesfor partialupdategeneratedby our collision detectionandFEM algorithm.

Figure3: LEFT: The distancefield of a sphere.RIGHT:The distancefield of a deformedspherecomputedusinglinearinterpolationof theprecomputeddistancefield.

5 Penetration Depth Estimation

Whenusingthepenaltybasedmethod,we needto firstdefinea penetrationpotentialenergy ­u®C¯�°7¯�± �+#,� that mea-surestheamountof intersectionbetweentwo polyhedra,orthedegreeof self-intersectionof asinglepolyhedron.Thisdefinition requiresan efficient methodto computeit, andits first andsecondderivatives.

5.1 Defining the Extent of Intersection

Thereareseveralknown methodsto definetheextentofintersection.Thenode-to-nodemethodis thesimplestwayto compute­ ®C¯�°7¯²± �+#,� . This methodcomputes­ ®C¯�°7¯²± �+#,�asa function of the distancesbetweensampledpointsontheboundaryof eachobjects.Thedrawbackof thismethodis that oncea nodepenetratesboundarypolygons,the re-pulsive force flips its direction,andinducesfurther pene-tration.Suchpenetrationoftenoccursin intermediatestepsof theaggressivenumericalmethods.Furthermore,onceanodeis insidea tetrahedralelement,it is no longerclearwhichboundarypolygonthenodehasactuallypenetrated.

A moreaccurateapproachis to computethepenetrationdepth, commonly definedas the minimum translationaldistancerequiredto separatetwo intersectingobjects.

Themostcomplicatedyetaccuratemethodis to usetheintersectionvolume. Using this method, ­ ®C¯�°7¯�± �+#,� is de-finedbasedonthevolumeof intersectionbetweentwo pen-etratingpolyhedra.Sincepolyhedradeformassimulationstepsproceed,it is difficult to createand reusepreviousdatafrom the original model. Furthermore,it is suscepti-bleto accuracy problemsanddegeneratecontactconfigura-tions. So,efficient computationof theintersectionvolumeis ratherdifficult to achieve.

5.1.1 Estimating Penetration DepthWe have chosena methodthat providesa balancebe-

tween the two extremesby computing an approximatepenetrationdepthbetweendeformableobjects. With ourmethod, ­ ®C¯�°³¯²± �+#,� is definedas a function of distancesbetweenboundarynodesandboundarypolygonsthat the

Page 7: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

nodespenetrate.We define

­r®C¯�°7¯²± �+#,� -\´Gµ�¶ ¡ (1)

where¶ is theminimumdistancefrom aboundarynodetotheintrudedboundaryand ´ is a penaltyconstant.

Ouralgorithmestimatesthecomputationof thepenetra-tion depth ¶ by replacingit with the linear interpolation N¶of pre-assigneddistancevalues:

N¶�-�· � ¶ � � · ¡ ¶ ¡ � ·¹¸º¶³¸ � �$D]R · � R · ¡ R ·3¸ � ¶7» (2)

where ¶ � ) ¶ ¡ ) ¶�¸ and ¶³» are distancevaluesat the fournodesof eachtetrahedralelement. Thesedistanceval-uesaresampledfrom the distancefield generatedby thefastmarchinglevel setmethodasdescribedin section4.· � ) · ¡ and·3¸ aretheinterpolationparametersderivedfromthe shapefunctionsof the elements,and � F · <&F¼D

,DGFIHJF ` .Oncean accuratevalueof distanceis assignedto each

node,nomatterhow themeshis deformed,thevalueof N¶ isquickly computedat any point insidetheobject. Figure3shows an examplewherethe distancefield of a sphereisquickly re-computedasthespheredeforms.

Thisapproximateddistancefield sharesafew propertieswith theexactdistancefield. Someof thesepropertiesareessentialfor propercomputationof penaltyforcesandtheirderivatives:

1. It vanisheson theboundarypolygons.

2. It is twice differentiableinside the elementsand ½«¾continuouseverywhere.

n 2

n

n

n

4

3

1 m

Figure4: A nodem penetratesinto anothertetrahedralel-ement.Thedistancebetweenm andtheredtriangleis thepenetrationdepth.

A hierarchicalsweepandprunemethod[13] or a lazycollisionevaluationbasedonboundingvolumehierarchiesof axis-alignedboundingboxes[21] is usedto find eachin-stancewhereaboundarynodefrom oneelementpenetratesanotherelement.Supposea boundarynode¿ is within an

elementwith nodes: e ) : i ) :dj and :�k as shown in Fig-ure4. ¿ canbewritten in termsof linear interpolationof:ge )EOCOEOC) : k :

¿'-�· � :ge � · ¡ :fi � · ¸ : j � �+D�R · � R · ¡ R · ¸ � : k (3)

N¶ at ¿ is obtainedby solvingEqn.2 andEqn.3:

N¶p-À/ ¶ � R ¶³» ) ¶ ¡ R ¶³» ) ¶³¸ R ¶7» 6?Á q � / ¿ R :�k 6 � ¶³» (4)

where  -À/ : e R :�k ) : i R :�k ) :dj R :�k 6­r®E¯+°7¯²± �$# � is computedby using N¶ insteadof ¶ in Eqn.1.This algorithm is insensitive to which object (or con-

nectedmesh)the nodes ¿ and : belongto. Therefore,self-intersectionsandintersectionsbetweentwo objectsaretreatedin auniform manner. It is alsorobustenoughto re-cover from penetrationsof significantdepth.

6 SystemImplementation and Results

We have implementedthe algorithm describedin thispaperandhavesuccessfullyintegratedit into amoderatelycomplex simulationwith videoclips shown at our projectwebsite:

http://www.cs.unc.edu/Ã geom/DDF/

We usedMayadevelopedby Alias ÄWavefrontto gener-atethemodelsusedin oursimulationsequences.Weusedapublic domainmeshgenerationpackage,SolidMesh[16],to createtetrahedralelementsusedin ourFEM simulation.Renderingof the simulationresultswas displayedusingOpenGLon a300MHZ R12000SGI Infinite Reality.

6.1 SystemDemonstration

Figure5 showsa largedeformationsimulatedby oural-gorithm. Two setsof positionalconstraintswerespecifiedfor internalnodesin theheadpartandthetail part. Giventhe positionalconstraints,the headof snake is forced tomove toward its tail. The snake modelhasabout14,000elements.Our algorithmsenablesthe simulationto auto-maticallygeneratethenaturalcoiling deformation.It is notobviousfrom theimages,but many smallself-penetrationswereresolvedduringthedeformation.

Figure 6 are snapshotsfrom a simulation sequencewherea snake swallows a deformablered apple from abowl of fruit. The snake andthe applemodelshave a to-tal of 23,000elements.Eight major keyframeswereusedto set the positionalconstraints.The deformationof theappleandthesnake wascomputedby thesimulatorusingour algorithmto estimatepenetrationdepthsbetweende-formablebodies.

Page 8: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

Figure5: Large Deformation: A snake coiling up

Figure6: A snake swallowing an apple from a bowl of fruits

Resolution Ctr Value Dist. Field 1/8 D. Field

60x60x60 0.921986 57.4696 2.0246955x55x55 0.916389 28.9428 1.1631950x50x50 0.912209 17.4810 0.7154740x40x40 0.898008 3.81680 0.2956630x30x30 0.878681 0.52117 0.0865820x20x20 0.875549 0.10853 0.02734

Table1: Theeffectof grid resolutionson theaccuracy andperformance(in seconds)of distancefield & partialupdatecomputations

6.2 Choiceof Grid Resolution

Thechoiceof thegrid resolutionhasasignificanteffecttheruntimeperformanceandaccuracy of thedistancefieldcomputationusingfastmarchinglevel-setmethods.In fact,fastmarchinglevel-setmethodsrunsin

��� ´ � ¡ � worst-casetimeusingthe“narrow bandapproach”[18], giventhegridresolutionof

�x�

x�

and ´ is thenumberof cells in thenarrow band.Table1 givesanexampleof thecomputationresultsusingdifferentgrid resolutionson a sphereof

D �³�7�triangleswith thecorrectdistancevalueof 1.0at thecenterof thesphere.

Note that thecomputedvaluesfor the internaldistancefield aremuchmoreaccurateat the regionsnearthe sur-faceof the object. This is appropriatefor our applicationwherethepenetrationis normallynot deep.Thedeviationbetweenthe correctdistancevalueandthe computeddis-tancevalueat thecenterof thesphereindicatesthemaxi-mumerrorpossibledueto theaccumulationof numerical

inaccuracies,asthe level-setcomputationmarchingin to-wardthecenter.

6.3 Partial Updateof Inter nal DistanceFields

Table1 alsoillustratestheperformancegainin comput-ing partial updateof the distancefield over the recalcula-tion of the entiredistancefield. The last two columnsofTable 1 give the computationtime (in seconds)requiredfor computingthe entire distancefield of the spherevs.updatingonly

DÅÇÆof its distancefield. The speedup is

quitesubstantial,especiallyfor thosewith highergrid res-olutions.

Figure7: Partial distancefield updateof anapple(LEFT)andacrosssectionof apartialupdateto adeformedsphere(RIGHT)

Thetiming (in seconds)for partialupdatevs. completerecomputationof thedistancefieldsfor variousmodels,in-cluding a torus,an appleanda deformedsphere(Fig. 7),is given in Table2. Note that the torusmodelwith moretrianglesand the samegrid resolutiontakes lesstime tocomputethanasimplerapplemodewith far lesspolygons.

Page 9: Fast Penetration Depth Estimation for Elastic Bodies Using ...€¦ · Ideally, no two objects should share the same space. This is the non-penetration constraint. The non-penetration

This is due to the fact that the torusmodelactuallyonlyoccupiesa small portion of the grids allocated;while theappleoccupiesmajorityof thegrid spaceallocated.

Model Resolution Tri’s Dist. Field 1/8 D. Field

Torus 50x50x50 2048 1.04334 0.290281Apple 50x50x50 384 10.6384 0.958958Sphere 50x50x50 972 5.21021 0.516960

Table2: Timing (in seconds)on partialupdateof thedis-tancefield vs. therecomputationof theentiredistancefield

6.4 Discussion

Although our current implementationis basedon theuseof FEM simulator[10] shown in Fig. 2, our algorithmcan be appliedto simulationmethodsusing finite differ-encemethods(FDM) andwill requirelittle modification.Onecanreplacethe linear interpolationstepusingshapefunctionsof FEM (explainedin section5) with a linearin-terpolationsuitablefor FDM. For thespring-masssystems,eachmasscanbe consideredasa nodeof eachfinite ele-mentandthesameformulationwill apply.

Thereis somelimitation to our approach.Our methodcomputesthe internal distancefields within eachobject.Therefore,it is notbestsuitedfor handlingself-penetrationof very thin objects,suchascloth or hair, which areoftenencounteredin characteranimation.

7 Summary

As thefrontierof roboticsextendsbeyondits traditionaldomainsand into medicaland other more advancedap-plications,modelingdeformationbecomesa key compo-nent for robotic simulation. In this paper, we presentafastpenetrationdepthestimationalgorithmbetweenelas-tic bodiesfor simulatingcomplex deformationdueto non-penetrationconstraintsusingpenalty-basedmethods.And,we demonstrateits efficiency andeffectivenesson moder-atelycomplex simulationscenarios.

Acknowledgements

We wish to thankGentaroHirota for theuseof his sim-ulator, andhisassistancein testingouralgorithm.This im-plementationalsobenefitedfrom discussionswith DavidAdalsteinssonof the Departmentof Mathematicsat UNCChapelHill.

References

[1] P. Agarwal, L. J.Guibas,S.Har-Peled,A. Rabinovitch, andM. Sharir. Pene-trationdepthof two convex polytopesin 3d. Nordic J. Computing, 7:227–240,2000.

[2] R. A. BrooksandT. Lozano-Perez.A subdivision algorithmin configurationspacefor findpathwith rotation. IEEETrans.Syst, SMC-15:224–233,1985.

[3] S. Cameron. Enhancinggjk: Computingminimum and penetrationdis-tancebetweenconvex polyhedra. Proceedingsof International Conferenceon RoboticsandAutomation, pages3112–3117,1997.

[4] S.CameronandR.K. Culley. Determiningtheminimumtranslationaldistancebetweentwo convex polyhedra.Proceedingsof InternationalConferenceonRoboticsandAutomation, pages591–596,1986.

[5] P. G. CiarletandJ.L. Lions,editors.HANDBOOKOF NUMERICALANAL-YSIS, volumeI - VI. Elsevier ScienceB.V., 1994.

[6] J. Cohen,M. Lin, D. Manocha,andM. Ponamgi. I-collide: An interactiveandexactcollision detectionsystemfor large-scaleenvironments.In Proc.ofACM Interactive3D GraphicsConference, pages189–196,1995.

[7] D. Dobkin, J. Hershberger, D. Kirkpatrick, and S. Suri. Computing theintersection-depthof polyhedra.Algorithmica, 9:518–533,1993.

[8] E.G.Gilbert andC.J.Ong. New distancesfor theseparationandpenetrationof objects. In Proceedingsof InternationalConferenceon RoboticsandAu-tomation, pages579–586,1994.

[9] LeonidasJ.GuibasandJ.Stolfi. Ruler, compassandcomputer:thedesignandanalysisof geometricalgorithms.In R.A. Earnshaw, editor, TheoreticalFoun-dationsof ComputerGraphicsandCAD, volume40 of NATO ASI SeriesF,pages111–165.Springer-Verlag,1988.

[10] G. Hirota,S.Fisher, andM. C. Lin. Simulationof nonpenetratingelasticbod-iesusingdistancefield. Technicalreport,Departmentof ComputerScience,Universityof North Carolina,2000.

[11] K. Hoff, T. Culver, J.Keyser, M. Lin, andD. Manocha.Fastcomputationofgeneralizedvoronoidiagramsusinggraphicshardware. Proceedingsof ACMSIGGRAPH1999, pages277–286,1999.

[12] K. Hoff, A. Zaferakis,M. C. Lin, andD. Manocha.Fastandsimplegeomet-ric proximity queriesusinggraphicshardware. Proc.of ACM SymposiumonInteractive3D Graphics, 2001.

[13] M. Hughes,C. Dimattia, M. Lin, and D. Manocha. Efficient andaccurateinterferencedetectionfor polynomialdeformationandsoft objectanimation.In Proceedingsof ComputerAnimation, pages155–166,Geneva,Switzerland,1996.

[14] S. S. KeerthiandK. Sridharan.Efficient algorithmsfor computingtwo mea-suresof depthof collisionbetweenconvex polygons.TechnicalReport,1989.

[15] R. Kimmel, A. Amir, andA. M. Bruckstein. Finding shortestpathson sur-facesusing level setspropagation. IEEE Transactionson Pattern AnalysisandMachineIntelligence, 17(1),1995.

[16] D.L. MarcumandN.P. Weatherill.Unstructuredgrid generationusingiterativepoint insertionandlocal reconnection.AIAAJournal, 33(9),September1995.

[17] S. J. OsherandJ. A. SEthian. Frontspropagatingwith curvaturedependentspeed:Algorithmsbasedon hamilton-jacobiformulations.J. of Comp.Phys.,1988.

[18] J. A. Sethian.Level SetMethodsandFastMarching Methods:EvolvingIn-terfacesin ComputationalGeometry, Fluid Mechanics,ComputerVision,andMaterialsScience. CambridgeUniversityPress,1999.

[19] Patrick Le Tallec. Equilibrium problemswith frictionlesscontact. In P. G.Ciarlet andJ. L. Lions, editors,HANDBOOKOF NUMERICALANALYSIS,volume3, pages565–578.Elsevier ScienceB.V., 1994.

[20] PatrickLe Tallec.Numericalmethodsfor nonlinearthree-dimensionalelastic-ity. In P. G. CiarletandJ. L. Lions, editors,HANDBOOKOF NUMERICALANALYSIS, volume3, pages465–622.Elsevier ScienceB.V., 1994.

[21] A. Wilson,E. Larsen,D. Manocha,andM. C. Lin. Partitioningandhandlingmassivemodelsfor interactivecollisiondetection.ComputerGraphicsForum(Proc.of Eurographics), 18(3):319–329,1999.