|
|
Line 1: |
Line 1: |
| [[Image:Fortunes-algorithm.gif|frame|right|Fortune's algorithm animation]]
| | Wilber Berryhill is what his spouse loves to call him and he totally enjoys this name. My day occupation is a travel agent. To perform lacross is some thing I truly appreciate doing. For many years she's been residing in Kentucky but her husband wants them to move.<br><br>Take a look at my homepage; psychic phone ([http://www.edmposts.com/build-a-beautiful-organic-garden-using-these-ideas/ click the up coming web page]) |
| '''Fortune's algorithm''' is a [[sweep line algorithm]] for generating a [[Voronoi diagram]] from a set of points in a plane using [[Big O notation|O]](''n'' log ''n'') time and O(''n'') space.<ref name="Mark2000">{{Citation|author = [[Mark de Berg]], [[Marc van Kreveld]], [[Mark Overmars]], and [[Otfried Schwarzkopf]] | year = 2000 | title = Computational Geometry | publisher = [[Springer-Verlag]] | edition = 2nd revised | isbn = 3-540-65620-0}} Section 7.2: Computing the Voronoi Diagram: pp.151–160.</ref><ref>{{citation|title=Voronoi Diagrams and a Day at the Beach|url=http://www.ams.org/featurecolumn/archive/voronoi.html|first=David|last=Austin|publisher=[[American Mathematical Society]]|series=Feature Column}}.</ref> It was originally published by [[Steven Fortune]] in 1986 in his paper "A sweepline algorithm for Voronoi diagrams."<ref>Steven Fortune. A sweepline algorithm for Voronoi diagrams. ''Proceedings of the second annual symposium on Computational geometry''. Yorktown Heights, New York, United States, pp.313–322. 1986. ISBN 0-89791-194-6. [http://portal.acm.org/citation.cfm?id=10549 ACM Digital Library][http://www.springerlink.com/content/n88186tl165168rw/ SpringerLink]</ref>
| |
| | |
| == 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 line, but a complex curve to the left of the sweep line, composed of pieces of [[parabola]]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.
| |
| | |
| The algorithm maintains as data structures a [[binary search tree]] describing the combinatorial structure of the beach line, and a [[priority queue]] 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]] description of the algorithm.<ref>{{citation|title=An Efficient Implementation of Fortune's Plane-Sweep Algorithm for Voronoi Diagrams|url=http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.83.5571|author = [[Kenny Wong]], [[Hausi A. Müller]]}}.</ref>
| |
| | |
| let <math>*(z)</math> be the transformation <math>*(z)=(z_x,z_y+d(z))</math>,
| |
| where <math>d(z)</math> is the Euclidean distance between <math>z</math> and the nearest site
| |
| let <math>T</math> be the "beach line"
| |
| let <math>R_p</math> be the region covered by site <math>p</math>.
| |
| let <math>C_{pq}</math> be the boundary ray between sites <math>p</math> and <math>q</math>.
| |
| let <math>p_1,p_2,...,p_m</math> be the sites with minimal <math>y</math>-coordinate, ordered by <math>x</math>-coordinate
| |
| <math>Q \gets S - {p_1,p_2,...,p_m}</math>
| |
| create initial vertical boundary rays <math>C_{p_1,p_2}^0,C_{p_2,p_3}^0,...C_{p_{m-1},p_m}^0</math>
| |
| <math>T \gets *(R_{p_1}),C_{p_1,p_2}^0,*(R_{p_2}),C_{p_2,p_3}^0,...,*(R_{p_{m-1}}),C_{p_{m-1},p_m}^0,*(R_{p_m})</math>
| |
| '''while not''' IsEmpty(<math>Q</math>) '''do'''
| |
| <math>p</math> ← DeleteMin(<math>Q</math>)
| |
| '''case''' <math>p</math> of
| |
| <math>p</math> is a site in <math>*(V)</math>:
| |
| find the occurrence of a region <math>*(R_q)</math> in <math>T</math> containing <math>p</math>,
| |
| bracketed by <math>C_{rq}</math> on the left and <math>C_{qs}</math> on the right
| |
| create new boundary rays <math>C_{pq}^-</math> and <math>C_{pq}^+</math> with bases <math>p</math>
| |
| replace <math>*(R_q)</math> with <math>*(R_q),C_{pq}^-,*(R_p),C_{pq}^+,*(R_q)</math> in <math>T</math>
| |
| delete from <math>Q</math> any intersection between <math>C_{rq}</math> and <math>C_{qs}</math>
| |
| insert into <math>Q</math> any intersection between <math>C_{rq}</math> and <math>C_{pq}^-</math>
| |
| insert into <math>Q</math> any intersection between <math>C_{pq}^+</math> and <math>C_{qs}</math>
| |
| <math>p</math> is a Voronoi vertex in <math>*(V)</math>:
| |
| let <math>p</math> be the intersection of <math>C_{qr}</math> on the left and <math>C_{rs}</math> on the right
| |
| let <math>C_{uq}</math> be the left neighbor of <math>C_{qr}</math> and
| |
| let <math>C_{sv}</math> be the right neighbor of <math>C_{rs}</math> in <math>T</math>
| |
| create a new boundary ray <math>C_{qs}^0</math> if <math>q_y = s_y</math>,
| |
| or create <math>C_{qs}^+</math> if <math>p</math> is right of the higher of <math>q</math> and <math>s</math>,
| |
| otherwise create <math>C_{qs}^-</math>
| |
| replace <math>C_{qr},*(R_r),C_{rs}</math> with newly created <math>C_{qs}</math> in <math>T</math>
| |
| delete from <math>Q</math> any intersection between <math>C_{uq}</math> and <math>C_{qr}</math>
| |
| delete from <math>Q</math> any intersection between <math>C_{rs}</math> and <math>C_{sv}</math>
| |
| insert into <math>Q</math> any intersection between <math>C_{uq}</math> and <math>C_{qs}</math>
| |
| insert into <math>Q</math> any intersection between <math>C_{qs}</math> and <math>C_{sv}</math>
| |
| record <math>p</math> as the summit of <math>C_{qr}</math> and <math>C_{rs}</math> and the base of <math>C_{qs}</math>
| |
| output the boundary segments <math>C_{qr}</math> and <math>C_{rs}</math>
| |
| '''endcase'''
| |
| '''endwhile'''
| |
| output the remaining boundary rays in <math>T</math>
| |
| | |
| ==Weighted sites and disks==
| |
| As Fortune describes in <ref name="Mark2000" /> a modified version of the sweepline 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]]s. In an additively weighted Voronoi diagram, the bisector between sites is in general a hyperbola, in contrast to unweighted Voronoi diagrams and [[power diagram]]s of disks for which it is a straight line.
| |
| | |
| ==References==
| |
| {{reflist}}
| |
| | |
| ==External links==
| |
| * [http://ect.bell-labs.com/who/sjf/voronoi.tar Steven Fortune's C implementation]
| |
| * [http://skynet.ie/~sos/mapviewer/voronoi.php Fortune's Voronoi algorithm implemented in C++]
| |
| * [http://www.codeproject.com/KB/recipes/fortunevoronoi.aspx Fortune's Voronoi algorithm implemented in C#]
| |
| * [https://github.com/gorhill/Javascript-Voronoi Fortune's algorithm implemented in JavaScript]
| |
| | |
| [[Category:Computational geometry]]
| |
| [[Category:Articles with example pseudocode]]
| |
Wilber Berryhill is what his spouse loves to call him and he totally enjoys this name. My day occupation is a travel agent. To perform lacross is some thing I truly appreciate doing. For many years she's been residing in Kentucky but her husband wants them to move.
Take a look at my homepage; psychic phone (click the up coming web page)