diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2019-10-03 18:18:03 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2019-10-03 18:18:03 +0300 |
commit | 2edd5abf06a61d802c115aeceddb9a2a3788494b (patch) | |
tree | 8a07702cc3e5e543cc291be0cfdb149fb99f3818 /src | |
parent | 4569a6026a9a841a4515430d44f8ca8da126ee31 (diff) |
Fix endless loop in pinhead creation.
* Headless stick penetration value from global cfg
* eliminate warnings
Diffstat (limited to 'src')
-rw-r--r-- | src/libslic3r/SLA/SLASupportTreeBuilder.cpp | 3 | ||||
-rw-r--r-- | src/libslic3r/SLA/SLASupportTreeBuilder.hpp | 6 | ||||
-rw-r--r-- | src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp | 7 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/libslic3r/SLA/SLASupportTreeBuilder.cpp b/src/libslic3r/SLA/SLASupportTreeBuilder.cpp index 3fa9f3b98..2e0310ed8 100644 --- a/src/libslic3r/SLA/SLASupportTreeBuilder.cpp +++ b/src/libslic3r/SLA/SLASupportTreeBuilder.cpp @@ -171,6 +171,9 @@ Head::Head(double r_big_mm, , width_mm(length_mm) , penetration_mm(penetration) { + assert(width_mm > 0.); + assert(r_back_mm > 0.); + assert(r_pin_mm > 0.); // We create two spheres which will be connected with a robe that fits // both circles perfectly. diff --git a/src/libslic3r/SLA/SLASupportTreeBuilder.hpp b/src/libslic3r/SLA/SLASupportTreeBuilder.hpp index 95fcdcc32..c0d9f04c0 100644 --- a/src/libslic3r/SLA/SLASupportTreeBuilder.hpp +++ b/src/libslic3r/SLA/SLASupportTreeBuilder.hpp @@ -311,7 +311,7 @@ public: if (m_pillars.capacity() < m_heads.size()) m_pillars.reserve(m_heads.size() * 10); - assert(headid >= 0 && headid < m_head_indices.size()); + assert(headid >= 0 && size_t(headid) < m_head_indices.size()); Head &head = m_heads[m_head_indices[size_t(headid)]]; m_pillars.emplace_back(head, std::forward<Args>(args)...); @@ -328,7 +328,7 @@ public: void add_pillar_base(long pid, double baseheight = 3, double radius = 2) { std::lock_guard<Mutex> lk(m_mutex); - assert(pid >= 0 && pid < m_pillars.size()); + assert(pid >= 0 && size_t(pid) < m_pillars.size()); m_pillars[size_t(pid)].add_base(baseheight, radius); } @@ -398,7 +398,7 @@ public: const Bridge& add_bridge(long headid, const Vec3d &endp, size_t s = 45) { std::lock_guard<Mutex> lk(m_mutex); - assert(headid >= 0 && headid < m_head_indices.size()); + assert(headid >= 0 && size_t(headid) < m_head_indices.size()); Head &h = m_heads[m_head_indices[size_t(headid)]]; m_bridges.emplace_back(h.junction_point(), endp, h.r_back_mm, s); diff --git a/src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp b/src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp index 60e8f15b7..392a963e1 100644 --- a/src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp +++ b/src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp @@ -1096,6 +1096,11 @@ void SupportTreeBuildsteps::routing_to_model() double dist = distance(endp, hitp) + m_cfg.head_penetration_mm; double w = dist - 2 * head.r_pin_mm - head.r_back_mm; + if (w < 0.) { + BOOST_LOG_TRIVIAL(error) << "Pinhead width is negative!"; + w = 0.; + } + Head tailhead(head.r_back_mm, head.r_pin_mm, w, @@ -1348,7 +1353,7 @@ void SupportTreeBuildsteps::routing_headless() m_thr(); const auto R = double(m_support_pts[i].head_front_radius); - const double HWIDTH_MM = R/3; + const double HWIDTH_MM = m_cfg.head_penetration_mm; // Exact support position Vec3d sph = m_support_pts[i].pos.cast<double>(); |