Voronoi Diagrams and Delaunay Triangulations - cs.jhu.edumisha/Spring16/11.pdfย ยท Preliminaries...
Transcript of Voronoi Diagrams and Delaunay Triangulations - cs.jhu.edumisha/Spring16/11.pdfย ยท Preliminaries...
Voronoi Diagrams
and
Delaunay Triangulations
OโRourke, Chapter 5
Outline
โข Preliminaries
โข Voronoi Diagrams / Delaunay Triangulations
โข Lloydโs Algorithm
Preliminaries
Claim:
Given a connected planar graph with ๐ vertices, ๐ธedges, and ๐น faces*, the graph satisfies:
๐ โ ๐ธ + ๐น = 2
*The โexternalโ face also counts. (Can think of this as a graph on the sphere.)
Preliminaries
Proof:
1. Show that this is true for trees.
2. Show that this is true by induction.
Preliminaries
Proof (for Trees):
If a graph is a connected tree, it satisfies:
๐ = ๐ธ + 1.
Since there is only one (external) face:
๐ โ ๐ธ + ๐น = (๐ธ + 1) โ ๐ธ + 1 = 2
Preliminaries
Proof (by Induction):
Suppose that we are given a graph ๐บ. If itโs a tree, we are done.
Otherwise, it has a cycle.
Removing an edge on the cycle
gives a graph ๐บโฒ with: The same vertex set (๐โฒ = ๐)
One less edge (๐ธโฒ = ๐ธ โ 1)
One less face (๐นโฒ = ๐น โ 1)
By induction:
2 = ๐โฒ โ ๐ธโฒ + ๐นโฒ = ๐ โ ๐ธ + ๐น
Preliminaries
Note:
Given a planar graph ๐บ, we can get a planar
graph ๐บโฒ with triangle faces: Triangulate the interior polygons
Add a โvirtual pointโ outside
and triangulate the
exterior polygon.
Preliminaries
Note:
The new graph has: ๐โฒ = ๐ + 1, ๐ธโฒ โฅ ๐ธ, ๐นโฒ โฅ ๐น
๐โฒ โ ๐ธโฒ + ๐นโฒ = 2
3๐ธโฒ = 2๐นโฒ
Preliminaries
Note:
The new graph has: ๐โฒ = ๐ + 1, ๐ธโฒ โฅ ๐ธ, ๐นโฒ โฅ ๐น
๐โฒ โ ๐ธโฒ + ๐นโฒ = 2
3๐ธโฒ = 2๐นโฒ
This gives:
๐ธโฒ = 3๐โฒ โ 6 ๐นโฒ = 2๐โฒ โ 4โ โ
๐ธ โค 3๐ โ 3 ๐น โค 2๐ โ 2
The number of edges/faces of a planar graph is
linear in the number of vertices.
Preliminaries
Definition:
Given a set of points {๐1, โฆ , ๐๐} โ โ๐, the nearest-
neighbor graph is the directed graph with an edge
from ๐๐ to ๐๐, whenever:
๐๐ โ ๐๐ โฅ ๐๐ โ ๐๐ โ1 โค ๐ โค ๐.
Naively, the nearest-neighbor
can be computed in ๐(๐2) time
by testing all possible neighbors.
Outline
โข Preliminaries
โข Voronoi Diagrams / Delaunay Triangulations
โข Lloydโs Algorithm
Voronoi Diagrams
Definition:
Given points ๐ = ๐1, โฆ , ๐๐ , the Voronoi
region of point ๐๐, ๐(๐๐) is the set of points at
least as close to ๐๐ as to any other point in ๐:
๐ ๐๐ = ๐ฅ ๐๐ โ ๐ฅ โค ๐๐ โ ๐ฅ โ1 โค ๐ โค ๐
Voronoi Diagrams
Definition:
The set of points with more than one nearest
neighbor in ๐ is the Voronoi Diagram of ๐: The set with two nearest neighbors make up the
edges of the diagram.
The set with three or more nearest neighbors make up
the vertices of the diagram.
The points ๐ are called the sites of
the Voronoi diagram.
Voronoi Diagrams
2 Points:
When ๐ = ๐1, ๐2 , the regions are defined by
the perpendicular bisector:
๐1
๐2๐ป(๐2, ๐1)
๐ป(๐1, ๐2)
Voronoi Diagrams
3 Points:
When ๐ = ๐1, ๐2, ๐3 , the regions are defined
by the three perpendicular bisectors:
๐1
๐2
๐1
๐2
๐3
Voronoi Diagrams
3 Points:
When ๐ = ๐1, ๐2, ๐3 , the regions are defined
by the three perpendicular bisectors:
๐1
๐2
๐1
๐2
๐3
The three bisectors intersect at a point
The intersection can be outside the triangle.
The point of intersection is center of the circle
passing through the three points.
Voronoi Diagrams
More Generally:
The Voronoi region associated to point ๐๐ is
the intersection of the half-spaces defined by
the perpendicular bisectors:
๐ ๐๐ =โฉ๐โ ๐ ๐ป(๐๐ , ๐๐)
๐๐
Voronoi Diagrams
More Generally:
The Voronoi region associated to point ๐๐ is
the intersection of the half-spaces defined by
the perpendicular bisectors:
๐ ๐๐ =โฉ๐โ ๐ ๐ป(๐๐ , ๐๐)
๐๐
โ Voronoi regions are convex polygons.
Voronoi Diagrams
More Generally:
Voronoi Diagrams
More Generally:
Voronoi faces can be unbounded.
Voronoi regions are in 1-to-1 correspondence with points.
Most Voronoi vertices have valence 3.
Voronoi Diagrams
Properties: Each Voronoi region is convex.
๐ ๐๐ is unbounded โ ๐๐ is on the convex hull of ๐.
If ๐ฃ is a at the junction of ๐(๐1),โฆ, ๐(๐๐),with ๐ โฅ 3, then ๐ฃ is the center of a circle, ๐ถ(๐ฃ),with ๐1, โฆ , ๐๐ on the boundary.
The interior of ๐ถ(๐ฃ) contains
no points.
Delaunay Triangulation
Definition:
The Delaunay triangulation is the straight-line
dual of the Voronoi Diagram.
Note:
The Delaunay edges donโt
have to cross their Voronoi
duals.
Delaunay Triangulation
Properties: The edges of ๐ท(๐) donโt intersect.
๐ท(๐) is a triangulation if no 4 points are co-circular.
The boundary of ๐ท(๐) is the convex hull of ๐.
If ๐๐ is the nearest neighbor of ๐๐then ๐๐๐๐ is a Delaunay edge.
There is a circle through ๐๐and ๐๐ that does not contain
any other points
โ ๐๐๐๐ is a Delaunay edge.
The circumcircle of ๐๐, ๐๐,
and ๐๐ is empty
โ ฮ๐๐๐๐๐๐ is Delaunay triangle.
Delaunay Triangulation
Note:
Assuming that the edges of ๐ท(๐) do not cross, we
get a planar graph.
โ The number of edges/faces in a Delaunay
Triangulation is linear in the number of vertices.
โ The number of edges/vertices in a Voronoi
Diagram is linear in the number of faces.
โ The number of vertices/edges/faces in a Voronoi
Diagram is linear in the number of sites.
Delaunay Triangulation
Properties: The boundary of ๐ท(๐) is the convex hull of ๐.
Proof:
Suppose that ๐๐๐๐ is an edge of the hull of ๐.
Consider circles with center on the
bisector that intersect ๐๐ and ๐๐.
As we move out along the
bisector the circle converges to
the half-space to the right of ๐๐๐๐.๐๐
๐๐
Delaunay Triangulation
Properties: The boundary of ๐ท(๐) is the convex hull of ๐.
Proof:
Suppose that ๐๐๐๐ is an edge of the hull of ๐.
โ There is an (infinite) region on
the bisector that is closer to ๐๐and ๐๐ than to any other points.
โ There is a Voronoi edge
between ๐๐ and ๐๐.
โ The dual edge is in ๐ท(๐).๐๐
๐๐
Delaunay Triangulation
Properties: If ๐๐ is the nearest neighbor of ๐๐ then ๐๐๐๐ is a
Delaunay edge.
Proof:
๐๐ is the nearest neighbor of ๐๐ iff. the circle around ๐๐with radius |๐๐ โ ๐๐| is empty of other points.
โ The circle through (๐๐ + ๐๐)/2 with radius
๐๐ โ ๐๐ /2 is empty of other points.
โ (๐๐ + ๐๐)/2 is on the Voronoi diagram.
โ (๐๐ + ๐๐)/2 is on a Voronoi edge.
๐๐
๐๐
Delaunay Triangulation
Properties: If ๐๐ is the nearest neighbor of ๐๐ then ๐๐๐๐ is a
Delaunay edge.
Implications:
The nearest neighbor graph is a subset of the Delaunay
triangulation.
We will show that the Delaunay triangulation can be
computed in ๐(๐ log ๐ ) time.
โWe can compute the nearest-neighbor graph in
๐ ๐ log ๐ .
Delaunay Triangulation
Properties: There is a circle through ๐๐ and ๐๐ that does not
contain any other points โ ๐๐๐๐ is a Delaunay edge.
Proof (โ):
If ๐๐๐๐ is a Delaunay edge, then the Voronoi regions
๐(๐๐) and ๐(๐๐) intersect at an edge.
Set ๐ฃ to be some point on the interior of the edge.
๐ฃ โ ๐๐ = ๐ฃ โ ๐๐ = ๐ and ๐ฃ โ ๐๐ > ๐ โ๐ โ ๐, ๐.
The circle at ๐ฃ with radius ๐ is empty of other points.
Delaunay Triangulation
Properties: There is a circle through ๐๐ and ๐๐ that does not
contain any other points โ ๐๐๐๐ is a Delaunay edge.
Proof (โ):
If there is a circle through ๐๐ and ๐๐, empty of other
points, with center ๐ฅ, then ๐ฅ โ ๐ ๐๐ โฉ ๐ ๐๐ .
Since no other point is in or on the circle
there is a neighborhood of centers
around ๐ฅ on the bisector with circles
through ๐๐ and ๐๐ empty of other points.
๐ฅ is on a Voronoi edge.
๐ฅ
๐๐
๐๐
Delaunay Triangulation
Properties: The edges of ๐ท(๐) donโt intersect.
Proof:
Given an edge ๐๐๐๐ in ๐ท(๐), there is a circle with ๐๐and ๐๐ on its boundary and empty of other points.
Let be ๐๐๐๐ be an edge in ๐ท(๐) that intersect ๐๐๐๐:
๐๐ and ๐๐ cannot be in the circle.
โ ๐๐ and ๐๐ are not in the triangle ฮ๐๐๐๐๐๐๐โ ๐๐๐๐ intersects either ๐๐๐๐๐ or ๐๐๐๐๐.
โ ๐๐๐๐ intersects either ๐๐๐๐๐ or ๐๐๐๐๐.
โ One of ๐๐๐๐๐ or ๐๐๐๐๐ one of ๐๐๐๐๐ or ๐๐๐๐๐.
๐๐๐
๐๐
๐๐
๐๐ ๐๐๐๐๐
Delaunay Triangulation
Properties: The edges of ๐ท(๐) donโt intersect.
Proof:
Given an edge ๐๐๐๐ in ๐ท(๐), there is a circle with ๐๐and ๐๐ on its boundary and empty of other points.
Let be ๐๐๐๐ be an edge in ๐ท(๐) that intersect ๐๐๐๐:
๐๐ and ๐๐ cannot be in the circle.
โ ๐๐ and ๐๐ are not in the triangle ฮ๐๐๐๐๐๐๐โ ๐๐๐๐ intersects either ๐๐๐๐๐ or ๐๐๐๐๐.
โ ๐๐๐๐ intersects either ๐๐๐๐๐ or ๐๐๐๐๐.
โ One of ๐๐๐๐๐ or ๐๐๐๐๐ one of ๐๐๐๐๐ or ๐๐๐๐๐.
๐๐๐
๐๐
๐๐
๐๐ ๐๐๐๐๐
But ๐๐๐๐๐ is in the Voronoi region of ๐๐ and ๐๐๐๐๐ is
in the Voronoi region of ๐๐, so they cannot intersect.
Outline
โข Preliminaries
โข Voronoi Diagrams / Delaunay Triangulations Naive Algorithm
Fortuneโs Algorithm
โข Lloydโs Algorithm
Naive Algorithm
Delaunay( {๐1, โฆ , ๐๐} ) for ๐ โ 1, ๐
ยปfor ๐ โ 1, ๐โ for ๐ โ [1, ๐)โข (๐, ๐) โ Circumcircle( ๐๐ , ๐๐ , ๐๐ )
โข isTriangle โ trueโข for ๐ โ [1, ๐)
โข if( ๐๐ โ ๐ < ๐ ) isTriangle โ falseโข if( isTriangle ) Output( ๐๐ , ๐๐ , ๐๐ )
Complexity: ๐(๐4)
Voronoi Diagrams and Cones
Key Idea:
We can think of generating Voronoi regions
by expanding circles centered at points of ๐.
When multiple circles overlap a point, track
the one that is closer.
Voronoi Diagrams and Cones
Key Idea:
We can visualize the Voronoi regions by
drawing right cones over the points, with axes
along the positive ๐ง-axis.
Circles with radius ๐ are the projections of the
intersections of the plane ๐ง = ๐ plane with the
cones, onto the ๐ฅ๐ฆ-plane.
๐ฅ
๐ง
๐๐๐
Voronoi Diagrams and Cones
Key Idea:
To track the closer circle, we can render the
cones with an orthographic camera looking
up the ๐ง-axis.
๐ฅ
๐ง
๐
Voronoi Diagrams and Cones
Key Idea:
To track the closer circle, we can render the
cones with an orthographic camera looking
up the ๐ง-axis.
Visualization
Fortuneโs Algorithm
Approach:
Sweep a line and maintain the solution for all
points behind the line.
Fortuneโs Algorithm
Why This Shouldnโt Work:
The Voronoi region behind the line can
depend on points that are in front of the line!
(Looking up the ๐ง-axis, we see
the cone before the apex.)
Key Idea:
We can finalize points
behind the line that are
closer to a site than to
the line.
Fortuneโs Algorithm
Given a site ๐ โ ๐ and the
line with height ๐ฆ0, we can
finalize the points satisfying:
(๐ฅ, ๐ฆ) ๐ฆ โ ๐ฆ02 > ๐ โ (๐ฅ, ๐ฆ) 2
Points on the boundary satisfy:
๐ฆ โ ๐ฆ02 = ๐ โ (๐ฅ, ๐ฆ) 2
Setting ๐ง = ๐ โ (๐ฅ, ๐ฆ) , this gives:
๐ง = ๐ฆ โ ๐ฆ0
๐
๐ฆ = ๐ฆ0
Fortuneโs Algorithm
Formally:
โWe can describe the
points on the boundary as
the ๐ฅ๐ฆ-coordinates of the points in 3D with:
1. ๐ง = ๐ โ (๐ฅ, ๐ฆ)
2. ๐ง = ๐ฆ โ ๐ฆ0
Sweep the cones
with a plane parallel
to the ๐ฅ-axis making a 45โ
angle with the ๐ฅ๐ฆ-plane.
Points on the right cone,
centered at ๐,centered around the positive ๐ง-axis
Points on the plane,
making a 45โ angle with the ๐ฅ๐ฆ-plane,
passing through the line ๐ฆ = ๐ฆ0 and ๐ง = 0
๐
๐ฆ = ๐ฆ0
Fortuneโs Algorithm
Fortuneโs Algorithm
Sweep with a plane ๐๐ฆ, parallel to the ๐ฅ-axis,
making a 45โ angle with the ๐ฅ๐ฆ-plane.
โRenderโ the cones and the plane with an
orthographic camera looking up the ๐ง-axis.
At each point, we see: The part of ๐๐ฆ that is in front of the line (since it is
below the ๐ฅ๐ฆ-plane and hence below the cones).
The part of the cones that are behind the line and
below ๐๐ฆ.
Fortuneโs Algorithm
As ๐ฆ advances, the algorithm maintains a set
of parabolic fronts (the projection of the
intersections of ๐๐ฆwith the cones).
At any point, the
Voronoi diagram is
finalized behind the
parabolic fronts.
Fortuneโs Algorithm
As ๐ฆ advances, the algorithm maintains a set
of parabolic fronts (the projection of the
intersections of ๐๐ฆwith the cones).
At any point, the
Voronoi diagram is
finalized behind the
parabolic fronts.Implementation:
โข The fronts are maintained in order.
โข As ๐ฆ intersects a site, its front is inserted.
โข Complexity ๐(๐ log ๐).
Outline
โข Preliminaries
โข Voronoi Diagrams / Delaunay Triangulations
โข Lloydโs Algorithm
Lloydโs Algorithm
Challenge:
Solve for the position of points ๐ = {๐1, โฆ , ๐๐}inside the unit square minimizing:
๐ธ ๐ = 0,1 2๐2(๐, ๐) ๐๐
where ๐ ๐, ๐ = min๐|๐๐ โ ๐|.
Lloydโs Algorithm
Approach:
1. Initialize the points to random positions.
2. Compute the Voronoi Diagram of the
points, clipped to the unit square.
3. Set the positions of the points to the
centers of mass of the corresponding
Voronoi cells.
4. Go to step 2.
Lloydโs Algorithm
Lloydโs Algorithm
2. Compute the Voronoi Diagram of the
points, clipped to the unit square.
Since:
0,1 2๐2(๐, ๐) ๐๐ =
๐น๐โ๐ ๐
๐น๐
๐๐ โ ๐2๐๐
this provides the assignment of points in
0,1 2 to points in ๐ that minimize the energy.
Lloydโs Algorithm
3. Set the positions of the points to the
centers of mass of the corresponding
Voronoi cells.
Since:
arg min๐โ 0,1 2
๐น
๐ โ ๐ 2๐๐ = ๐ถ(๐น)
with ๐ถ(๐น) the center of mass of face ๐น, repositioning to the center reduces the
energy.