#include #include #include struct point { double x; double y; }; using ring = std::vector; using polygon = std::vector; namespace boost { namespace geometry { namespace traits { template <> struct tag { using type = point_tag; }; template <> struct coordinate_type { using type = double; }; template <> struct coordinate_system { using type = boost::geometry::cs::cartesian; }; template <> struct dimension : boost::mpl::int_<2> { }; template <> struct access { static double get(point const& p) { return p.x; } static void set(point& p, double x) { p.x = x; } }; template <> struct access { static double get(point const& p) { return p.y; } static void set(point& p, double y) { p.y = y; } }; template <> struct tag { using type = ring_tag; }; template <> struct tag { using type = polygon_tag; }; template <> struct ring_mutable_type { using type = ring&; }; template <> struct ring_const_type { using type = ring const&; }; template <> struct interior_mutable_type { using type = boost::iterator_range; }; template <> struct interior_const_type { using type = boost::iterator_range; }; template <> struct exterior_ring { static auto& get(polygon& p) { return p.at(0); } static auto const& get(polygon const& p) { return p.at(0); } }; template <> struct interior_rings { static auto get(polygon& p) { return boost::make_iterator_range(p.begin() + 1, p.end()); } static auto get(polygon const& p) { return boost::make_iterator_range(p.begin() + 1, p.end()); } }; } } } void testBoost() { polygon a; polygon b; std::vector result; boost::geometry::intersection(a, b, result); }