#ifndef SLA_BOOSTADAPTER_HPP #define SLA_BOOSTADAPTER_HPP #include #include #include namespace boost { namespace geometry { namespace traits { /* ************************************************************************** */ /* Point concept adaptation ************************************************* */ /* ************************************************************************** */ template<> struct tag { using type = point_tag; }; template<> struct coordinate_type { using type = coord_t; }; template<> struct coordinate_system { using type = cs::cartesian; }; template<> struct dimension: boost::mpl::int_<2> {}; template struct access { static inline coord_t get(Slic3r::Point const& a) { return a(d); } static inline void set(Slic3r::Point& a, coord_t const& value) { a(d) = value; } }; // For Vec /////////////////////////////////////////////////////////////// template struct tag> { using type = point_tag; }; template struct coordinate_type> { using type = T; }; template struct coordinate_system> { using type = cs::cartesian; }; template struct dimension>: boost::mpl::int_ {}; template struct access, d> { static inline T get(Slic3r::Vec const& a) { return a(d); } static inline void set(Slic3r::Vec& a, T const& value) { a(d) = value; } }; /* ************************************************************************** */ /* Box concept adaptation *************************************************** */ /* ************************************************************************** */ template<> struct tag { using type = box_tag; }; template<> struct point_type { using type = Slic3r::Point; }; template struct indexed_access { static inline coord_t get(Slic3r::BoundingBox const& box) { return box.min(d); } static inline void set(Slic3r::BoundingBox &box, coord_t const& coord) { box.min(d) = coord; } }; template struct indexed_access { static inline coord_t get(Slic3r::BoundingBox const& box) { return box.max(d); } static inline void set(Slic3r::BoundingBox &box, coord_t const& coord) { box.max(d) = coord; } }; template using BB3 = Slic3r::BoundingBox3Base>; template struct tag> { using type = box_tag; }; template struct point_type> { using type = Slic3r::Vec<3, T>; }; template struct indexed_access, 0, d> { static inline coord_t get(BB3 const& box) { return box.min(d); } static inline void set(BB3 &box, coord_t const& coord) { box.min(d) = coord; } }; template struct indexed_access, 1, d> { static inline coord_t get(BB3 const& box) { return box.max(d); } static inline void set(BB3 &box, coord_t const& coord) { box.max(d) = coord; } }; } } template<> struct range_value> { using type = Slic3r::Vec2d; }; } // namespace boost #endif // SLABOOSTADAPTER_HPP