UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010 - PowerPoint PPT Presentation

Loading...

PPT – UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010 PowerPoint presentation | free to download - id: 45f841-ZTA2Y



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010

Description:

UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010 O Rourke Chapter 4: 3D Convex Hulls – PowerPoint PPT presentation

Number of Views:108
Avg rating:3.0/5.0
Slides: 27
Provided by: MurrayD2
Learn more at: http://www.cs.uml.edu
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010


1
UMass Lowell Computer Science 91.504 Advanced
Algorithms Computational Geometry Prof. Karen
Daniels Spring, 2010
  • ORourke Chapter 4
  • 3D Convex Hulls
  • Thursday, 2/18/10

2
Chapter 4 3D Convex Hulls
  • Polyhedra
  • Algorithms
  • Implementation
  • Polyhedral Boundary Representations
  • Randomized Incremental Algorithm
  • Higher Dimensions

3
Polyhedra What are they?
source ORourke, Computational Geometry in C
  • Polyhedron generalizes 2D polygon to 3D
  • Consists of flat polygonal faces
  • Boundary/surface contains
  • 0D vertices 1D edges 2D faces
  • Components intersect properly. Each face pair
  • 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, bounded
  • may have holes (by default no holes in our work)

polyhedra
not polyhedra!
for more examples, see http//www.ScienceU.com/geo
metry/facts/solids/handson.html
4
Polyhedra A Flawed Definition
source ORourke, Computational Geometry in C
  • Definition of Polyhedron1
  • 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.

polyhedra and polyhedra1?
not polyhedra and not polyhedra1?
- What is wrong with this definition? - Find an
example of an object that is a polyhedron1 but
is not a polyhedron.
5
Polyhedra Regular Polytopes
source ORourke, 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

dodecahedron
icosahedron
Excellent math references by H.S.M. Coxeter -
Introduction to Geometry (2nd edition), Wiley
Sons, 1969 - Regular Polytopes, Dover
Publications, 1973
6
Polyhedra Eulers Formula
sources ORourke, Computational Geometry in C
Figure from de Berg et al. Ch 11.
for genus 0 (no holes)
V - E F 2
  • Proof has 3 parts
  • 1) Convert polyhedron surface to planar graph
  • 2) Tree theorem
  • 3) Proof by induction

7
Polyhedra Eulers Formula
sources ORourke, Computational Geometry in C
for genus 0 (no holes)
V - E F 2
  • Eulers formula implies V, E, F are related.
  • Relationship is LINEAR!
  • If V n, then
  • Proof Sketch
  • Assume polytope is simplicial all faces
    triangles
  • Each face has 3 edges (E 3F)
  • But double-counted shared edges, so E 3F/2
    implying F 2E/3
  • Substitute F 2E/3 into Eulers formula
  • V 2 E/3 implies E 3V 6 lt 3V 3n in O(n)
  • F 2E/3 2V 4 lt 2V 2n in O(n)

8
Polyhedral Boundary Representations
v7
v2
v1
e1-
v1
es twin
e1
f1
f1
v3
e
v6
e
f0
e0,1
f0
e0
e4,0
v0
v5
v0
e0-
v4
twin edge DCEL doubly connected edge list
winged edge
  • 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
  • focus is on edge
  • edge orientation is arbitrary

source ORourke, Computational Geometry in C
see also deBerg et al. for DCEL description
9
Polyhedral Boundary Representations Quad-Edge
v7
v6
v1
f1
v2
e1,1
e0,0
f0
v5
v3
v0
v4
unbounded face
  • general subdivision of oriented 2D manifold
  • edge record is part of
  • endpoint 1 list
  • endpoint 2 list
  • face A list
  • face B list

source ORourke, Computational Geometry in C
10
Algorithms 2D Gift Wrapping
source ORourke, Computational Geometry in C
  • Use one extreme edge as an anchor for finding the
    next

11
Algorithms 3D Gift Wrapping
O(n2) time output sensitive O(nF) for F faces
on hull
CxHull Animations http//www.cse.unsw.edu.au/lam
bert/java/3d/hull.html
12
Algorithms 2D Divide-and-Conquer
source ORourke, Computational Geometry in C
  • Divide-and-Conquer in a geometric setting
  • O(n) merge step is the challenge
  • Find upper and lower tangents
  • Lower tangent find rightmost pt of A leftmost
    pt of B then walk it downwards
  • Idea is extended to 3D in Chapter 4.

B
A
Algorithm 2D DIVIDE-and-CONQUER Sort points by x
coordinate Divide points into 2 sets A and B A
contains left n/2 points B contains right n/2
points Compute ConvexHull(A) and ConvexHull(B)
recursively Merge ConvexHull(A) and ConvexHull(B)
O(nlgn)
13
Algorithms 3D Divide and Conquer
O(n log n) time !
CxHull Animations http//www.cse.unsw.edu.au/lam
bert/java/3d/hull.html
14
Algorithms 3D Divide and Conquer
  • Hard work is in MERGE of A with B 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 lt edges so O(n) faces
  • Each face added in O(1) amortized time
  • Lemma When plane p is rotated about line through
    ab, first point c to be hit is a 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 W(n)
    neighbors, but monotonicity of counterclockwise
    search helps.
  • Each edge is charged/examined at most twice
    (once from each endpoint).
  • Discarding Hidden Faces
  • Wrapping discovers shadow boundary edges, but
    dont 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 ORourke, Computational Geometry in C
15
Algorithms 2D QuickHull
source ORourke, Computational Geometry in C
  • Concentrate on points close to hull boundary
  • Named for similarity to Quicksort

16
Algorithms 3D QuickHull
CxHull Animations http//www.cse.unsw.edu.au/lam
bert/java/3d/hull.html
17
Algorithms 2D Incremental
source ORourke, 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.
  • Idea is extended to 3D in Chapter 4.

Algorithm 2D INCREMENTAL ALGORITHM Let H2
ConvexHullp0 , p1 , p2 for k 3 to n - 1
do Hk ConvexHull Hk-1 U pk
O(n2)
can be improved to O(nlgn)
18
Algorithms 3D Incremental
source ORourke, 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 be on positive side of every plane
    determined by a face of Q.
  • Left-of 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.
  • 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.
  • Construct new hull using cone
  • Discard faces that are not visible.

19
Algorithms 3D Incremental
source ORourke, Computational Geometry in C
Algorithm 3D INCREMENTAL ALGORITHM Let H3
ConvexHull p0 , p1 , p2, p3
tetrahedron for i 4 to n - 1 do for each
face f of Hi-1 do compute signed volume of
tetrahedron determined by f and pi mark f
visible iff signed volume lt 0 if no faces are
visible then Discard pi (it is inside
Hi-1) else for each border edge e of
Hi-1 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.
20
Algorithms 3D Incremental
source ORourke, Computational Geometry in C
Calling Diagram for ORourkes C Implementation
of 3D Incremental Algorithm
Main
Print
ReadVertices
DoubleTriangle
ConstructHull
AddOne
Cleanup
MakeConeFace
MakeNullVertex
Collinear
MakeFace
VolumeSign
MakeCcw
CleanEdges
CleanFaces
CleanVertices
MakeNullEdge
MakeNullFace
21
Algorithms 3D Incremental
O(n2) time
CxHull Animations http//www.cse.unsw.edu.au/lam
bert/java/3d/hull.html
22
Algorithms 3D Randomized Incremental
source ORourke, Computational Geometry in C
  • Clarkson, Shor (1989)
  • O(nlgn) expected time
  • Variant of 3D incremental algorithm
  • Avoid brute-force visible face test
  • Maintain CONFLICT GRAPH
  • For each face of Hi-1record which not-yet-added
    points can see it
  • For each not-yet-added point, record which faces
    it can see (those it is in conflict with)
  • Key observation allowing fast adding of face
    CH(e,pi), where e is a polytope 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 Hi-1

Complementary sets of information
23
Algorithms 3D Randomized Incremental
  • More detail is found in de Berg et al. Ch 11
    Section 11.2-11.3
  • Bipartite conflict graph
  • When point and face cannot coexist in the convex
    hull.
  • Once point p in Pconflict( f ) is added to convex
    hull, facet f must be removed they conflict.
  • Initialize in linear time for convex hull of
    first 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 pre-existing
    convex hull.
  • Need to bound cardinality of conflict lists to
    analyze thissee subtle analysis of Section 11.3,
    which uses elegant notion of configuration space
    framework for a generic randomized incremental
    algorithm from Section 9.5.

facets of current hull
points not yet inserted
Conflict graph G
Not the same as motion planning configuration
space!
24
Algorithms 3D Randomized Incremental
  • Pseudocode from de Berg et al. Ch 11

Conflict graph G
25
Combinatorial Size of Convex Hull
Convex Hull boundary is intersection of
hyperplanes, so worst-case combinatorial size
(number of features) (not necessarily running
time) complexity is in
Qhull http//www.qhull.org
26
3D Visibility
source ORourke, Computational Geometry in C
  • To build our 3D visibility intuition (homework)
  • T planar triangle in 3D
  • C closed region bounded by a 3D cube
  • frequent problem in graphics

C
T
What is the largest number of vertices P can have
for any triangle?
About PowerShow.com