Contents
Other ResourcesPolygon Sponsor 
THE BOOST POLYGON VORONOI EXTENSIONSThe Voronoi extensions of the Boost Polygon library provide functionality to construct a Voronoi diagram of a set of points and linear segments in 2D space with the following set of limitations:
Fully Functional with SegmentsThere are just a few implementations of the Voronoi diagram construction algorithm that can handle input data sets that contain linear segments, even considering the commercial libraries. Support of the segments allows to discretize any input geometry (sampled floatingpoint coordinates can be scaled and snapped to the integer grid): circle, ellipse, parabola. This functionality allows to compute the medial axis transform of the arbitrary set of input geometries, with direct applications in the computer vision projects.Robustness and EfficiencyRobustness issues can be divided onto the two main categories: memory management issues and numeric stability issues. The implementation avoids the first type of the issues using pure STL data structures, thus there is no presence of the new operator in the code. The second category of the problems is resolved using the multiprecision geometric predicates. Even for the commercial libraries, usage of such predicates results in a vast performance slowdown. The library implementation overcomes this by avoiding the multiprecision computations in the 95% of the cases by using the efficient, floatingpoint based predicates. Such predicates don't produce the correct result always, however the library embeds the relative error arithmetic apparatus to identify such situations and switch to the higher precision predicates when appropriate. As the result, the implementation has a solid performance comparing to the other known libraries (more details in the benchmarks).Precision of the Output StructuresThe implementation guaranties, that the relative error of the coordinates of the output geometries is at most 64 machine epsilons (6 bits of mantissa, for the IEEE754 floatingpoint type), while on average it's slightly lower. This means, that the precision of the output geometries can be increased simply by using a floatingpoint type with the larger mantissa. The practical point of this statements is explained in the following table:
During the finalization step the implementation unites Voronoi vertices whose both coordinates are located within the relative error range equal to 128 machine epsilons and removes any Voronoi edges between those. This is the only case, that might cause differences between the algorithm output topology and theoretically precise one, and practically means the following: for a Voronoi diagram of a set of solid bodies inside the Solar System (radius 2^{42} metres) and the long double (64 bit mantissa) output coordinate type the maximum absolute error within the Solar System rectangle will be equal to 2^{64} * 2^{42} * 2^{6} = 2^{18} metres; as the result, vertices with both coordinates that are within 2^{18} metres (8 micrometres or the size of a bacteria) will be considered equal and united. Simple InterfaceThe boost/polygon/voronoi.hpp library header defines the following static functions to integrate the Voronoi extensions functionality with the Boost.Polygon interfaces:
The following two lines of code construct a Voronoi diagram of a set of points (as long as the corresponding input geometry type satisfies the Boost.Polygon concept model): voronoi_diagram<double> vd; construct_voronoi(points.begin(), points.end(), &vd); The library provides the clear interfaces to associate the user data with the output geometries and efficiently traverse the Voronoi graph. More details on those topics are covered in the basic Voronoi tutorial. Advanced usage of the library with the configuration of the coordinate types is explained in the advanced Voronoi tutorial. The library allows users to implement their own Voronoi diagram / Delaunay triangulation construction routines based on the Voronoi builder API. No Third Party DependenciesThe Voronoi extensions of the Boost Polygon library doesn't depend on any 3rd party code and contains single dependency on the Boost libraries: boost/cstdint.hpp. All the required multiprecision types and related functionality are encapsulated as part of the implementation. The library is fast to compile (3 public and 4 private heades), has strong cohesion between its components and is clearly modularized from the rest of the Boost Polygon library, with the optional integration through the voronoi.hpp header.Extensible for the User Provided Coordinate TypesThe implementation is coordinate type agnostic. As long as the user provided types satisfy the set of the requirements of the Voronoi builder coordinate type traits, no additional changes are required neither to the algorithm, nor to the implementation of the predicates. For example, it's possible to construct the Voronoi diagram with the 256bit integer input coordinate type and 512bit output floatingpoint type without making any changes to the library.Future DevelopmentBelow one may find the list of the possible directions for the future development of the library.
Theoretical ResearchThe Voronoi extensions were developed as part of the Google Summer of Code 2010. The library was actively maintained for the last three years and involved deep mathematical research in the field of algorithms, data structures, relative error arithmetic and numerical robustness. Upon the community request, more details on the theoretical aspects of the implementation will be published. The authors would like to acknowledge the Steven Fortune's article "A Sweepline algorithm for Voronoi diagrams", that covers fundamental ideas of the current implementation. 

