diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2020-06-02 18:28:46 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2020-08-03 20:03:02 +0300 |
commit | 38239f09e3ea889aab14cc6c6bc2d6a27013981d (patch) | |
tree | 0abba992c65d2afe7a62e4ffdb5705b7b5a15275 /src | |
parent | f202d11e355ae43b04c7e48ef9aa1a4ee55fc28d (diff) |
Fix remove_bottom_points function
Diffstat (limited to 'src')
-rw-r--r-- | src/libslic3r/SLA/SupportPoint.hpp | 4 | ||||
-rw-r--r-- | src/libslic3r/SLA/SupportPointGenerator.cpp | 11 | ||||
-rw-r--r-- | src/libslic3r/SLA/SupportPointGenerator.hpp | 2 | ||||
-rw-r--r-- | src/libslic3r/SLAPrintSteps.cpp | 23 |
4 files changed, 18 insertions, 22 deletions
diff --git a/src/libslic3r/SLA/SupportPoint.hpp b/src/libslic3r/SLA/SupportPoint.hpp index 202a614c3..455962cc4 100644 --- a/src/libslic3r/SLA/SupportPoint.hpp +++ b/src/libslic3r/SLA/SupportPoint.hpp @@ -29,13 +29,13 @@ struct SupportPoint float pos_y, float pos_z, float head_radius, - bool new_island) + bool new_island = false) : pos(pos_x, pos_y, pos_z) , head_front_radius(head_radius) , is_new_island(new_island) {} - SupportPoint(Vec3f position, float head_radius, bool new_island) + SupportPoint(Vec3f position, float head_radius, bool new_island = false) : pos(position) , head_front_radius(head_radius) , is_new_island(new_island) diff --git a/src/libslic3r/SLA/SupportPointGenerator.cpp b/src/libslic3r/SLA/SupportPointGenerator.cpp index 78c2ced35..b598439ca 100644 --- a/src/libslic3r/SLA/SupportPointGenerator.cpp +++ b/src/libslic3r/SLA/SupportPointGenerator.cpp @@ -523,15 +523,12 @@ void SupportPointGenerator::uniformly_cover(const ExPolygons& islands, Structure } } -void remove_bottom_points(std::vector<SupportPoint> &pts, double gnd_lvl, double tolerance) +void remove_bottom_points(std::vector<SupportPoint> &pts, float lvl) { // 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; + auto endit = std::remove_if(pts.begin(), pts.end(), [lvl] + (const sla::SupportPoint &sp) { + return sp.pos.z() <= lvl; }); // erase all elements after the new end diff --git a/src/libslic3r/SLA/SupportPointGenerator.hpp b/src/libslic3r/SLA/SupportPointGenerator.hpp index 2fe8e11fc..172923056 100644 --- a/src/libslic3r/SLA/SupportPointGenerator.hpp +++ b/src/libslic3r/SLA/SupportPointGenerator.hpp @@ -214,7 +214,7 @@ private: std::mt19937 m_rng; }; -void remove_bottom_points(std::vector<SupportPoint> &pts, double gnd_lvl, double tolerance); +void remove_bottom_points(std::vector<SupportPoint> &pts, float lvl); }} // namespace Slic3r::sla diff --git a/src/libslic3r/SLAPrintSteps.cpp b/src/libslic3r/SLAPrintSteps.cpp index e421e9c1d..ea016d5bb 100644 --- a/src/libslic3r/SLAPrintSteps.cpp +++ b/src/libslic3r/SLAPrintSteps.cpp @@ -360,18 +360,6 @@ void SLAPrint::Steps::support_points(SLAPrintObject &po) // removed them on purpose. No calculation will be done. po.m_supportdata->pts = po.transformed_support_points(); } - - // If the zero elevation mode is engaged, we have to filter out all the - // points that are on the bottom of the object - if (is_zero_elevation(po.config())) { - double tolerance = po.config().pad_enable.getBool() ? - po.m_config.pad_wall_thickness.getFloat() : - po.m_config.support_base_height.getFloat(); - - remove_bottom_points(po.m_supportdata->pts, - po.m_supportdata->emesh.ground_level(), - tolerance); - } } void SLAPrint::Steps::support_tree(SLAPrintObject &po) @@ -382,6 +370,17 @@ void SLAPrint::Steps::support_tree(SLAPrintObject &po) if (pcfg.embed_object) po.m_supportdata->emesh.ground_level_offset(pcfg.wall_thickness_mm); + + // If the zero elevation mode is engaged, we have to filter out all the + // points that are on the bottom of the object + if (is_zero_elevation(po.config())) { + double discard = po.config().pad_enable.getBool() ? + po.m_config.pad_wall_height.getFloat() : + po.m_config.support_base_height.getFloat() ; + + remove_bottom_points(po.m_supportdata->pts, + float(po.m_supportdata->emesh.ground_level() + discard)); + } po.m_supportdata->cfg = make_support_cfg(po.m_config); // po.m_supportdata->emesh.load_holes(po.transformed_drainhole_points()); |