Convex Hulls in 3D Definitions Size of a Convex Hull in 3D

Convex Hulls in 3D
SMD156
Lecture 11
Convex Hulls in
Higher Dimensions
Voronoi
diagrams
3D
Incremental
Algorithm
SMD156 Computational Geometry - Håkan Jonsson
• Collision detection:
1
SMD156 Computational Geometry - Håkan Jonsson
Definitions
Size of a Convex Hull in 3D
• The smallest volume
polyhedral that contains a set
of points in 3D.
•
2
"Theorem 11.1 + Corollary 11.2#
!
A convex hull in 3D with n vertices has at most
• 3n$6 edges and
• 2n$4 facets.
1. It is %planar%
2. Euler&s formula
! Facets
! Edges
! Vertices
• "Generalizes to higher
dimensions.#
SMD156 Computational Geometry - Håkan Jonsson
3
SMD156 Computational Geometry - Håkan Jonsson
4
Computing a Convex Hull in 3D
Horizon
• Incremental Algorithm
! Add points one at a time and maintain a current
convex hull.
! Use DCEL:s to represent the convex hull.
• Start with four "4# points that form a
pyramid.
• Then add new facets for each point
considered that lie outside the current hull.
! "and delete old facets that end up inside.#
SMD156 Computational Geometry - Håkan Jonsson
5
Adding One Point
SMD156 Computational Geometry - Håkan Jonsson
6
Deleting/Adding Facets
• The horizon can be found by traversing the
"surface of the# convex hull.
! Each edge of the horizon bounds two faces of
which just one is visible.
• A point is !isibl" to another point if the line
segment that is bounded by the points
doesn&t intersect the interior of the convex
hull.
• A face/edge is visible if all its points are
visible.
• Remove visible faces.
! Easy since, by construction, each facet is oriented
counterclockwis" when seen from the outside of
the convex hull.
SMD156 Computational Geometry - Håkan Jonsson
7
• Insert new triangular facets for each edge in
the horizon unless…
SMD156 Computational Geometry - Håkan Jonsson
8
Worst-Case Analysis
• … the new face would be coplanar with an
existing face %behind% the horizon, in which
case the two are merged.
SMD156 Computational Geometry - Håkan Jonsson
9
How to Find the Visible Facets
• Each time a linear number "in the size of the
current convex hull# of new facets replace as
many old facets.
• Total time: O"n2#
SMD156 Computational Geometry - Håkan Jonsson
10
Conflict Graph
• As on previous slide: Brute$force.
• Clever trick: Use a con#ict graph.
!
!
!
!
Bipartite.
Nodes for each point not yet considered.
Nodes for each facet in the current convex hull.
Arcs between points and facets that are visible to
each other.
• Maintain the con'ict graph during the
computation.
SMD156 Computational Geometry - Håkan Jonsson
11
SMD156 Computational Geometry - Håkan Jonsson
12
Using the Conflict Graph
Adding a Point
• The facets visible to a point are its neighbors
in the graph.
• Likewise: The points visible from a facet are
its neighbors in the graph.
• The con'ict sets of points and facets can be
extracted in time linear in their sizes.
• Using the con'ict graph, we get the horizon and all
visible facets.
• Remove all visible facets, but keep those next to the
horizon in a separate data structure for a while.
SMD156 Computational Geometry - Håkan Jonsson
13
Adding a Point (cont.)
•
! Update the con'ict graph accordingly
• When adding a new point ! and new facets ! to the
convex hull , we add new nodes to the con'ict graph
as well.
• The crucial point is how to construct their con'ict
lists.
SMD156 Computational Geometry - Håkan Jonsson
14
New Faces lie Next to the Horizon
Consider adding a new face f.
1.
2.
f is coplanar with f1 "%behind% the horizon#
• Con'ictList"f# = Con'ictList"f1#.
f is not coplanar with f1
• Con'ictList"f# = Visible points of Con'ictList"f1# and
Con'ictList"f2#.
SMD156 Computational Geometry - Håkan Jonsson
15
f
SMD156 Computational Geometry - Håkan Jonsson
16
Convex Hulls in 3D and Delaunay
Triangulations in 2D
SMD156 Computational Geometry - Håkan Jonsson
17
SMD156 Computational Geometry - Håkan Jonsson
18
SMD156 Computational Geometry - Håkan Jonsson
19
SMD156 Computational Geometry - Håkan Jonsson
20
Conclusion
Conclusion
• The Delaunay triangulation/Voronoi diagram
of a set of n points "xi, yi# in the plan can be
computed by computing the convex hull in
3D of the points "xi, yi, xi2+yi2#.
• "Lemma 11.4#
! Extract the lower hull.
! Given a set of n points in 3D, CONVEXHULL
computes a convex hull in O"n log n# expected
time.
• Comment:
! There is also a deterministic algorithm by
Preparata and Hong that runs in O"n log n# time,
but that one is more complicated.
SMD156 Computational Geometry - Håkan Jonsson
21
SMD156 Computational Geometry - Håkan Jonsson
23
SMD156 Computational Geometry - Håkan Jonsson
22