mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-12 06:09:07 +08:00
Fix endless loop in pinhead creation.
* Headless stick penetration value from global cfg * eliminate warnings
This commit is contained in:
parent
4569a6026a
commit
2edd5abf06
@ -171,6 +171,9 @@ Head::Head(double r_big_mm,
|
|||||||
, width_mm(length_mm)
|
, width_mm(length_mm)
|
||||||
, penetration_mm(penetration)
|
, 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
|
// We create two spheres which will be connected with a robe that fits
|
||||||
// both circles perfectly.
|
// both circles perfectly.
|
||||||
|
@ -311,7 +311,7 @@ public:
|
|||||||
if (m_pillars.capacity() < m_heads.size())
|
if (m_pillars.capacity() < m_heads.size())
|
||||||
m_pillars.reserve(m_heads.size() * 10);
|
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)]];
|
Head &head = m_heads[m_head_indices[size_t(headid)]];
|
||||||
|
|
||||||
m_pillars.emplace_back(head, std::forward<Args>(args)...);
|
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)
|
void add_pillar_base(long pid, double baseheight = 3, double radius = 2)
|
||||||
{
|
{
|
||||||
std::lock_guard<Mutex> lk(m_mutex);
|
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);
|
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)
|
const Bridge& add_bridge(long headid, const Vec3d &endp, size_t s = 45)
|
||||||
{
|
{
|
||||||
std::lock_guard<Mutex> lk(m_mutex);
|
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)]];
|
Head &h = m_heads[m_head_indices[size_t(headid)]];
|
||||||
m_bridges.emplace_back(h.junction_point(), endp, h.r_back_mm, s);
|
m_bridges.emplace_back(h.junction_point(), endp, h.r_back_mm, s);
|
||||||
|
@ -1096,6 +1096,11 @@ void SupportTreeBuildsteps::routing_to_model()
|
|||||||
double dist = distance(endp, hitp) + m_cfg.head_penetration_mm;
|
double dist = distance(endp, hitp) + m_cfg.head_penetration_mm;
|
||||||
double w = dist - 2 * head.r_pin_mm - head.r_back_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 tailhead(head.r_back_mm,
|
||||||
head.r_pin_mm,
|
head.r_pin_mm,
|
||||||
w,
|
w,
|
||||||
@ -1348,7 +1353,7 @@ void SupportTreeBuildsteps::routing_headless()
|
|||||||
m_thr();
|
m_thr();
|
||||||
|
|
||||||
const auto R = double(m_support_pts[i].head_front_radius);
|
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
|
// Exact support position
|
||||||
Vec3d sph = m_support_pts[i].pos.cast<double>();
|
Vec3d sph = m_support_pts[i].pos.cast<double>();
|
||||||
|
@ -260,7 +260,7 @@ void test_support_model_collision(
|
|||||||
|
|
||||||
// Set head penetration to a small negative value which should ensure that
|
// Set head penetration to a small negative value which should ensure that
|
||||||
// the supports will not touch the model body.
|
// the supports will not touch the model body.
|
||||||
supportcfg.head_penetration_mm = -1.; // 1 mm should be more than enough
|
supportcfg.head_penetration_mm = -0.1;
|
||||||
|
|
||||||
test_supports(obj_filename, supportcfg, byproducts);
|
test_supports(obj_filename, supportcfg, byproducts);
|
||||||
|
|
||||||
@ -277,6 +277,7 @@ void test_support_model_collision(
|
|||||||
const ExPolygons &mod_slice = byproducts.model_slices[n];
|
const ExPolygons &mod_slice = byproducts.model_slices[n];
|
||||||
|
|
||||||
Polygons intersections = intersection(sup_slice, mod_slice);
|
Polygons intersections = intersection(sup_slice, mod_slice);
|
||||||
|
|
||||||
notouch = notouch && intersections.empty();
|
notouch = notouch && intersections.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user