请输入您要查询的百科知识:

 

词条 Fortune's algorithm
释义

  1. Algorithm description

     Pseudocode 

  2. Weighted sites and disks

  3. References

  4. External links

Fortune's algorithm is a sweep line algorithm for generating a Voronoi diagram from a set of points in a plane using O(n log n) time and O(n) space.[1][2] It was originally published by Steven Fortune in 1986 in his paper "A sweepline algorithm for Voronoi diagrams."[3]

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 curve to the left of the sweep line, composed of pieces of parabolas; 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 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.[4]
 let {{nowrap|}} be the transformation {{nowrap|}},   where {{nowrap|}} is the Euclidean distance between {{mvar|z}} and the nearest site let {{mvar|T}} be the "beach line" let {{nowrap|}} be the region covered by site {{mvar|p}}. let {{nowrap|}} be the boundary ray between sites {{mvar|p}} and {{mvar|q}}. let {{nowrap|}} be the sites with minimal {{mvar|y}}-coordinate, ordered by {{mvar|x}}-coordinate {{nowrap|}} create initial vertical boundary rays {{nowrap|}} {{nowrap|}} '''while not''' IsEmpty({{mvar|Q}}) '''do'''     {{mvar|p}} ← DeleteMin({{mvar|Q}})     '''case''' {{mvar|p}} of     {{mvar|p}} is a site in {{nowrap|}}:         find the occurrence of a region {{nowrap|}} in {{mvar|T}} containing {{mvar|p}},           bracketed by {{nowrap|}} on the left and {{nowrap|}} on the right         create new boundary rays {{nowrap|}} and {{nowrap|}} with bases {{mvar|p}}         replace {{nowrap|}} with {{nowrap|}} in {{mvar|T}}         delete from {{mvar|Q}} any intersection between {{nowrap|}} and {{nowrap|}}         insert into {{mvar|Q}} any intersection between {{nowrap|}} and {{nowrap|}}         insert into {{mvar|Q}} any intersection between {{nowrap|}} and {{nowrap|}}     {{mvar|p}} is a Voronoi vertex in {{nowrap|}}:         let {{mvar|p}} be the intersection of {{nowrap|}} on the left and {{nowrap|}} on the right         let {{nowrap|}} be the left neighbor of {{nowrap|}} and           let {{nowrap|}} be the right neighbor of {{nowrap|}} in {{mvar|T}}         create a new boundary ray {{nowrap|}} if {{nowrap|}},           or create {{nowrap|}} if {{mvar|p}} is right of the higher of {{mvar|q}} and {{mvar|s}},           otherwise create {{nowrap|}}         replace {{nowrap|}} with newly created {{nowrap|}} in {{mvar|T}}         delete from {{mvar|Q}} any intersection between {{nowrap|}} and {{nowrap|}}         delete from {{mvar|Q}} any intersection between {{nowrap|}} and {{nowrap|}}         insert into {{mvar|Q}} any intersection between {{nowrap|}} and {{nowrap|}}         insert into {{mvar|Q}} any intersection between {{nowrap|}} and {{nowrap|}}         record {{mvar|p}} as the summit of {{nowrap|}} and {{nowrap|}} and the base of {{nowrap|}}         output the boundary segments {{nowrap|}} and {{nowrap|}}     '''endcase''' '''endwhile''' output the remaining boundary rays in {{mvar|T}}

Weighted sites and disks

As Fortune describes in ref. [1], 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 treemaps. 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

1. ^{{Citation|author1-link = Mark de Berg|first1=Mark|last1=de Berg|author2-link=Marc van Kreveld|first2=Marc|last2=van Kreveld|author3-link=Mark Overmars|first3=Mark|last3=Overmars|author-link4=Otfried Schwarzkopf|first4=Otfried|last4=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.
2. ^{{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}}.
3. ^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}}. ACM Digital LibrarySpringerLink
4. ^{{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}}.

External links

  • Steven Fortune's C implementation
  • Fortune's Voronoi algorithm implemented in C++
  • [https://github.com/gorhill/Javascript-Voronoi Fortune's algorithm implemented in JavaScript]

2 : Computational geometry|Articles with example pseudocode

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/13 22:55:52