Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E...

8
D7013E Computational Geometry - Håkan Jonsson 1 D7013E Lecture 7 Voronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points Input: A set of n points P = {p 1 , p 2 , …, p n } called sites Output: A subdivision Vor(P) of the plane into n cells such that: 1. Each cell contains exactly one (1) site 2. The cell V(p i ) of p i contains all points closer to p i than any other site Boundaries of cells consists of points equidistant from two or more sites D7013E Computational Geometry - Håkan Jonsson 3 p i V(p i ) Libraries for Computational Geometry LEDA Library of Efficient Data Structures – C++ CGAL Computational Geometry Algorithms Library – C++ CORE – http://cs.nyu.edu/exact/ They state: In fact, simplest usage is to take a standard C/C++ program, and insert this 2-line preamble: #define Level <level_number> #include "CORE.h” where <level_number> sets the desired accuracy. D7013E Computational Geometry - Håkan Jonsson 4

Transcript of Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E...

Page 1: Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points

D7013E Computational Geometry - Håkan Jonsson 1

D7013ELecture 7

Voronoi Diagrams

Proximity problems

Plane-sweep

Fortune’s Algorithm

D7013E Computational Geometry - Håkan Jonsson 2

Voronoi Diagrams

7.0 Voronoi Diagrams for points •  Input:

–  A set of n points P = {p1, p2, …, pn} called sites

•  Output: –  A subdivision Vor(P) of the plane

into n cells such that: –  1. Each cell contains exactly one (1)

site –  2. The cell V(pi) of pi contains all

points closer to pi than any other site

•  Boundaries of cells consists of points equidistant from two or more sites

D7013E Computational Geometry - Håkan Jonsson 3

pi V(pi)

Libraries for Computational Geometry •  LEDA

–  Library of Efficient Data Structures –  C++

•  CGAL –  Computational Geometry Algorithms Library –  C++

•  CORE –  http://cs.nyu.edu/exact/ –  They state: In fact, simplest usage is to take a standard C/C++

program, and insert this 2-line preamble: #define Level <level_number> #include "CORE.h” �

where <level_number> sets the desired accuracy.

D7013E Computational Geometry - Håkan Jonsson 4

Page 2: Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points

D7013E Computational Geometry - Håkan Jonsson 5

Some definitions

•  We use Euclidean distance in the plane •  Slight abuse of notation:

–  Sometimes Voronoi diagram will refer to the edges and vertices that bound the cells rather than the cells themselves

•  The bisector of a line segment:

Basic Properties •  Observation 7.1:

–  Each cell V(pi) is the intersection of n-1 half-planes defined by bisectors

•  So, at most n-1 vertices and n-1 edges

•  Cells are open sets –  Separate from edges and

vertices •  Edges are open line

segments –  Separate from vertices (the

end points of the edges)

D7013E Computational Geometry - Håkan Jonsson 6

Basic Properties

•  Theorem 7.2: •  If all sites are collinear,

Vor(P) consists of n-1 parallel lines –  Argue using bisectors

•  If not, Vor(P) is connected and its edges are either line segments or half-lines –  Proof by contradiction

D7013E Computational Geometry - Håkan Jonsson 7 D7013E Computational Geometry - Håkan Jonsson 8

Basic Properties •  Theorem 7.3:

–  For n≥3, •  the number of vertices of a Vor(P) is at

most 2n-5 and •  the number of edges is at most 3n-6

–  Vor(P) is a planar graph, if we add a virtual vertex to which all unbounded lines are connected

–  Euler’s formula •  Note: A single cell could have O(n)

vertices –  By Theorem 7.3, there are just a constant

number of such cells

Page 3: Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points

D7013E Computational Geometry - Håkan Jonsson 9

Basic Properties •  Vertices of Vor(P) are intersections

between bisectors –  The number of bisectors is O(n2) –  But Vor(P) has only linear size..?

•  The largest empty circle CP(q) of q with respect to P is the largest circle centered at q that does not contain any point of P

•  Theorem 7.4: –  a) The point q is a vertex of Vor(P) if and

only if CP(q) contains 3 or more sites on its boundary

–  b) The bisector L between pi and pj define an edge of Vor(P) if and only if there is a point q on L such that CP(q) has pi and pj on its boundary but no other sites

Computing a Voronoi Diagram

•  A first solution: –  For each site pi:

•  For all other sites pj, where j≠i: – Compute the bisector Li of [pi, pj]

»  These bisectors (lines) bound half-planes •  Compute the intersection of the half-planes of all Li

– This is V(pi) –  (Connect all V(pi) into Vor(P))

•  Computing n intersections of n-1 half-planes takes O(n2 log n) time as explained in Chapter 4

•  Can we do better?

D7013E Computational Geometry - Håkan Jonsson 10

A lower bound •  Note that the sites in the

unbounded (”outmost”) cells form the convex hull of the sites –  (And, as we know, a convex

hull takes Θ(n log n) time to compute)�

•  We can sort with any algorithm that computes a Voronoi diagram, so the latter must take Ω(n log n) time –  (Basically the same

construction as for proving the lower bound on the convex hull problem)

D7013E Computational Geometry - Håkan Jonsson 11

Fortune’s Algorithm •  … and there is a better algorithm •  Steve Fortune published an optimal algorithm in 1987

–  Works in Θ(n log n) time and O(n) space •  Based on plane sweep

–  However, slightly more complicated than what we have seen so far •  The sweep line is a line as before •  The status, however, is not the same

–  A concatenation of parabolas above the sweep line –  Called a beach line

•  There are two kinds of event points where the sweep line stops: –  Site events, and –  Circle events

D7013E Computational Geometry - Håkan Jonsson 12

Page 4: Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points

Demo

D7013E Computational Geometry - Håkan Jonsson 13 D7013E Computational Geometry - Håkan Jonsson 14

The Beach Line •  Acts as our status

information •  The edges of Vor(P) are

traced out by the breaks in the beach line as the sweep is carried out –  When the sweep line

moves, the beach line will also move/change

•  Invariant: –  Above the beach line, the

Voronoi diagram has been computed

–  Note: Not everything above the sweep line(!)

D7013E Computational Geometry - Håkan Jonsson 15

The Beach Line •  The Voronoi diagram of a

point and a line is a parabola •  A beach line is the lower

envelope of the Voronoi diagrams of each site above the sweep line and the sweep line

–  The point-wise minimum of all the parabolas

•  An event happens when an arc [of a parabola] appears on, or disappears from, the beach line

•  Arcs appear in the beach line at site events, which is when the sweep line hits a site:

D7013E Computational Geometry - Håkan Jonsson 16

Site Events – Creating Voronoi edges

pj

pi

The break has traced out a line segment, a part of the Voronoi edge between V(pi) and V(pj)

V(pj)

V(pi)

pj

pi

pj

pi

pj

pi

Page 5: Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points

Site Events •  Lemma 7.6:

–  The only way in which a new arc can appear on the beach line is through a site event

•  Essentially, the further above the sweep line a site lies, the “wider” the parabola

•  Corollary: –  There are at most 2n-1 arcs in the beach line

•  Each new arc might split at most one old arc •  Since Voronoi edges are traced out by break points, and

break points are introduced when arcs are inserted, site events are where new Voronoi edges are starting to take form –  … starting with the second site event (we need at least two arcs

to have a break point)

D7013E Computational Geometry - Håkan Jonsson 17 D7013E Computational Geometry - Håkan Jonsson 18

Circle events – Creating Voronoi vertices

•  An arc disappears at a circle event –  A circle event is the lowest point on the circle through three sites

defining consecutive arcs in the beach line –  Two break points meet <=> two Voronoi edges are joined by a

Voronoi vertex

D7013E Computational Geometry - Håkan Jonsson 19

Representation •  The Voronoi diagram under construction:

–  A DCEL with a bounding box large enough to hold the final Voronoi diagram

D7013E Computational Geometry - Håkan Jonsson 20

Representation •  The beach line: A balanced binary search

tree T in which –  leaves correspond to arcs (ordered by x-

coordinate), and –  (internal) nodes correspond to breakpoints. –  Takes O(log n) time to find the arc above a

new site –  Pointers from

•  leaves into the event queue (to the circle events that removes the arcs, if they exist)

•  nodes into the DCEL (the edge being traced out by the breakpoint)

•  The event queue: –  Events ordered by y-coordinate

•  Circle events are represented by the lowest point on the circle

–  Pointers from circle events to their leaves in T

Page 6: Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points

D7013E Computational Geometry - Håkan Jonsson 21

False alarms (false circle events) •  Circle events are added immediately

when detected during the sweep •  Two concerns:

–  Not all three points defining consecutive arcs in the beach line give rise to a circle event

•  Just skip it –  A circle event might not take place; it must

then be cancelled ahead of time •  A new arc splits the three consecutive

arcs (a site event occurs) so that the triple disappears

–  (Note that this might introduce other, new, circle events)

•  Remove it by using the pointers between the circle event in the event queue and the leaf in T of the arc hit by the new arc

Complexity •  There are two special cases to consider:

–  Two or more events on the same y-coordinate

•  Example: Four or more sites on a circle –  Would be several coinciding circle

events –  Use zero-length Voronoi edges

during the computation; filter them away afterwards

–  A site event occurs exactly under a break point

•  Also here, a zero-length edge is created and everything works fine

•  Theorem 7.10: The Voronoi diagram of n points can be computed in O(n log n) time and O(n) storage

D7013E Computational Geometry - Håkan Jonsson 22

7.3 Voronoi diagrams of line segments •  If the sites are not points but objects, we use as

metric the distance to the closest point on the object •  The Voronoi diagram for disjoint line segments

consists of line segments and parabolas

D7013E Computational Geometry - Håkan Jonsson 23

Chapter 7VORONOI DIAGRAMS

half-edge e⃗ we can determine the two sites that have e on their bisector (usingIncidentFace(⃗e) and IncidentFace(Twin(⃗e))). Since we can also easily find thetwo vertices between which the edge lies (Origin(⃗e) and Origin(Twin(⃗e))), wecan determine the shape of any edge in constant time.

The whole sweep line algorithm is now just an extension of the one for pointsites, with more cases to be distinguished and handled. However, the algorithmstill has only O(n) events, and each can be handled in O(logn) time.

Theorem 7.11 The Voronoi diagram of a set of n disjoint line segment sites canbe computed in O(n logn) time using O(n) storage.

One of the applications of the Voronoi diagram for line segments is inmotion planning (covered more extensively in Chapter 13). Assume that a setof obstacles is given, consisting of n line segments in total, and that we havea robot R. We assume that the robot can move freely in all directions, and isapproximated well by an enclosing disc D. Suppose that we wish to find acollision-free motion from one location of the robot to another, or to decide thatnone exists.

One motion-planning technique is called retraction. The idea of retraction isthat the arcs of the Voronoi diagram define the middle between the line segments,and therefore define a path with the most clearance. So a path over the arcsof the Voronoi diagram is the best option for a collision-free path. Figure 7.6shows a set of line segments inside a rectangle, together with a Voronoi diagramof the line segments and the sides of the rectangle.

Figure 7.6Voronoi diagram of line segments, and

start and end positions of a disc

pstartpend

We can determine a collision-free path between two disc positions amidst aset of line segments with the following algorithm.162

A problem •  If line segments share

end points, some bisectors become strange. –  They are no longer curves

but regions •  The remedy here is to

move line segments a (very) small distance away from each other so they do not intersect at all –  We just consider them

moved

Chapter 7VORONOI DIAGRAMS

7.3 Voronoi Diagrams of Line Segments

The Voronoi diagram can also be defined for objects other than points. Thedistance from a point in the plane to an object is then measured to the closestpoint on the object. Whereas the bisector of two points is simply a line, thebisector of two disjoint line segments has a more complex shape. It consists ofup to seven parts, where each part is either a line segment or a parabolic arc.Parabolic arcs occur if the closest point of one line segment is an endpoint andthe closest point of the other line segment is in its interior. In all other cases thebisector part is straight. Although bisectors and therefore the Voronoi diagramare somewhat more complex, the number of vertices, edges, and faces in theVoronoi diagram of n disjoint line segments is still only O(n).

Assume for a moment that we allow the line segments to be non-crossing,that is, we allow them to share endpoints. Then a whole region of the plane canbe equally close to two line segments via their common endpoint, and bisectorsare not even curves anymore. To avoid the complications that arise in definingand computing Voronoi diagrams of line segments that share endpoints, wewill simply assume here that all line segments are strictly disjoint. In manyapplications we can simply shorten the line segments very slightly to obtaindisjoint line segments.

The sweep line algorithm for points can be adapted to the case of linesegment sites. Let S= {s1, . . . ,sn} be a set of n disjoint line segments. Wecall the segments of Ssites as before, and use the terms site endpoint and siteinterior in the following description.

Figure 7.5The beach line for a set of line segmentsites. The breakpoints trace the dashedarcs, which include the Voronoi edges

s1s2

s3s4

s5

Recall that our algorithm for point sites maintained a beach line: a piecewiseparabolic x-monotone curve such that, for points on the curve, the distance tothe closest site above the sweep line is equal to the distance to the sweep line.What does the beach line look like when the sites are segments? First we notethat a line segment site may be partially above and partially below the sweepline. When defining the beach line, we consider only those parts of the sites thatare above the sweep line. Hence, for a given position of the sweep line ℓ, thebeach line consists of those points such that the distance to the closest portionof a site above ℓ is equal to the distance to ℓ. This means that the beach linenow consists of parabolic arcs and straight line segments. A parabolic arc ariseswhen that part of the beach line is closest to a site endpoint, and a straight linesegment arises when that part of the beach line is closest to a site interior. Notethat if a site interior intersects ℓ, then the beach line will have two straight linesegments ending at the intersection—see site s2 in Figure 7.5.160

D7013E Computational Geometry - Håkan Jonsson 24

Page 7: Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points

An algorithm •  It turns out essentially the same plane sweep still works, with some

adjustments –  However, the beach line now contains both parabolas and line segments

D7013E Computational Geometry - Håkan Jonsson 25

Chapter 7VORONOI DIAGRAMS

7.3 Voronoi Diagrams of Line Segments

The Voronoi diagram can also be defined for objects other than points. Thedistance from a point in the plane to an object is then measured to the closestpoint on the object. Whereas the bisector of two points is simply a line, thebisector of two disjoint line segments has a more complex shape. It consists ofup to seven parts, where each part is either a line segment or a parabolic arc.Parabolic arcs occur if the closest point of one line segment is an endpoint andthe closest point of the other line segment is in its interior. In all other cases thebisector part is straight. Although bisectors and therefore the Voronoi diagramare somewhat more complex, the number of vertices, edges, and faces in theVoronoi diagram of n disjoint line segments is still only O(n).

Assume for a moment that we allow the line segments to be non-crossing,that is, we allow them to share endpoints. Then a whole region of the plane canbe equally close to two line segments via their common endpoint, and bisectorsare not even curves anymore. To avoid the complications that arise in definingand computing Voronoi diagrams of line segments that share endpoints, wewill simply assume here that all line segments are strictly disjoint. In manyapplications we can simply shorten the line segments very slightly to obtaindisjoint line segments.

The sweep line algorithm for points can be adapted to the case of linesegment sites. Let S= {s1, . . . ,sn} be a set of n disjoint line segments. Wecall the segments of Ssites as before, and use the terms site endpoint and siteinterior in the following description.

Figure 7.5The beach line for a set of line segmentsites. The breakpoints trace the dashedarcs, which include the Voronoi edges

s1s2

s3s4

s5

Recall that our algorithm for point sites maintained a beach line: a piecewiseparabolic x-monotone curve such that, for points on the curve, the distance tothe closest site above the sweep line is equal to the distance to the sweep line.What does the beach line look like when the sites are segments? First we notethat a line segment site may be partially above and partially below the sweepline. When defining the beach line, we consider only those parts of the sites thatare above the sweep line. Hence, for a given position of the sweep line ℓ, thebeach line consists of those points such that the distance to the closest portionof a site above ℓ is equal to the distance to ℓ. This means that the beach linenow consists of parabolic arcs and straight line segments. A parabolic arc ariseswhen that part of the beach line is closest to a site endpoint, and a straight linesegment arises when that part of the beach line is closest to a site interior. Notethat if a site interior intersects ℓ, then the beach line will have two straight linesegments ending at the intersection—see site s2 in Figure 7.5.160

Chapter 7VORONOI DIAGRAMS

7.3 Voronoi Diagrams of Line Segments

The Voronoi diagram can also be defined for objects other than points. Thedistance from a point in the plane to an object is then measured to the closestpoint on the object. Whereas the bisector of two points is simply a line, thebisector of two disjoint line segments has a more complex shape. It consists ofup to seven parts, where each part is either a line segment or a parabolic arc.Parabolic arcs occur if the closest point of one line segment is an endpoint andthe closest point of the other line segment is in its interior. In all other cases thebisector part is straight. Although bisectors and therefore the Voronoi diagramare somewhat more complex, the number of vertices, edges, and faces in theVoronoi diagram of n disjoint line segments is still only O(n).

Assume for a moment that we allow the line segments to be non-crossing,that is, we allow them to share endpoints. Then a whole region of the plane canbe equally close to two line segments via their common endpoint, and bisectorsare not even curves anymore. To avoid the complications that arise in definingand computing Voronoi diagrams of line segments that share endpoints, wewill simply assume here that all line segments are strictly disjoint. In manyapplications we can simply shorten the line segments very slightly to obtaindisjoint line segments.

The sweep line algorithm for points can be adapted to the case of linesegment sites. Let S= {s1, . . . ,sn} be a set of n disjoint line segments. Wecall the segments of Ssites as before, and use the terms site endpoint and siteinterior in the following description.

Figure 7.5The beach line for a set of line segmentsites. The breakpoints trace the dashedarcs, which include the Voronoi edges

s1s2

s3s4

s5

Recall that our algorithm for point sites maintained a beach line: a piecewiseparabolic x-monotone curve such that, for points on the curve, the distance tothe closest site above the sweep line is equal to the distance to the sweep line.What does the beach line look like when the sites are segments? First we notethat a line segment site may be partially above and partially below the sweepline. When defining the beach line, we consider only those parts of the sites thatare above the sweep line. Hence, for a given position of the sweep line ℓ, thebeach line consists of those points such that the distance to the closest portionof a site above ℓ is equal to the distance to ℓ. This means that the beach linenow consists of parabolic arcs and straight line segments. A parabolic arc ariseswhen that part of the beach line is closest to a site endpoint, and a straight linesegment arises when that part of the beach line is closest to a site interior. Notethat if a site interior intersects ℓ, then the beach line will have two straight linesegments ending at the intersection—see site s2 in Figure 7.5.160

An algorithm •  The input segments act

as sites –  End points of these are

site event points •  There are 5 kinds of

circle event points •  The beach line can be

maintained in the spirit of how we first did it but, of course, involving more cases –  Read on your own

D7013E Computational Geometry - Håkan Jonsson 26

Chapter 7VORONOI DIAGRAMS

7.3 Voronoi Diagrams of Line Segments

The Voronoi diagram can also be defined for objects other than points. Thedistance from a point in the plane to an object is then measured to the closestpoint on the object. Whereas the bisector of two points is simply a line, thebisector of two disjoint line segments has a more complex shape. It consists ofup to seven parts, where each part is either a line segment or a parabolic arc.Parabolic arcs occur if the closest point of one line segment is an endpoint andthe closest point of the other line segment is in its interior. In all other cases thebisector part is straight. Although bisectors and therefore the Voronoi diagramare somewhat more complex, the number of vertices, edges, and faces in theVoronoi diagram of n disjoint line segments is still only O(n).

Assume for a moment that we allow the line segments to be non-crossing,that is, we allow them to share endpoints. Then a whole region of the plane canbe equally close to two line segments via their common endpoint, and bisectorsare not even curves anymore. To avoid the complications that arise in definingand computing Voronoi diagrams of line segments that share endpoints, wewill simply assume here that all line segments are strictly disjoint. In manyapplications we can simply shorten the line segments very slightly to obtaindisjoint line segments.

The sweep line algorithm for points can be adapted to the case of linesegment sites. Let S= {s1, . . . ,sn} be a set of n disjoint line segments. Wecall the segments of Ssites as before, and use the terms site endpoint and siteinterior in the following description.

Figure 7.5The beach line for a set of line segmentsites. The breakpoints trace the dashedarcs, which include the Voronoi edges

s1s2

s3s4

s5

Recall that our algorithm for point sites maintained a beach line: a piecewiseparabolic x-monotone curve such that, for points on the curve, the distance tothe closest site above the sweep line is equal to the distance to the sweep line.What does the beach line look like when the sites are segments? First we notethat a line segment site may be partially above and partially below the sweepline. When defining the beach line, we consider only those parts of the sites thatare above the sweep line. Hence, for a given position of the sweep line ℓ, thebeach line consists of those points such that the distance to the closest portionof a site above ℓ is equal to the distance to ℓ. This means that the beach linenow consists of parabolic arcs and straight line segments. A parabolic arc ariseswhen that part of the beach line is closest to a site endpoint, and a straight linesegment arises when that part of the beach line is closest to a site interior. Notethat if a site interior intersects ℓ, then the beach line will have two straight linesegments ending at the intersection—see site s2 in Figure 7.5.160

Chapter 7VORONOI DIAGRAMS

7.3 Voronoi Diagrams of Line Segments

The Voronoi diagram can also be defined for objects other than points. Thedistance from a point in the plane to an object is then measured to the closestpoint on the object. Whereas the bisector of two points is simply a line, thebisector of two disjoint line segments has a more complex shape. It consists ofup to seven parts, where each part is either a line segment or a parabolic arc.Parabolic arcs occur if the closest point of one line segment is an endpoint andthe closest point of the other line segment is in its interior. In all other cases thebisector part is straight. Although bisectors and therefore the Voronoi diagramare somewhat more complex, the number of vertices, edges, and faces in theVoronoi diagram of n disjoint line segments is still only O(n).

Assume for a moment that we allow the line segments to be non-crossing,that is, we allow them to share endpoints. Then a whole region of the plane canbe equally close to two line segments via their common endpoint, and bisectorsare not even curves anymore. To avoid the complications that arise in definingand computing Voronoi diagrams of line segments that share endpoints, wewill simply assume here that all line segments are strictly disjoint. In manyapplications we can simply shorten the line segments very slightly to obtaindisjoint line segments.

The sweep line algorithm for points can be adapted to the case of linesegment sites. Let S= {s1, . . . ,sn} be a set of n disjoint line segments. Wecall the segments of Ssites as before, and use the terms site endpoint and siteinterior in the following description.

Figure 7.5The beach line for a set of line segmentsites. The breakpoints trace the dashedarcs, which include the Voronoi edges

s1s2

s3s4

s5

Recall that our algorithm for point sites maintained a beach line: a piecewiseparabolic x-monotone curve such that, for points on the curve, the distance tothe closest site above the sweep line is equal to the distance to the sweep line.What does the beach line look like when the sites are segments? First we notethat a line segment site may be partially above and partially below the sweepline. When defining the beach line, we consider only those parts of the sites thatare above the sweep line. Hence, for a given position of the sweep line ℓ, thebeach line consists of those points such that the distance to the closest portionof a site above ℓ is equal to the distance to ℓ. This means that the beach linenow consists of parabolic arcs and straight line segments. A parabolic arc ariseswhen that part of the beach line is closest to a site endpoint, and a straight linesegment arises when that part of the beach line is closest to a site interior. Notethat if a site interior intersects ℓ, then the beach line will have two straight linesegments ending at the intersection—see site s2 in Figure 7.5.160

Result •  The number of events turns out to

be O(n) •  Theorem 7.11:

–  The Voronoi diagram of a set of n disjoint line segments can be computed in O(n log n) time using O(n) storage

•  Application: Motion planning – compute an obstacle avoiding path for a circle

–  Move along the Voronoi diagram –  Remove edges at too narrow

passages –  Do a depth-first search

•  So, the path can be computed in O(n log n) time

D7013E Computational Geometry - Håkan Jonsson 27

7.4 Furthest-point Voronoi diagrams •  The cell of a site pi consists of those

points that lie further away from pi than any other site –  The intersection of the ”other sides” of

the bisectors –  Vorfp(P)

•  Observation 7.13: –  Only sites on the convex hull of the sites

have cells •  Can be computed in O(n log n) time

–  O(n) time if the points are all in convex position

•  Bonus: We can get the convex hull in O(n) time from Vorfp(P)

Chapter 7VORONOI DIAGRAMS

Clearly, there must be at least one point on Couter, otherwise we can reduce thesize of Couter, and at least one point on Cinner, otherwise we can increase the sizeof Cinner. But one point on each bounding circle cannot give us a smallest-widthannulus yet. There appear to be three different cases, each with a total of fourpoints on the two circles (Figure 7.7):

Couter contains at least three points of P, and Cinner contains at least onepoint of P.Couter contains at least one point of P, and Cinner contains at least three pointsof P.Couter and Cinner both contain two points of P.

Figure 7.7Three cases of the smallest-width

annulus

If Cinner or Couter contains fewer points than listed in any of these cases, thenwe can always find an annulus with a smaller width. The problem of finding thesmallest-width annulus enclosing a given point set looks similar to the problemof finding the smallest disc enclosing a point set, studied in Section 4.7. Thetechnique we used for the smallest-disc problem, however, does not work forthe smallest-width annulus: the property that an added point that does not lie inthe optimal annulus so far must always lie on the boundary of the new optimalannulus does not hold.

Finding the smallest-width annulus is equivalent to finding its center point.Once the center point—let’s call it q—is fixed, the annulus is determined bythe points of P that are closest to and farthest from q. If we have the Voronoidiagram of P, then the closest point is the one in whose cell qlies. It turns outthat a similar structure exists for the farthest point, namely the farthest-pointVoronoi diagram. This divides the plane into cells in which the same pointof P is the farthest point. The farthest-point Voronoi cell of a point pi is theintersection of n−1 half-planes, just as for a standard Voronoi cell, but we takethe “other sides” of the bisectors, the sides where pi is farther away. Hence, all

pi cell of pi

p j

cell of p j

cells of the farthest-point Voronoi diagram are convex. Not every point of P hasa cell in the farthest-point Voronoi diagram: the intersections of the half-planescan be empty. It is not hard to see that for any point in the plane, its farthestpoint in the set P must be a point that lies on the convex hull of P. Therefore,a point that lies inside the convex hull cannot have a cell in the farthest-pointVoronoi diagram.

Observation 7.13 Given a set P of points in the plane, a point of P has a cell inthe farthest-point Voronoi diagram if and only if it is a vertex of the convex hullof P.164D7013E Computational Geometry - Håkan Jonsson 28

Page 8: Voronoi DiagramsVoronoi Diagrams Proximity problems Plane-sweep Fortune’s Algorithm D7013E Computational Geometry - Håkan Jonsson 2 Voronoi Diagrams 7.0 Voronoi Diagrams for points

7.4 Furthest-point Voronoi diagrams •  Application: Roundness of

manufactured goods via surface sampling

•  Measured by computing a smallest-width annulus of the sampled points P –  Using both the Vor(P) and the

Vorfp(P) •  Theorem 7.15: A smallest-

width annulus can be computed in O(n2) time using O(n) space

D7013E Computational Geometry - Håkan Jonsson 29