Roman Durikovic (323-B, [email protected], http://www.u-aizu.ac.
jp/ roman)
Convex Hull Algorithms. Voronoi Diagram.
Convex Hull
A convex combination of points p1
2. Divide the points into two sets A and B , where A contains the left n= points and B contains the right n= points. 3. 4. 1. Sort the points by x coordinate.
1 p1
+::: +
pn
: : : p is 0 1 + ::: +
n
= 1g
For example, a triangle consists of all convex combinations of its four vertices. The convex hull of a set of points P is the set of all convex combinations of points of P . Computing the convex hull of a set of points in two or more dimensions in one of the basic problems in computational geometry. Below we consider several popular convex hull algorithms. 2D Gift Wrapping. A set of n points on the plane is given.
b 2c Compute the convex hulls of the sets A and B . Merge the convex hulls of A and B into the convex hull of A B.
d 2e
The merging step consists of nding the lower and upper tangents of the convex hulls of A and B . The algorithm to compute the lower tangent is given below. Enumerate the vertices of the convex hulls of A and B in the counter-clockwise order starting from the lowest points. a rightmost point of A. b leftmost point of A. while T ab is not lower tangent to both A and B do while T is not lower tangent to A do
Find the lowest point p0 (smallest y-coordinate) repeat nd pk+1 such that all points lie to the left of pk pk+1 by scanning through all the points until pk+1 p0 .
= a a;1 while T is not lower tangent to B do b b+1
upper tangent
low
an rt
nt ge
3 4 6 5 4 7 A 3 2 8 0 1 7 0 6 1 5 B 2
If the number of sides of the hull is algorithm is nh.
h then the complexity of the
Graham Scan. A set of n points on the plane is given. 1. Find rightmost lowest point p0 2. Shift the origin of coordinates to p0 and sort all other points according to their polar angles. If two points have the same polar angle, the point closest to p0 goes rst. 3. Build the hull, by marching around all the points, adding edges when a left turn is made, and backtracking when a right turn is made (use stack to do back-tracking).
The the algorithm complexity is O
(n log n).
Incremental Algorithm. It is easy to invent an incremental algorithm to construct the convex hull of a set of points. Consider a convex hull (polygon) whose vertices p1 : : : pn are counted in the counter-clockwise direction and a new point q. If the new point q is inside the hull there is nothing to do. Otherwise, let us delete all the edges that the new point can see. Add two edges to connect the new point to the remainder of the old hull.
5 4
q
3 2
8 0
The most expensive part of the Graham scan algorithm is sorting. So the the complexity of the algorithm is O n n.
( log )
An edge pk pk+1 is seen from q if the signed area of the triangle q pk pk+1 is negative. If pk xk yk , pk+1 xk+1 yk+1 , and q x0 y0 then the signed area of the triangle q pk pk+1 is given by
=(
=(
k
=(
Divide-and-Conquer. A set of n points on the plane is given. The divide-and-conquer algorithm consists of the following steps
y0 1 0 1 x x y 1 A= 2 x +1 y +1 1
k k k
Voronoi Diagram
Given a set of points on the plane, the Voronoi diagram of the set is a partition of the plane into cells (Voronoi cells), each of which consists of the points closer to one particular point of the set than to any others. More precisely, let P p1 p2 : : : pn be a set of points on the plane. The points are called the sites. The Voronoi region V pi of a site pi is the set of all points on the plane that are closer to pi than they are to any other site:
p
2
=f
( )
p
1
v1
p
3
V (p ) = fx : jx ; p j jx ; p j
i i j
for any
j 6= ig:
The set of all points that have more than one nearest site form the Voronoi diagram for the set of sites P . The edges of the Voronoi regions are called Voronoi edges, and the vertices are called Voronoi vertices. Note that a point on the interior of a Voronoi edge has two nearest sites, and a Voronoi vertex has at least three nearest sites.
The Voronoi diagram possesses several interesting properties: V1. Each Voronoi region V pi is convex. V2.
( )
V ( p ) is unbounded if and only if p of P .
i
lies on the convex hull
V3. If v is a Voronoi vertex at the junction of V p1 , V p2 , and V p3 , then v is the center of the circle C v determined by p1 , p2 , and p3 . The interior of C v contains no sites.
( )
()
( ) ( ) ()
Problems
1. An afne combination of points plane is a sum of the form
f p1
p2
:::
n
pn on the
1 p1
+ ::: +
pn
+ ::: +
= 1g
This differs from the denition of a convex combination in that the conditions k is dropped. Find the afne combination of two given points. Find the afne combination of three collinear points. Find the afne combination of three non-collinear points.
2. Propose an O n algorithm to compute the convex hall of a non-convex polygon given by the list vertices enumerated in the counter clockwise direction. 3. Describe the Voronoi diagram for the set of points consisting of vertices of a regular polygon plus one point at the center of the polygon. 4. Prove that for n the number of vertices in the Voronoi diagram of a set of n sites P on the plane is at most n and the number of edges is at most n .
()
3 ;6
2 ;5
H INT: Prove the statement using Eulers formula. Since Eulers formula cannot be applied directly to P , because P has innite edges, add one extra vertex v at innity to the set of sites P and connect all half-innite edges of P to v . Apply Eulers formula to the obtained graph.
Vor( ) Vor( )
Vor( ) 1