#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 Vec2d /////////////////////////////////////////////////////////////////// template<> struct tag { using type = point_tag; }; template<> struct coordinate_type { using type = double; }; template<> struct coordinate_system { using type = cs::cartesian; }; template<> struct dimension: boost::mpl::int_<2> {}; template struct access { static inline double get(Slic3r::Vec2d const& a) { return a(d); } static inline void set(Slic3r::Vec2d& a, double const& value) { a(d) = value; } }; // For Vec3d /////////////////////////////////////////////////////////////////// template<> struct tag { using type = point_tag; }; template<> struct coordinate_type { using type = double; }; template<> struct coordinate_system { using type = cs::cartesian; }; template<> struct dimension: boost::mpl::int_<3> {}; template struct access { static inline double get(Slic3r::Vec3d const& a) { return a(d); } static inline void set(Slic3r::Vec3d& a, double 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<> struct range_value> { using type = Slic3r::Vec2d; }; } #endif // SLABOOSTADAPTER_HPP