Removing unused pad parts working
This commit is contained in:
parent
778b2cf293
commit
d7684188f9
2 changed files with 60 additions and 3 deletions
|
@ -5,6 +5,9 @@
|
|||
#include <mutex> // for std::lock_guard
|
||||
#include <functional> // for std::function
|
||||
#include <utility> // for std::forward
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
@ -182,6 +185,57 @@ public:
|
|||
inline bool empty() const { return size() == 0; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cvref
|
||||
{
|
||||
using type =
|
||||
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
using remove_cvref_t = typename remove_cvref<T>::type;
|
||||
|
||||
template<template<class> class C, class T>
|
||||
class Container: public C<remove_cvref_t<T>> {
|
||||
public:
|
||||
explicit Container(size_t count, T&& initval):
|
||||
C<remove_cvref_t<T>>(count, initval) {}
|
||||
};
|
||||
|
||||
template<class T> using DefaultContainer = std::vector<T>;
|
||||
|
||||
/// Exactly like Matlab https://www.mathworks.com/help/matlab/ref/linspace.html
|
||||
template<class T, class I, template<class> class C = DefaultContainer>
|
||||
inline C<remove_cvref_t<T>> linspace(const T &start, const T &stop, const I &n)
|
||||
{
|
||||
Container<C, T> vals(n, T());
|
||||
T stride = (stop - start) / n;
|
||||
|
||||
size_t i = 0;
|
||||
std::generate(vals.begin(), vals.end(), [&i, start, stride] {
|
||||
return start + i++ * stride;
|
||||
});
|
||||
|
||||
return vals;
|
||||
}
|
||||
|
||||
/// A set of equidistant values starting from 'start' (inclusive), ending
|
||||
/// in the closest multiple of 'stride' less than or equal to 'end' and
|
||||
/// leaving 'stride' space between each value.
|
||||
/// Very similar to Matlab [start:stride:end] notation.
|
||||
template<class T, template<class> class C = DefaultContainer>
|
||||
inline C<remove_cvref_t<T>> grid(const T &start, const T &stop, const T &stride)
|
||||
{
|
||||
Container<C, T> vals(size_t(std::ceil((stop - start) / stride)), T());
|
||||
|
||||
int i = 0;
|
||||
std::generate(vals.begin(), vals.end(), [&i, start, stride] {
|
||||
return start + i++ * stride;
|
||||
});
|
||||
|
||||
return vals;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // MTUTILS_HPP
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "SLASpatIndex.hpp"
|
||||
#include "SLABasePool.hpp"
|
||||
|
||||
#include <libslic3r/MTUtils.hpp>
|
||||
#include <libslic3r/ClipperUtils.hpp>
|
||||
#include <libslic3r/Model.hpp>
|
||||
|
||||
|
@ -559,7 +560,7 @@ struct Pad {
|
|||
|
||||
Pad() = default;
|
||||
|
||||
Pad(const TriangleMesh& object_support_mesh,
|
||||
Pad(const TriangleMesh& support_mesh,
|
||||
const ExPolygons& modelbase,
|
||||
double ground_level,
|
||||
const PoolConfig& pcfg) :
|
||||
|
@ -576,9 +577,11 @@ struct Pad {
|
|||
// Get a sample for the pad from the support mesh
|
||||
{
|
||||
ExPolygons platetmp;
|
||||
float plateZ = float(get_pad_fullheight(pcfg) + EPSILON);
|
||||
|
||||
base_plate(object_support_mesh, platetmp, plateZ, 0.1f, thr);
|
||||
float zstart = float(zlevel);
|
||||
float zend = zstart + float(get_pad_fullheight(pcfg) + EPSILON);
|
||||
|
||||
base_plate(support_mesh, platetmp, grid(zstart, zend, 0.1f), thr);
|
||||
|
||||
// We don't need no... holes control...
|
||||
for (const ExPolygon &bp : platetmp)
|
||||
|
|
Loading…
Reference in a new issue