HOME

TheInfoList



OR:

Fortune's algorithm is a
sweep line algorithm In computational geometry, a sweep line algorithm or plane sweep algorithm is an algorithmic paradigm that uses a conceptual ''sweep line'' or ''sweep surface'' to solve various problems in Euclidean space. It is one of the key techniques in comp ...
for generating a
Voronoi diagram In mathematics, a Voronoi diagram is a partition of a plane into regions close to each of a given set of objects. In the simplest case, these objects are just finitely many points in the plane (called seeds, sites, or generators). For each seed ...
from a set of points in a plane using O(''n'' log ''n'') time and O(''n'') space. Section 7.2: Computing the Voronoi Diagram: pp.151–160. It was originally published by
Steven Fortune Stephen or Steven is a common English first name. It is particularly significant to Christians, as it belonged to Saint Stephen ( grc-gre, Στέφανος ), an early disciple and deacon who, according to the Book of Acts, was stoned to death; h ...
in 1986 in his paper "A sweepline algorithm for Voronoi diagrams."


Algorithm description

The algorithm maintains both a sweep line and a ''beach line'', which both move through the plane as the algorithm progresses. The sweep line is a straight line, which we may by convention assume to be vertical and moving left to right across the plane. At any time during the algorithm, the input points left of the sweep line will have been incorporated into the Voronoi diagram, while the points right of the sweep line will not have been considered yet. The beach line is not a straight line, but a complicated,
piecewise In mathematics, a piecewise-defined function (also called a piecewise function, a hybrid function, or definition by cases) is a function defined by multiple sub-functions, where each sub-function applies to a different interval in the domain. P ...
curve to the left of the sweep line, composed of pieces of
parabola In mathematics, a parabola is a plane curve which is mirror-symmetrical and is approximately U-shaped. It fits several superficially different mathematical descriptions, which can all be proved to define exactly the same curves. One descri ...
s; it divides the portion of the plane within which the Voronoi diagram can be known, regardless of what other points might be right of the sweep line, from the rest of the plane. For each point left of the sweep line, one can define a parabola of points equidistant from that point and from the sweep line; the beach line is the boundary of the union of these parabolas. As the sweep line progresses, the vertices of the beach line, at which two parabolas cross, trace out the edges of the Voronoi diagram. The beach line progresses by keeping each parabola base exactly half way between the points initially swept over with the sweep line, and the new position of the sweep line. Mathematically, this means each parabola is formed by using the sweep line as the directrix and the input point as the focus. The algorithm maintains as data structures a
binary search tree In computer science, a binary search tree (BST), also called an ordered or sorted binary tree, is a rooted binary tree data structure with the key of each internal node being greater than all the keys in the respective node's left subtree and ...
describing the combinatorial structure of the beach line, and a
priority queue In computer science, a priority queue is an abstract data-type similar to a regular queue or stack data structure in which each element additionally has a ''priority'' associated with it. In a priority queue, an element with high priority is se ...
listing potential future events that could change the beach line structure. These events include the addition of another parabola to the beach line (when the sweep line crosses another input point) and the removal of a curve from the beach line (when the sweep line becomes tangent to a circle through some three input points whose parabolas form consecutive segments of the beach line). Each such event may be prioritized by the ''x''-coordinate of the sweep line at the point the event occurs. The algorithm itself then consists of repeatedly removing the next event from the priority queue, finding the changes the event causes in the beach line, and updating the data structures. As there are O(''n'') events to process (each being associated with some feature of the Voronoi diagram) and O(log ''n'') time to process an event (each consisting of a constant number of binary search tree and priority queue operations) the total time is O(''n'' log ''n'').


Pseudocode

Pseudocode In computer science, pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine re ...
description of the algorithm.. let be the transformation , where is the Euclidean distance between and the nearest site let be the "beach line" let be the region covered by site . let be the boundary ray between sites and . let be a set of sites on which this algorithm is to be applied. let be the sites extracted from S with minimal -coordinate, ordered by -coordinate let DeleteMin() be the act of removing the lowest and leftmost site of X (sort by y unless they're identical, in which case sort by x) let V be the Voronoi map of S which is to be constructed by this algorithm create initial vertical boundary rays while not IsEmpty() do ← DeleteMin() case of is a site in : find the occurrence of a region in containing , bracketed by on the left and on the right create new boundary rays and with bases replace with in delete from any intersection between and insert into any intersection between and insert into any intersection between and is a Voronoi vertex in : let be the intersection of on the left and on the right let be the left neighbor of and let be the right neighbor of in create a new boundary ray if , or create if is right of the higher of and , otherwise create replace with newly created in delete from any intersection between and delete from any intersection between and insert into any intersection between and insert into any intersection between and record as the summit of and and the base of output the boundary segments and endcase endwhile output the remaining boundary rays in


Weighted sites and disks

As Fortune describes in ref., a modified version of the sweep line algorithm can be used to construct an additively weighted Voronoi diagram, in which the distance to each site is offset by the weight of the site; this may equivalently be viewed as a Voronoi diagram of a set of disks, centered at the sites with radius equal to the weight of the site. Weighted sites may be used to control the areas of the Voronoi cells when using Voronoi diagrams to construct
treemap In information visualization and computing, treemapping is a method for displaying hierarchical data using nested figures, usually rectangles. Treemaps display hierarchical ( tree-structured) data as a set of nested rectangles. Each branch of ...
s. In an additively weighted Voronoi diagram, the bisector between sites is in general a hyperbola, in contrast to unweighted Voronoi diagrams and power diagrams of disks for which it is a straight line.


References

{{reflist


External links


Steven Fortune's C implementation

Fortune's Voronoi algorithm implemented in C++

Fortune's algorithm implemented in JavaScript
Computational geometry Articles with example pseudocode