Upload
joel-park
View
221
Download
0
Tags:
Embed Size (px)
Citation preview
UMass Lowell Computer Science 91.504 Advanced Algorithms
Computational Geometry Prof. Karen Daniels
Spring, 2010
UMass Lowell Computer Science 91.504 Advanced Algorithms
Computational Geometry Prof. Karen Daniels
Spring, 2010
Shewchuck 2D Triangular MeshingShewchuck 2D Triangular Meshing
2D Mesh Generation2D Mesh Generation
Aspect Shewchuck
Title Triangle: Engineering a 2D
Quality Mesh Generator and Delaunay Triangulator
Source Conf : 1 st Workshop on Applied CG , 1996
Application Areas
geometric modeling; graphics
Input Objects
PSLG of object
Aspect Shewchuck
Dimensionality
2D
Problem/ Task
(constrained) Delaunay triangulation; robustness
Theory? Implementation?
implementation
ADTs & Data Structures
triangular mesh; (constrained) Delaunay triangulation; Voronoi diagram; convex hulls; Guibas/Stolfi quad-edge; triangular data structure; PSLG; splay tree; heap
Algorithmic Paradigms & Techniques
sweep-line; geometric divide-and-conquer; incremental insertion
Math Topics duality
Shewchuck 2D Triangular Meshing Shewchuck 2D Triangular Meshing
““Triangle: Engineering a 2D Quality Triangle: Engineering a 2D Quality Mesh Generator and Delaunay Mesh Generator and Delaunay
Triangulator”Triangulator”
Jonathan Richard ShewchuckJonathan Richard Shewchuck
http://www.cs.cmu.edu/~jrs/jrspapers.htmlhttp://www.cs.cmu.edu/~jrs/jrspapers.html
GoalsGoals
• Construct 2D mesh of triangles Construct 2D mesh of triangles for geometric modeling that:for geometric modeling that:• avoids small anglesavoids small angles
• constrained Delaunay triangulationconstrained Delaunay triangulation
• is efficient in time and spaceis efficient in time and space• careful choice of data structures & careful choice of data structures &
algorithmalgorithm
• is robustis robust• adaptive exact arithmeticadaptive exact arithmetic
C code at http://www.cs.cmu.edu/~quake/triangle.htmlC code at http://www.cs.cmu.edu/~quake/triangle.html
Approach: OverviewApproach: Overview
• Based on Ruppert’s Based on Ruppert’s Delaunay Refinement Delaunay Refinement AlgorithmAlgorithm
• InputInput: Planar Straight Line : Planar Straight Line Graph (PSLG)Graph (PSLG)• collection of vertices and collection of vertices and
line segmentsline segments
• Step 1Step 1: Construct Delaunay : Construct Delaunay triangulation of triangulation of point setpoint set
Approach: Overview (continued)Approach: Overview (continued)
• Step 2Step 2: : • Start with the Start with the
Delaunay Delaunay triangulation of the triangulation of the point setpoint set
• Add input segmentsAdd input segments• segments become segments become
constraintsconstraints• constrainedconstrained Delaunay Delaunay
triangulationtriangulation
some differencessome differences
Approach: Overview (continued)Approach: Overview (continued)
• Step 3Step 3: : (not in Ruppert’s algorithm)(not in Ruppert’s algorithm)
• Remove triangles from Remove triangles from concavitiesconcavities
• ““triangle-eating virus”triangle-eating virus”
• Step 4Step 4: : • Refine mesh to satisfy Refine mesh to satisfy
additional constraints additional constraints on triangle’s minimumon triangle’s minimum
• angle sizeangle size• areaarea
Step 1: Construct Delaunay Triangulation of Point SetStep 1: Construct Delaunay Triangulation of Point Set
• Delaunay Triangulation Algorithms:Delaunay Triangulation Algorithms:• O(nlogn) O(nlogn) expectedexpected time: time:
• Randomized incremental insertionRandomized incremental insertion• Edge flipping restores empty circle propertyEdge flipping restores empty circle property
• O(nlogn) worst-case time:O(nlogn) worst-case time:• Compute Voronoi diagram, then dualizeCompute Voronoi diagram, then dualize
• Fortune’s plane sweep (parabolic front)Fortune’s plane sweep (parabolic front)
• O(nlogn) worst-case time:O(nlogn) worst-case time:• Divide-and-ConquerDivide-and-Conquer
• alternating cuts alternating cuts
Shewchuck Shewchuck experimental experimental comparison comparison [speed, correctness][speed, correctness]
fastestfastest
slowestslowest[point location bottleneck][point location bottleneck]
deBerg handoutdeBerg handout
Experimental Delaunay Triangulation TimingsExperimental Delaunay Triangulation Timings
Note: Robust versions require more execution time.Note: Robust versions require more execution time.
Delaunay Triangulation Algorithms: Divide-and-ConquerDelaunay Triangulation Algorithms: Divide-and-Conquer
• O(nlogn) worst-case timeO(nlogn) worst-case time• Recursively halve input vertex setRecursively halve input vertex set• Stop when size = 2 or 3Stop when size = 2 or 3• Triangulate small setTriangulate small set
• forms edge(s) or triangleforms edge(s) or triangle
• Merge 2 triangulationsMerge 2 triangulations• Ghost triangles allow fast convex Ghost triangles allow fast convex
hull traversalhull traversal• Fit together like gear teethFit together like gear teeth
Step 2: Constrained Delaunay TriangulationStep 2: Constrained Delaunay Triangulation
• Force mesh to conform to input Force mesh to conform to input line segmentsline segments• User Chooses Approach:User Chooses Approach:
• Recursive segment subdivisionRecursive segment subdivision• Insert segment midpointInsert segment midpoint• Flip edges to restore Delaunay (empty circle) propertyFlip edges to restore Delaunay (empty circle) property
• Constrained Delaunay triangulation (Constrained Delaunay triangulation (defaultdefault))• Insert entire segmentInsert entire segment• Delete triangles it overlapsDelete triangles it overlaps• Retriangulate regions on each side of segmentRetriangulate regions on each side of segment• No new vertices are insertedNo new vertices are inserted
Step 4: Mesh Refinement Step 4: Mesh Refinement
• Refine mesh to satisfy additional constraints on Refine mesh to satisfy additional constraints on minimum triangleminimum triangle
• angle sizeangle size• areaarea
• Insert new verticesInsert new vertices• Flip edges to restore Delaunay (empty circle) Flip edges to restore Delaunay (empty circle)
propertyproperty• Halting Issue:Halting Issue:
• Halts for angle constraint <= 20.7Halts for angle constraint <= 20.7oo
• May not halt for angle constraint >= 33.9May not halt for angle constraint >= 33.9oo
Step 4: Mesh Refinement (continued)Step 4: Mesh Refinement (continued)
• Vertex Insertion Rules:Vertex Insertion Rules:• Segment’s Diametral Segment’s Diametral
CircleCircle• smallest circle containing smallest circle containing
segmentsegment• any point in the circle any point in the circle
encroachesencroaches on segment on segment• split split encroached segmentencroached segment
• insert vertex at midpointinsert vertex at midpoint• Triangle’s CircumcircleTriangle’s Circumcircle
• circle through all 3 verticescircle through all 3 vertices• bad trianglebad triangle::
• angle too smallangle too small• area too largearea too large
• split bad trianglesplit bad triangle• insert vertex at circumcenterinsert vertex at circumcenter
Encroached segments have Encroached segments have priority over bad triangles.priority over bad triangles.
Step 4: Mesh Refinement (continued)Step 4: Mesh Refinement (continued)
NoteNote: : Figures Figures are in left-are in left-to-right, to-right, top-to-top-to-bottom bottom orderorder
Implementation Issues: RepresentationImplementation Issues: Representation
• Ghost triangles:Ghost triangles:• connected in ring about a connected in ring about a
“vertex at infinity”“vertex at infinity”• facilitate convex hull traversalfacilitate convex hull traversal
+ Topologically richer + Topologically richer + Elegant+ Elegant- Slower- Slower- More memory - More memory
edge-basededge-based
representation tradeoffsrepresentation tradeoffs
triangle-basedtriangle-based
- Topologically less - Topologically less rich rich
- Longer code- Longer code+ Faster+ Faster+ Less memory+ Less memory
Shewchuck Shewchuck preferencepreference
Implementation Issues: RobustnessImplementation Issues: Robustness
• TestsTests • Can influence program flow of controlCan influence program flow of control• Can classify entities (e.g. sweep-line events)Can classify entities (e.g. sweep-line events)• Depend on correctness of Depend on correctness of geometric geometric
predicatespredicates• Orientation (left/right/on)Orientation (left/right/on)• In-Circle (in/out/on)In-Circle (in/out/on)• Each computes sign of a determinantEach computes sign of a determinant
• ConstructionsConstructions • Represent geometric objectsRepresent geometric objects
incorrectness can be seriousincorrectness can be serious
some incorrectness can sometimes be some incorrectness can sometimes be toleratedtolerated
Implementation Issues: Robustness (continued)
Implementation Issues: Robustness (continued)
• Ideal GoalIdeal Goal: : real arithmeticreal arithmetic for some operationsfor some operations
• ChallengeChallenge: : compounded compounded roundoff error in floating-point roundoff error in floating-point arithmetic calculations:arithmetic calculations:• Tests: can cause programTests: can cause program
• to hangto hang• to crashto crash• to produce incorrect outputto produce incorrect output
• wrong topologywrong topology• Constructions:Constructions:
• can cause approximate resultscan cause approximate results
What causes What causes incorrectness?incorrectness?
Implementation Issues: Robustness (continued)
Implementation Issues: Robustness (continued)
• Arithmetic Alternatives to Floating-Point:Arithmetic Alternatives to Floating-Point:• Integer or rational exact arithmeticInteger or rational exact arithmetic
• fixed precisionfixed precision• extended precisionextended precision
• Floating point + Floating point + • -testing-testing• robust topological decisionsrobust topological decisions• filter: filter:
• identify adequate precision for an operation (identify adequate precision for an operation (bit complexitybit complexity) ) • if expressible as multivariate polynomial, degree gives clueif expressible as multivariate polynomial, degree gives clue
• floating-point comparisons except when correctness is threatenedfloating-point comparisons except when correctness is threatened• Shewchuck adaptive precision (logical extreme of filter): Shewchuck adaptive precision (logical extreme of filter):
• compute quantity (e.g. sign of determinant) via successively more accurate compute quantity (e.g. sign of determinant) via successively more accurate approximationsapproximations
• stop when uncertainty in result is smallstop when uncertainty in result is small
No single solution fits all needs. Collection of techniques is needed.No single solution fits all needs. Collection of techniques is needed.
slow but sureslow but sure fast but loosefast but loose
exactexact floating-ptfloating-pthybridhybrid
time vs. error tradeofftime vs. error tradeoff
Implementation Issues: Robustness (continued)
Implementation Issues: Robustness (continued)
• Shewchuck uses:Shewchuck uses:• multi-stage adaptive precisionmulti-stage adaptive precision for geometric primitives for geometric primitives
• Orientation (left/right/on)Orientation (left/right/on)• In-Circle (in/out/on)In-Circle (in/out/on)• EachEach
• computes sign of a determinantcomputes sign of a determinant• takes floating-point inputstakes floating-point inputs• stops when uncertainty in result is smallstops when uncertainty in result is small• can reuse previous, less accurate approximationscan reuse previous, less accurate approximations
• fast arbitrary precision arithmeticfast arbitrary precision arithmetic• for small (yet extended) precision valuesfor small (yet extended) precision values
For general discussion of robustness issues and alternatives, see For general discussion of robustness issues and alternatives, see StrategicStrategic Directions in Computational Geometry Working Group ReportDirections in Computational Geometry Working Group Report
Also see research by Prof. Victor Milenkovic: http://www.cs.miami.edu/~vjm.Also see research by Prof. Victor Milenkovic: http://www.cs.miami.edu/~vjm.