This preview shows page 1. Sign up to view the full content.
Unformatted text preview: UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry
Prof. Karen Daniels
Spring, 2010 Spring O'Rourke Chapter 4: 3D Convex Hulls
Thursday, 2/18/10 Chapter 4 3D Convex Hulls
Polyhedra y Algorithms Implementation Polyhedral Boundary Representations Randomized Incremental Algorithm Higher Dimensions Polyhedra: What are they?
source: O'Rourke, Computational Geometry in C Polyhedron generalizes 2D polygon to 3D y g p yg Consists of flat polygonal faces Boundary/surface contains
0D vertices 1D edges 2D faces
polyhedra Components intersect "properly." Each face pair: p p p y p
disjoint or have vertex in common or have vertex/edge/vertex in common Local topology is "proper"
at every point neighborhood is homeomorphic to disk Global topology is "proper"
connected, closed connected closed, bounded may have holes (by default no holes in our work) (by work) not polyhedra!
for more examples, see http://www.ScienceU.com/geometry/facts/solids/handson.html Polyhedra: A Flawed Definition
source: O'Rourke, Computational Geometry in C Definition f Polyhedron D fi iti of P l h d 1
A polyhedron1 is a region of space bounded by a finite set of polygons such that:
every polygon shares at least one edge with some other polygon every edge is shared by exactly two polygons. d i h db l l polyhedra and polyhedra1?  What is wrong with this definition?  Find an example of an object that is a polyhedron1 but is not a polyhedron. not polyhedra and not polyhedra1? Polyhedra: Regular Polytopes
source: O'Rourke, Computational Geometry in C Convex polyhedra are polytopes Regular polyhedra are polytopes that have:
regular faces, = faces, = solid (dihedral) angles There are exactly 5 regular polytopes
p 3 4 3 5 3 v 3 3 4 3 5 (p2)(v2) 1 2 2 3 3 Name Tetrahedron Cube Octahedron O t h d Dodecahedron Icosahedron Description 3 triangles at each vertex 3 squares at each vertex 4 t i l at each vertex triangles t h t 3 pentagons at each vertex 5 triangles at each vertex dodecahedron icosahedron Excellent math references by H.S.M. Coxeter:  Introduction to Geometry (2nd edition), Wiley &Sons, 1969  Regular Polytopes, Dover Publications, 1973 Polytopes, Polyhedra: Euler's Formula
sources: O'Rourke, Computational Geometry in C & Figure from de Berg et al. Ch 11. for genus 0 (no holes) VE+F=2
Proof has 3 parts: 1) Convert polyhedron surface to planar graph C t l h d f t l h 2) Tree theorem 3) Proof by induction Polyhedra: Euler's Formula
sources: O'Rourke, Computational Geometry in C for genus 0 (no holes) VE+F=2 Euler's formula implies V, E, F are related. Relationship is LINEAR! If V = n, then E O(n) F O(n) Assume polytope is simplicial: all faces triangles Each face has 3 edges (E = 3F) Proof Sketch: But doublecounted shared edges, so E = 3F/2 implying F = 2E/3 doubleV 2 = E/3 implies E = 3V 6 < 3V = 3n in O(n) F = 2E/3 = 2V 4 < 2V = 2n in O(n) Substitute F = 2E/3 into Euler's formula Euler s Polyhedral Boundary Representations
v7 e1+ f0 e0v1 e v0 e1f1 e0+ v4 twin edge [DCEL: doubly connected edge list*] list*  represent edge as 2 halves
 lists: vertex, face, edge/twin  more storage space  facilitates face traversal  can represent holes with face inner/outer edge pointer v2 v3 v1 f0 e e4,0
e's twin f1 v5 e0,1 v0 v6 winged edge  focus is on edge
 edge orientation is arbitrary
source: O'Rourke, Computational Geometry in C * see also deBerg et al. for DCEL description Polyhedral Boundary Representations: Quad Edge QuadEdge
e7,1
v7 e6,1
v6 e2,0 v3 e3,0 v2 e1,0 v1 e7,1 e1,1 f1 v0 e
0,1 v7 e6,1 61 v6 e5,1 51
v2 e1,0 v1 f1 e2,0
v3 f0 e0,0 e1,1
v0 e5,1
v5 f0 e0,0 e4,0 e0,1
unbounded face v5 e3,0
v4 e4,0 v4 twin edge [DCEL: doubly connected edge list]  general: subdivision of oriented 2D
manifold  edge record is part of:  endpoint 1 list e dpo t st
 endpoint 2 list  face A list  face B list source: O'Rourke, Computational Geometry in C Algorithms: 2D Gift Wrapping
source: O'Rourke, Computational Geometry in C Use one extreme edge as an anchor for finding the next g Algorithm: Algorithm: GIFT WRAPPING index of the lowest point i0 i i0 repeat for each j = i Compute counterclockwise angle from previous hull edge k index of point with smallest Output (pi , pk) as a hull edge i k until i = i0 O(n2) Algorithms: 3D Gift Wrapping O(n2) time [output sensitive: O(nF) for F faces on hull]
CxHull Animations: http://www.cse.unsw.edu.au/~lambert/java/3d/hull.html Animations: source: O'Rourke, Computational Geometry in C Algorithms: 2D Divide and Conquer DivideandConquer
B DivideandDivideandConquer in a geometric q g setting O(n) merge step is the challenge
Find Fi d upper and l d lower tangents t t Lower tangent: find rightmost pt of A & leftmost pt of B; then "walk it downwards" A Idea i Id is extended to 3D in Chapter 4. t d dt i Ch t 4
Algorithm: Algorithm: 2D DIVIDEandCONQUER DIVIDEandSort points by x coordinate Divide points into 2 sets A and B: A contains left n/2 points B contains right n/2 points t i i ht /2 i t Compute ConvexHull(A) and ConvexHull(B) recursively Merge ConvexHull(A) and ConvexHull(B) O(nlgn) Algorithms: 3D Divide and Conquer O(n log n) time !
CxHull Animations: http://www.cse.unsw.edu.au/~lambert/java/3d/hull.html Animations: Algorithms: 3D Di id and C Divide d Conquer
Hard work is in MERGE of A with B: O(n) O(n (
Add single "band" of faces with topology of cylinder without caps Each face uses at least 1 edge from A or B  # faces <= # edges so O(n) faces O(n Each face added in O(1) amortized time: Lemma: When plane p is rotated about Lemma: line through ab, first point c to be hit is a ab, vertex adjacent to either a or b. Point c can be found in O(1) amortized time using aggregate analysis. Finding it might require examining (n) neighbors, but monotonicity of counterclockwise search helps. Each edge is "charged"/examined at charged /examined most twice (once from each endpoint). Discarding Hidden Faces: Wrapping discovers "shadow boundary" d but d 't il f i l edges, b t don't necessarily form simple cycle (see example on p. 113 Fig. 4.7). Hidden faces do form a connected cap: use e.g. DFS from shadow boundary. source: O'Rourke, Computational Geometry in C Algorithms: 2D QuickHull
source: O'Rourke, Computational Geometry in C Concentrate on points close to hull boundary Named f similarity to N d for i il it t Quicksort a b Algorithm: Algorithm: 2D QUICK HULL function QuickHull(a,b,S) if S = 0 return() else c index of point with max distance from ab A points strictly right of (a c) (a,c) B points strictly right of (c,b) return QuickHull(a,c,A) + (c) + QuickHull(c,b,B) O(n2) Algorithms: 3D QuickHull CxHull Animations: http://www.cse.unsw.edu.au/~lambert/java/3d/hull.html Animations: Algorithms: 2D Incremental
source: O'Rourke, Computational Geometry in C Add points, one at a time
update hull for each new point Key step becomes adding a single point to an existing hull. g p g Idea is extended to 3D in Chapter 4.
Algorithm: Algorithm: 2D INCREMENTAL ALGORITHM ConvexHull{p0 , p1 , p2 } {p Let H2 for k 3 to n  1 do ConvexHull{ Hk1 U pk } Hk O(n2)
can be improved to O(nlgn) Algorithms: 3D Incremental
source: O'Rourke, Computational Geometry in C Add points, one at a time
Update hull Q for each new point p
Case 1: p is in existing hull Q Must b on positive side of every plane determined by a face of Q. M t be iti id f l d t i db f f Q. LeftLeftof test uses volume of tetrahedron (board work) # faces in O(n) due to Euler, so test takes only O(n) time. Discard p if it is inside existing hull. Di d i i i id i i h ll Case 2: p is not in existing hull Q Compute cone tangent to Q whose apex is p. Cone consists of triangular tangent faces. Base of each is an edge of Q. p Construct new hull using cone Q Discard faces that are not visible. Algorithms: 3D Incremental
source: O'Rourke, Computational Geometry in C Algorithm: Algorithm: 3D INCREMENTAL ALGORITHM Let H3 ConvexHull{ p0 , p1 , p2, p3 } = tetrahedron for i 4 to n  1 do for each face f of Hi1 do compute signed volume of tetrahedron* determined by f and pi tetrahedron* mark f visible iff signed volume < 0 if no faces are visible then Discard pi (it i i id Hi1) th Di d is inside else for each border edge e of Hi1 do Construct cone face determined by e and pi for each visible face f do Delete f Update Hi
*Use determinant of a matrix. O(n2) Randomized incremental has expected O(nlgn) time. Algorithms: 3D Incremental
source: O'Rourke, Computational Geometry in C Calling Diagram for O'Rourke's C Implementation of 3D Incremental Algorithm Main ReadVertices DoubleTriangle ConstructHull AddOne VolumeSign MakeConeFace Cleanup Print MakeNullVertex Collinear MakeFace MakeCcw CleanEdges CleanFaces MakeNullEdge MakeNullFace CleanVertices Algorithms: 3D Incremental O(n2) time
CxHull Animations: http://www.cse.unsw.edu.au/~lambert/java/3d/hull.html Animations: Algorithms: 3D Randomized Incremental
source: O'Rourke, Computational Geometry in C Clarkson, Shor (1989) O(nlgn) O(nlgn) expected time Variant of 3D incremental algorithm Avoid bruteforce visible face test bruteMaintain CONFLICT GRAPH
Complementary sets of information: For each face of Hi1record which notyetadded points can see it notyetFor each notyetadded point, record which faces it can see (those it is "in notyetconflict" with) Key observation allowing fast adding of face = CH(e,pi), where e is a polytope CH(e,p edge on border between faces visible and invisible from pi:
If point sees a face, it must have been able to see one or both faces adjacent to e on Hi1 Algorithms: 3D Randomized Incremental
More detail is found in de Berg et al. o e deta s ou d e g al. Ch 11: Section 11.211.3 11.2Bipartite conflict graph
When point and face cannot coexist in the convex h ll hull.
Once point p in Pconflict( f ) is added to convex hull, facet f must be removed; they conflict. conflict.
points not yet inserted facets of current hull Initialize in linear time for convex hull of first tetrahedron tetrahedron. Conflict list of a new facet f: test points in conflict lists of two facets f1 and f2 incident to "horizon" ("shadow") edge e in prepreexisting convex hull. hull
Need to bound cardinality of conflict lists to analyze this...see subtle analysis of Section 11.3, which uses elegant notion of configuration space* framework for a space* generic randomized incremental algorithm from Section 9.5.
*Not the same as motion planning configuration space! Conflict graph G Algorithms: 3D Randomized Incremental
Pseudocode from de Berg et al. Ch 11: al. Conflict graph G Combinatorial Size of Convex Hull
Convex Hull boundary is intersection of hyperplanes, hyperplanes so worstworstcase combinatorial size
(number of features)
(not necessarily running time) complexity is in: ( n d / 2 ) 2d 8 Qhull: http://www.qhull.org 3D Visibility
source: O'Rourke, Computational Geometry in C To b ild T build our 3D visibility intuition (homework): i ibilit i t iti homework):
T = planar triangle in 3D C = closed region bounded by a 3D cube l d i b d db b C T P = T C
frequent problem in graphics What is the largest number of vertices P can have for any triangle? ...
View
Full
Document
This note was uploaded on 02/13/2012 for the course CS 91.504 taught by Professor Daniels during the Spring '10 term at UMass Lowell.
 Spring '10
 DANIELS
 Algorithms

Click to edit the document details