annotate DEPENDENCIES/generic/include/boost/polygon/voronoi.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Polygon library voronoi.hpp header file
Chris@16 2
Chris@16 3 // Copyright Andrii Sydorchuk 2010-2012.
Chris@16 4 // Distributed under the Boost Software License, Version 1.0.
Chris@16 5 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7
Chris@16 8 // See http://www.boost.org for updates, documentation, and revision history.
Chris@16 9
Chris@16 10 #ifndef BOOST_POLYGON_VORONOI
Chris@16 11 #define BOOST_POLYGON_VORONOI
Chris@16 12
Chris@16 13 #include "isotropy.hpp"
Chris@16 14 #include "point_concept.hpp"
Chris@16 15 #include "segment_concept.hpp"
Chris@16 16
Chris@16 17 #include "voronoi_builder.hpp"
Chris@16 18 #include "voronoi_diagram.hpp"
Chris@16 19
Chris@16 20 // Public methods to compute Voronoi diagram of a set of points and segments.
Chris@16 21 // Coordinates of the points and of the endpoints of the segments should belong
Chris@16 22 // to the 32-bit signed integer range [-2^31, 2^31-1]. To use wider input
Chris@16 23 // coordinate range voronoi_builder configuration via coordinate type traits
Chris@16 24 // is required.
Chris@16 25 // Complexity - O(N*logN), memory usage - O(N), N - number of input objects.
Chris@16 26 namespace boost {
Chris@16 27 namespace polygon {
Chris@16 28
Chris@16 29 template <typename Point, typename VB>
Chris@16 30 typename enable_if<
Chris@16 31 typename gtl_if<
Chris@16 32 typename is_point_concept<
Chris@16 33 typename geometry_concept<Point>::type
Chris@16 34 >::type
Chris@16 35 >::type,
Chris@16 36 std::size_t
Chris@16 37 >::type insert(const Point& point, VB* vb) {
Chris@16 38 return vb->insert_point(x(point), y(point));
Chris@16 39 }
Chris@16 40
Chris@16 41 template <typename PointIterator, typename VB>
Chris@16 42 typename enable_if<
Chris@16 43 typename gtl_if<
Chris@16 44 typename is_point_concept<
Chris@16 45 typename geometry_concept<
Chris@16 46 typename std::iterator_traits<PointIterator>::value_type
Chris@16 47 >::type
Chris@16 48 >::type
Chris@16 49 >::type,
Chris@16 50 void
Chris@16 51 >::type insert(const PointIterator first, const PointIterator last, VB* vb) {
Chris@16 52 for (PointIterator it = first; it != last; ++it) {
Chris@16 53 insert(*it, vb);
Chris@16 54 }
Chris@16 55 }
Chris@16 56
Chris@16 57 template <typename Segment, typename VB>
Chris@16 58 typename enable_if<
Chris@16 59 typename gtl_if<
Chris@16 60 typename is_segment_concept<
Chris@16 61 typename geometry_concept<Segment>::type
Chris@16 62 >::type
Chris@16 63 >::type,
Chris@16 64 std::size_t
Chris@16 65 >::type insert(const Segment& segment, VB* vb) {
Chris@16 66 return vb->insert_segment(
Chris@16 67 x(low(segment)), y(low(segment)),
Chris@16 68 x(high(segment)), y(high(segment)));
Chris@16 69 }
Chris@16 70
Chris@16 71 template <typename SegmentIterator, typename VB>
Chris@16 72 typename enable_if<
Chris@16 73 typename gtl_if<
Chris@16 74 typename is_segment_concept<
Chris@16 75 typename geometry_concept<
Chris@16 76 typename std::iterator_traits<SegmentIterator>::value_type
Chris@16 77 >::type
Chris@16 78 >::type
Chris@16 79 >::type,
Chris@16 80 void
Chris@16 81 >::type insert(const SegmentIterator first,
Chris@16 82 const SegmentIterator last,
Chris@16 83 VB* vb) {
Chris@16 84 for (SegmentIterator it = first; it != last; ++it) {
Chris@16 85 insert(*it, vb);
Chris@16 86 }
Chris@16 87 }
Chris@16 88
Chris@16 89 template <typename PointIterator, typename VD>
Chris@16 90 typename enable_if<
Chris@16 91 typename gtl_if<
Chris@16 92 typename is_point_concept<
Chris@16 93 typename geometry_concept<
Chris@16 94 typename std::iterator_traits<PointIterator>::value_type
Chris@16 95 >::type
Chris@16 96 >::type
Chris@16 97 >::type,
Chris@16 98 void
Chris@16 99 >::type construct_voronoi(const PointIterator first,
Chris@16 100 const PointIterator last,
Chris@16 101 VD* vd) {
Chris@16 102 default_voronoi_builder builder;
Chris@16 103 insert(first, last, &builder);
Chris@16 104 builder.construct(vd);
Chris@16 105 }
Chris@16 106
Chris@16 107 template <typename SegmentIterator, typename VD>
Chris@16 108 typename enable_if<
Chris@16 109 typename gtl_if<
Chris@16 110 typename is_segment_concept<
Chris@16 111 typename geometry_concept<
Chris@16 112 typename std::iterator_traits<SegmentIterator>::value_type
Chris@16 113 >::type
Chris@16 114 >::type
Chris@16 115 >::type,
Chris@16 116 void
Chris@16 117 >::type construct_voronoi(const SegmentIterator first,
Chris@16 118 const SegmentIterator last,
Chris@16 119 VD* vd) {
Chris@16 120 default_voronoi_builder builder;
Chris@16 121 insert(first, last, &builder);
Chris@16 122 builder.construct(vd);
Chris@16 123 }
Chris@16 124
Chris@16 125 template <typename PointIterator, typename SegmentIterator, typename VD>
Chris@16 126 typename enable_if<
Chris@16 127 typename gtl_and<
Chris@16 128 typename gtl_if<
Chris@16 129 typename is_point_concept<
Chris@16 130 typename geometry_concept<
Chris@16 131 typename std::iterator_traits<PointIterator>::value_type
Chris@16 132 >::type
Chris@16 133 >::type
Chris@16 134 >::type,
Chris@16 135 typename gtl_if<
Chris@16 136 typename is_segment_concept<
Chris@16 137 typename geometry_concept<
Chris@16 138 typename std::iterator_traits<SegmentIterator>::value_type
Chris@16 139 >::type
Chris@16 140 >::type
Chris@16 141 >::type
Chris@16 142 >::type,
Chris@16 143 void
Chris@16 144 >::type construct_voronoi(const PointIterator p_first,
Chris@16 145 const PointIterator p_last,
Chris@16 146 const SegmentIterator s_first,
Chris@16 147 const SegmentIterator s_last,
Chris@16 148 VD* vd) {
Chris@16 149 default_voronoi_builder builder;
Chris@16 150 insert(p_first, p_last, &builder);
Chris@16 151 insert(s_first, s_last, &builder);
Chris@16 152 builder.construct(vd);
Chris@16 153 }
Chris@16 154 } // polygon
Chris@16 155 } // boost
Chris@16 156
Chris@16 157 #endif // BOOST_POLYGON_VORONOI