Generalize BoostAdapter for all Vec<> types and move out of SLA

This commit is contained in:
tamasmeszaros 2022-06-09 16:24:29 +02:00
parent f90d62c771
commit a7e50b7a98
5 changed files with 14 additions and 40 deletions

View File

@ -38,54 +38,28 @@ template<std::size_t d> struct access<Slic3r::Point, d > {
}
};
// For Vec2d ///////////////////////////////////////////////////////////////////
// For Vec<N, T> ///////////////////////////////////////////////////////////////
template<> struct tag<Slic3r::Vec2d> {
template<int N, class T> struct tag<Slic3r::Vec<N, T>> {
using type = point_tag;
};
template<> struct coordinate_type<Slic3r::Vec2d> {
using type = double;
template<int N, class T> struct coordinate_type<Slic3r::Vec<N, T>> {
using type = T;
};
template<> struct coordinate_system<Slic3r::Vec2d> {
template<int N, class T> struct coordinate_system<Slic3r::Vec<N, T>> {
using type = cs::cartesian;
};
template<> struct dimension<Slic3r::Vec2d>: boost::mpl::int_<2> {};
template<int N, class T> struct dimension<Slic3r::Vec<N, T>>: boost::mpl::int_<N> {};
template<std::size_t d> struct access<Slic3r::Vec2d, d > {
static inline double get(Slic3r::Vec2d const& a) {
template<int N, class T, std::size_t d> struct access<Slic3r::Vec<N, T>, d> {
static inline T get(Slic3r::Vec<N, T> const& a) {
return a(d);
}
static inline void set(Slic3r::Vec2d& a, double const& value) {
a(d) = value;
}
};
// For Vec3d ///////////////////////////////////////////////////////////////////
template<> struct tag<Slic3r::Vec3d> {
using type = point_tag;
};
template<> struct coordinate_type<Slic3r::Vec3d> {
using type = double;
};
template<> struct coordinate_system<Slic3r::Vec3d> {
using type = cs::cartesian;
};
template<> struct dimension<Slic3r::Vec3d>: boost::mpl::int_<3> {};
template<std::size_t d> struct access<Slic3r::Vec3d, d > {
static inline double get(Slic3r::Vec3d const& a) {
return a(d);
}
static inline void set(Slic3r::Vec3d& a, double const& value) {
static inline void set(Slic3r::Vec<N, T>& a, T const& value) {
a(d) = value;
}
};
@ -129,6 +103,6 @@ template<> struct range_value<std::vector<Slic3r::Vec2d>> {
using type = Slic3r::Vec2d;
};
}
} // namespace boost
#endif // SLABOOSTADAPTER_HPP

View File

@ -29,6 +29,7 @@ set(SLIC3R_SOURCES
Brim.hpp
BuildVolume.cpp
BuildVolume.hpp
BoostAdapter.hpp
clipper.cpp
clipper.hpp
ClipperUtils.cpp
@ -292,7 +293,6 @@ set(SLIC3R_SOURCES
# SLA/SupportTreeIGL.cpp
SLA/Rotfinder.hpp
SLA/Rotfinder.cpp
SLA/BoostAdapter.hpp
SLA/SpatIndex.hpp
SLA/SpatIndex.cpp
SLA/RasterBase.hpp

View File

@ -2,7 +2,7 @@
#include "boost/geometry/index/rtree.hpp"
#include <libslic3r/SLA/SpatIndex.hpp>
#include <libslic3r/SLA/BoostAdapter.hpp>
#include <libslic3r/BoostAdapter.hpp>
namespace Slic3r { namespace sla {

View File

@ -1,6 +1,6 @@
#include <libslic3r/SLA/Pad.hpp>
#include <libslic3r/SLA/SpatIndex.hpp>
#include <libslic3r/SLA/BoostAdapter.hpp>
#include <libslic3r/BoostAdapter.hpp>
//#include <libslic3r/SLA/Contour3D.hpp>
#include <libslic3r/TriangleMeshSlicer.hpp>

View File

@ -1,7 +1,7 @@
#include "SpatIndex.hpp"
// for concave hull merging decisions
#include <libslic3r/SLA/BoostAdapter.hpp>
#include <libslic3r/BoostAdapter.hpp>
#ifdef _MSC_VER
#pragma warning(push)