Trying to fix compilation on linux and mac.
This commit is contained in:
parent
48bc166d6d
commit
a49b506121
@ -26,7 +26,7 @@ template<> struct coordinate_system<Slic3r::Point> {
|
|||||||
|
|
||||||
template<> struct dimension<Slic3r::Point>: boost::mpl::int_<2> {};
|
template<> struct dimension<Slic3r::Point>: boost::mpl::int_<2> {};
|
||||||
|
|
||||||
template<int d> struct access<Slic3r::Point, d > {
|
template<std::size_t d> struct access<Slic3r::Point, d > {
|
||||||
static inline coord_t get(Slic3r::Point const& a) {
|
static inline coord_t get(Slic3r::Point const& a) {
|
||||||
return a(d);
|
return a(d);
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ template<> struct coordinate_system<Slic3r::Vec2d> {
|
|||||||
|
|
||||||
template<> struct dimension<Slic3r::Vec2d>: boost::mpl::int_<2> {};
|
template<> struct dimension<Slic3r::Vec2d>: boost::mpl::int_<2> {};
|
||||||
|
|
||||||
template<int d> struct access<Slic3r::Vec2d, d > {
|
template<std::size_t d> struct access<Slic3r::Vec2d, d > {
|
||||||
static inline double get(Slic3r::Vec2d const& a) {
|
static inline double get(Slic3r::Vec2d const& a) {
|
||||||
return a(d);
|
return a(d);
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ template<> struct coordinate_system<Slic3r::Vec3d> {
|
|||||||
|
|
||||||
template<> struct dimension<Slic3r::Vec3d>: boost::mpl::int_<3> {};
|
template<> struct dimension<Slic3r::Vec3d>: boost::mpl::int_<3> {};
|
||||||
|
|
||||||
template<int d> struct access<Slic3r::Vec3d, d > {
|
template<std::size_t d> struct access<Slic3r::Vec3d, d > {
|
||||||
static inline double get(Slic3r::Vec3d const& a) {
|
static inline double get(Slic3r::Vec3d const& a) {
|
||||||
return a(d);
|
return a(d);
|
||||||
}
|
}
|
||||||
|
@ -13,67 +13,6 @@ namespace sla {
|
|||||||
typedef Eigen::Matrix<double, 3, 1, Eigen::DontAlign> Vec3d;
|
typedef Eigen::Matrix<double, 3, 1, Eigen::DontAlign> Vec3d;
|
||||||
using SpatElement = std::pair<Vec3d, unsigned>;
|
using SpatElement = std::pair<Vec3d, unsigned>;
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is intended for enhancing range based for loops with indexing.
|
|
||||||
* So instead of this:
|
|
||||||
* { int i = 0; for(auto c : container) { process(c, i); ++i; }
|
|
||||||
*
|
|
||||||
* you can use this:
|
|
||||||
* for(auto ic : container) process(ic.value, ic.index);
|
|
||||||
*/
|
|
||||||
template<class Container> class Enumerable {
|
|
||||||
Container&& m;
|
|
||||||
using C = typename std::remove_reference<Container>::type;
|
|
||||||
using CC = typename std::remove_const<C>::type;
|
|
||||||
|
|
||||||
template<class S> struct get_iterator {};
|
|
||||||
template<> struct get_iterator<CC> { using type = typename CC::iterator; };
|
|
||||||
template<> struct get_iterator<const CC> {
|
|
||||||
using type = typename CC::const_iterator;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class Vref> struct _Pair {
|
|
||||||
Vref value;
|
|
||||||
size_t index;
|
|
||||||
_Pair(Vref v, size_t i) : value(v), index(i) {}
|
|
||||||
operator Vref() { return value; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class Cit>
|
|
||||||
class _iterator {
|
|
||||||
Cit start;
|
|
||||||
Cit it;
|
|
||||||
using Pair = _Pair<typename std::iterator_traits<Cit>::reference>;
|
|
||||||
public:
|
|
||||||
_iterator(Cit b, Cit i): start(b), it(i) {}
|
|
||||||
_iterator& operator++() { ++it; return *this;}
|
|
||||||
_iterator operator++(int) { auto tmp = it; ++it; return tmp;}
|
|
||||||
|
|
||||||
bool operator!=(_iterator other) { return it != other.it; }
|
|
||||||
Pair operator*() { return Pair(*it, it - start); }
|
|
||||||
using value_type = typename Enumerable::value_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Enumerable(Container&& c): m(c) {}
|
|
||||||
|
|
||||||
using value_type = typename CC::value_type;
|
|
||||||
|
|
||||||
using iterator = _iterator<typename get_iterator<C>::type>;
|
|
||||||
using const_iterator = _iterator<typename CC::const_iterator>;
|
|
||||||
|
|
||||||
iterator begin() { return iterator(m.begin(), m.begin()); }
|
|
||||||
iterator end() { return iterator(m.begin(), m.end()); }
|
|
||||||
const_iterator begin() const {return const_iterator(m.cbegin(), m.cbegin());}
|
|
||||||
const_iterator end() const { return const_iterator(m.cbegin(), m.cend());}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class C> inline Enumerable<C> enumerate(C&& c) {
|
|
||||||
return Enumerable<C>(std::forward<C>(c));
|
|
||||||
}
|
|
||||||
|
|
||||||
class SpatIndex {
|
class SpatIndex {
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
|
@ -61,15 +61,15 @@ inline Portion make_portion(double a, double b) {
|
|||||||
return std::make_tuple(a, b);
|
return std::make_tuple(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Vec> double distance(const Vec& p) {
|
||||||
|
return std::sqrt(p.transpose() * p);
|
||||||
|
}
|
||||||
|
|
||||||
template<class Vec> double distance(const Vec& pp1, const Vec& pp2) {
|
template<class Vec> double distance(const Vec& pp1, const Vec& pp2) {
|
||||||
auto p = pp2 - pp1;
|
auto p = pp2 - pp1;
|
||||||
return distance(p);
|
return distance(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Vec> double distance(const Vec& p) {
|
|
||||||
return std::sqrt(p.transpose() * p);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The horizontally projected 2D boundary of the model as individual line
|
/// The horizontally projected 2D boundary of the model as individual line
|
||||||
/// segments. This can be used later to create a spatial index of line segments
|
/// segments. This can be used later to create a spatial index of line segments
|
||||||
/// and query for possible pillar positions for non-ground facing support points
|
/// and query for possible pillar positions for non-ground facing support points
|
||||||
@ -1181,10 +1181,10 @@ bool SLASupportTree::generate(const PointSet &points,
|
|||||||
// now we will go through the clusters ones again and connect the
|
// now we will go through the clusters ones again and connect the
|
||||||
// sidepoints with the cluster centroid (which is a ground pillar)
|
// sidepoints with the cluster centroid (which is a ground pillar)
|
||||||
// or a nearby pillar if the centroid is unreachable.
|
// or a nearby pillar if the centroid is unreachable.
|
||||||
for(auto cle : enumerate(gnd_clusters)) {
|
long ci = 0;
|
||||||
auto cl = cle.value;
|
for(auto cl : gnd_clusters) {
|
||||||
auto cidx = cl_centroids[cle.index];
|
auto cidx = cl_centroids[ci];
|
||||||
cl_centroids[cle.index] = cl[cidx];
|
cl_centroids[ci++] = cl[cidx];
|
||||||
|
|
||||||
long index_to_heads = gndidx[cl[cidx]];
|
long index_to_heads = gndidx[cl[cidx]];
|
||||||
auto& head = result.head(index_to_heads);
|
auto& head = result.head(index_to_heads);
|
||||||
@ -1317,7 +1317,7 @@ bool SLASupportTree::generate(const PointSet &points,
|
|||||||
|
|
||||||
auto newring = pts_convex_hull(rem,
|
auto newring = pts_convex_hull(rem,
|
||||||
[gnd_head_pt](unsigned i) {
|
[gnd_head_pt](unsigned i) {
|
||||||
auto& p = gnd_head_pt(i);
|
auto&& p = gnd_head_pt(i);
|
||||||
return Vec2d(p(X), p(Y)); // project to 2D in along Z axis
|
return Vec2d(p(X), p(Y)); // project to 2D in along Z axis
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user