Reworked pad creation algorithm with new parameters:

* brim size
* force pad around object everywhere
This commit is contained in:
tamasmeszaros 2019-09-24 15:15:49 +02:00
parent 9d775d0a43
commit e675a5d5c6
27 changed files with 1410 additions and 1448 deletions

View file

@ -16,6 +16,7 @@
#include <random>
namespace Slic3r {
namespace sla {
/*float SLAAutoSupports::approximate_geodesic_distance(const Vec3d& p1, const Vec3d& p2, Vec3d& n1, Vec3d& n2)
{
@ -48,9 +49,16 @@ float SLAAutoSupports::distance_limit(float angle) const
return 1./(2.4*get_required_density(angle));
}*/
SLAAutoSupports::SLAAutoSupports(const TriangleMesh& mesh, const sla::EigenMesh3D& emesh, const std::vector<ExPolygons>& slices, const std::vector<float>& heights,
const Config& config, std::function<void(void)> throw_on_cancel, std::function<void(int)> statusfn)
: m_config(config), m_emesh(emesh), m_throw_on_cancel(throw_on_cancel), m_statusfn(statusfn)
SLAAutoSupports::SLAAutoSupports(const sla::EigenMesh3D & emesh,
const std::vector<ExPolygons> &slices,
const std::vector<float> & heights,
const Config & config,
std::function<void(void)> throw_on_cancel,
std::function<void(int)> statusfn)
: m_config(config)
, m_emesh(emesh)
, m_throw_on_cancel(throw_on_cancel)
, m_statusfn(statusfn)
{
process(slices, heights);
project_onto_mesh(m_output);
@ -505,6 +513,21 @@ void SLAAutoSupports::uniformly_cover(const ExPolygons& islands, Structure& stru
}
}
void remove_bottom_points(std::vector<SupportPoint> &pts, double gnd_lvl, double tolerance)
{
// get iterator to the reorganized vector end
auto endit =
std::remove_if(pts.begin(), pts.end(),
[tolerance, gnd_lvl](const sla::SupportPoint &sp) {
double diff = std::abs(gnd_lvl -
double(sp.pos(Z)));
return diff <= tolerance;
});
// erase all elements after the new end
pts.erase(endit, pts.end());
}
#ifdef SLA_AUTOSUPPORTS_DEBUG
void SLAAutoSupports::output_structures(const std::vector<Structure>& structures)
{
@ -533,4 +556,5 @@ void SLAAutoSupports::output_expolygons(const ExPolygons& expolys, const std::st
}
#endif
} // namespace sla
} // namespace Slic3r