mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
Merge prusa 2.6.1
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <libslic3r/Point.hpp>
|
||||
#include <libslic3r/BoundingBox.hpp>
|
||||
#include <libslic3r/ExPolygon.hpp>
|
||||
#include <libslic3r/Polyline.hpp>
|
||||
|
||||
#include <boost/geometry.hpp>
|
||||
|
||||
@@ -126,13 +128,146 @@ struct indexed_access<BB3<T>, 1, d> {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Segment concept adaptaion ************************************************ */
|
||||
/* ************************************************************************** */
|
||||
|
||||
template<> struct tag<Slic3r::Line> {
|
||||
using type = segment_tag;
|
||||
};
|
||||
|
||||
template<> struct point_type<Slic3r::Line> {
|
||||
using type = Slic3r::Point;
|
||||
};
|
||||
|
||||
template<> struct indexed_access<Slic3r::Line, 0, 0> {
|
||||
static inline coord_t get(Slic3r::Line const& l) { return l.a.x(); }
|
||||
static inline void set(Slic3r::Line &l, coord_t c) { l.a.x() = c; }
|
||||
};
|
||||
|
||||
template<> struct indexed_access<Slic3r::Line, 0, 1> {
|
||||
static inline coord_t get(Slic3r::Line const& l) { return l.a.y(); }
|
||||
static inline void set(Slic3r::Line &l, coord_t c) { l.a.y() = c; }
|
||||
};
|
||||
|
||||
template<> struct indexed_access<Slic3r::Line, 1, 0> {
|
||||
static inline coord_t get(Slic3r::Line const& l) { return l.b.x(); }
|
||||
static inline void set(Slic3r::Line &l, coord_t c) { l.b.x() = c; }
|
||||
};
|
||||
|
||||
template<> struct indexed_access<Slic3r::Line, 1, 1> {
|
||||
static inline coord_t get(Slic3r::Line const& l) { return l.b.y(); }
|
||||
static inline void set(Slic3r::Line &l, coord_t c) { l.b.y() = c; }
|
||||
};
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Polyline concept adaptation ********************************************** */
|
||||
/* ************************************************************************** */
|
||||
|
||||
template<> struct tag<Slic3r::Polyline> {
|
||||
using type = linestring_tag;
|
||||
};
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Polygon concept adaptation *********************************************** */
|
||||
/* ************************************************************************** */
|
||||
|
||||
// Ring implementation /////////////////////////////////////////////////////////
|
||||
|
||||
// Boost would refer to ClipperLib::Path (alias Slic3r::ExPolygon) as a ring
|
||||
template<> struct tag<Slic3r::Polygon> {
|
||||
using type = ring_tag;
|
||||
};
|
||||
|
||||
template<> struct point_order<Slic3r::Polygon> {
|
||||
static const order_selector value = counterclockwise;
|
||||
};
|
||||
|
||||
// All our Paths should be closed for the bin packing application
|
||||
template<> struct closure<Slic3r::Polygon> {
|
||||
static const constexpr closure_selector value = closure_selector::open;
|
||||
};
|
||||
|
||||
// Polygon implementation //////////////////////////////////////////////////////
|
||||
|
||||
template<> struct tag<Slic3r::ExPolygon> {
|
||||
using type = polygon_tag;
|
||||
};
|
||||
|
||||
template<> struct exterior_ring<Slic3r::ExPolygon> {
|
||||
static inline Slic3r::Polygon& get(Slic3r::ExPolygon& p)
|
||||
{
|
||||
return p.contour;
|
||||
}
|
||||
static inline Slic3r::Polygon const& get(Slic3r::ExPolygon const& p)
|
||||
{
|
||||
return p.contour;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct ring_const_type<Slic3r::ExPolygon> {
|
||||
using type = const Slic3r::Polygon&;
|
||||
};
|
||||
|
||||
template<> struct ring_mutable_type<Slic3r::ExPolygon> {
|
||||
using type = Slic3r::Polygon&;
|
||||
};
|
||||
|
||||
template<> struct interior_const_type<Slic3r::ExPolygon> {
|
||||
using type = const Slic3r::Polygons&;
|
||||
};
|
||||
|
||||
template<> struct interior_mutable_type<Slic3r::ExPolygon> {
|
||||
using type = Slic3r::Polygons&;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct interior_rings<Slic3r::ExPolygon> {
|
||||
|
||||
static inline Slic3r::Polygons& get(Slic3r::ExPolygon& p) { return p.holes; }
|
||||
|
||||
static inline const Slic3r::Polygons& get(Slic3r::ExPolygon const& p)
|
||||
{
|
||||
return p.holes;
|
||||
}
|
||||
};
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* MultiPolygon concept adaptation ****************************************** */
|
||||
/* ************************************************************************** */
|
||||
|
||||
template<> struct tag<Slic3r::ExPolygons> {
|
||||
using type = multi_polygon_tag;
|
||||
};
|
||||
|
||||
}} // namespace geometry::traits
|
||||
|
||||
template<> struct range_value<std::vector<Slic3r::Vec2d>> {
|
||||
using type = Slic3r::Vec2d;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value<Slic3r::Polyline> {
|
||||
using type = Slic3r::Point;
|
||||
};
|
||||
|
||||
// This is an addition to the ring implementation of Polygon concept
|
||||
template<>
|
||||
struct range_value<Slic3r::Polygon> {
|
||||
using type = Slic3r::Point;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value<Slic3r::Polygons> {
|
||||
using type = Slic3r::Polygon;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value<Slic3r::ExPolygons> {
|
||||
using type = Slic3r::ExPolygon;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // SLABOOSTADAPTER_HPP
|
||||
|
||||
Reference in New Issue
Block a user