123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- #ifndef BOOST_POLYGON_VORONOI
- #define BOOST_POLYGON_VORONOI
- #include "isotropy.hpp"
- #include "point_concept.hpp"
- #include "segment_concept.hpp"
- #include "voronoi_builder.hpp"
- #include "voronoi_diagram.hpp"
- namespace boost {
- namespace polygon {
- template <typename Point, typename VB>
- typename enable_if<
- typename gtl_if<
- typename is_point_concept<
- typename geometry_concept<Point>::type
- >::type
- >::type,
- std::size_t
- >::type insert(const Point& point, VB* vb) {
- return vb->insert_point(x(point), y(point));
- }
- template <typename PointIterator, typename VB>
- typename enable_if<
- typename gtl_if<
- typename is_point_concept<
- typename geometry_concept<
- typename std::iterator_traits<PointIterator>::value_type
- >::type
- >::type
- >::type,
- void
- >::type insert(const PointIterator first, const PointIterator last, VB* vb) {
- for (PointIterator it = first; it != last; ++it) {
- insert(*it, vb);
- }
- }
- template <typename Segment, typename VB>
- typename enable_if<
- typename gtl_if<
- typename is_segment_concept<
- typename geometry_concept<Segment>::type
- >::type
- >::type,
- std::size_t
- >::type insert(const Segment& segment, VB* vb) {
- return vb->insert_segment(
- x(low(segment)), y(low(segment)),
- x(high(segment)), y(high(segment)));
- }
- template <typename SegmentIterator, typename VB>
- typename enable_if<
- typename gtl_if<
- typename is_segment_concept<
- typename geometry_concept<
- typename std::iterator_traits<SegmentIterator>::value_type
- >::type
- >::type
- >::type,
- void
- >::type insert(const SegmentIterator first,
- const SegmentIterator last,
- VB* vb) {
- for (SegmentIterator it = first; it != last; ++it) {
- insert(*it, vb);
- }
- }
- template <typename PointIterator, typename VD>
- typename enable_if<
- typename gtl_if<
- typename is_point_concept<
- typename geometry_concept<
- typename std::iterator_traits<PointIterator>::value_type
- >::type
- >::type
- >::type,
- void
- >::type construct_voronoi(const PointIterator first,
- const PointIterator last,
- VD* vd) {
- default_voronoi_builder builder;
- insert(first, last, &builder);
- builder.construct(vd);
- }
- template <typename SegmentIterator, typename VD>
- typename enable_if<
- typename gtl_if<
- typename is_segment_concept<
- typename geometry_concept<
- typename std::iterator_traits<SegmentIterator>::value_type
- >::type
- >::type
- >::type,
- void
- >::type construct_voronoi(const SegmentIterator first,
- const SegmentIterator last,
- VD* vd) {
- default_voronoi_builder builder;
- insert(first, last, &builder);
- builder.construct(vd);
- }
- template <typename PointIterator, typename SegmentIterator, typename VD>
- typename enable_if<
- typename gtl_and<
- typename gtl_if<
- typename is_point_concept<
- typename geometry_concept<
- typename std::iterator_traits<PointIterator>::value_type
- >::type
- >::type
- >::type,
- typename gtl_if<
- typename is_segment_concept<
- typename geometry_concept<
- typename std::iterator_traits<SegmentIterator>::value_type
- >::type
- >::type
- >::type
- >::type,
- void
- >::type construct_voronoi(const PointIterator p_first,
- const PointIterator p_last,
- const SegmentIterator s_first,
- const SegmentIterator s_last,
- VD* vd) {
- default_voronoi_builder builder;
- insert(p_first, p_last, &builder);
- insert(s_first, s_last, &builder);
- builder.construct(vd);
- }
- }
- }
- #endif
|