mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 01:39:02 +08:00
Fix failing sla tree tests
Try to increase number of rays in Beam to prevent colisions Put back threshold for intersections with model in sla tree tests Increase safety distance for branching tree instead of increasing rays
This commit is contained in:
parent
fd8fd77077
commit
0a3b17f940
@ -120,7 +120,7 @@ bool BranchingTreeBuilder::add_bridge(const branchingtree::Node &from,
|
||||
double fromR = get_radius(from), toR = get_radius(to);
|
||||
Beam beam{Ball{fromd, fromR}, Ball{tod, toR}};
|
||||
auto hit = beam_mesh_hit(ex_tbb, m_sm.emesh, beam,
|
||||
m_sm.cfg.safety_distance_mm);
|
||||
2 * m_sm.cfg.safety_distance_mm);
|
||||
|
||||
bool ret = hit.distance() > (tod - fromd).norm();
|
||||
|
||||
@ -140,7 +140,8 @@ bool BranchingTreeBuilder::add_merger(const branchingtree::Node &node,
|
||||
double closestR = get_radius(closest);
|
||||
Beam beam1{Ball{from1d, nodeR}, Ball{tod, mergeR}};
|
||||
Beam beam2{Ball{from2d, closestR}, Ball{tod, mergeR}};
|
||||
auto sd = m_sm.cfg.safety_distance_mm;
|
||||
|
||||
auto sd = 2 * m_sm.cfg.safety_distance_mm;
|
||||
auto hit1 = beam_mesh_hit(ex_tbb, m_sm.emesh, beam1, sd);
|
||||
auto hit2 = beam_mesh_hit(ex_tbb, m_sm.emesh, beam2, sd);
|
||||
|
||||
@ -178,7 +179,9 @@ bool BranchingTreeBuilder::add_mesh_bridge(const branchingtree::Node &from,
|
||||
m_builder.add_diffbridge(fromj.pos, anchor->junction_point(), fromj.r,
|
||||
anchor->r_back_mm);
|
||||
|
||||
if (!m_sm.cfg.ground_facing_only) { // Easter egg, to omit the anchors
|
||||
m_builder.add_anchor(*anchor);
|
||||
}
|
||||
|
||||
build_subtree(from.id);
|
||||
}
|
||||
|
@ -57,7 +57,11 @@ sla::SupportTreeConfig make_support_cfg(const SLAPrintObjectConfig& c)
|
||||
scfg.max_bridge_length_mm = c.support_max_bridge_length.getFloat();
|
||||
scfg.max_pillar_link_distance_mm = c.support_max_pillar_link_distance.getFloat();
|
||||
scfg.pillar_connection_mode = c.support_pillar_connection_mode.value;
|
||||
if (scfg.tree_type != sla::SupportTreeType::Branching) {
|
||||
// Branching tree is all about routing to model body, it doesn't support
|
||||
// this option.
|
||||
scfg.ground_facing_only = c.support_buildplate_only.getBool();
|
||||
}
|
||||
scfg.pillar_widening_factor = c.support_pillar_widening_factor.getFloat();
|
||||
scfg.base_radius_mm = 0.5*c.support_base_diameter.getFloat();
|
||||
scfg.base_height_mm = c.support_base_height.getFloat();
|
||||
|
@ -6,7 +6,8 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
void test_support_model_collision(const std::string &obj_filename,
|
||||
void test_support_model_collision(
|
||||
const std::string &obj_filename,
|
||||
const sla::SupportTreeConfig &input_supportcfg,
|
||||
const sla::HollowingConfig &hollowingcfg,
|
||||
const sla::DrainHoles &drainholes)
|
||||
@ -15,6 +16,9 @@ void test_support_model_collision(const std::string &obj_filename,
|
||||
|
||||
sla::SupportTreeConfig supportcfg = input_supportcfg;
|
||||
|
||||
// Ensure that there are no anchors which would pierce the model.
|
||||
supportcfg.ground_facing_only = true;
|
||||
|
||||
// Set head penetration to a small negative value which should ensure that
|
||||
// the supports will not touch the model body.
|
||||
supportcfg.head_penetration_mm = -0.2;
|
||||
@ -23,15 +27,15 @@ void test_support_model_collision(const std::string &obj_filename,
|
||||
|
||||
// Slice the support mesh given the slice grid of the model.
|
||||
std::vector<ExPolygons> support_slices =
|
||||
sla::slice(byproducts.supporttree.retrieve_mesh(sla::MeshType::Support),
|
||||
byproducts.supporttree.retrieve_mesh(sla::MeshType::Pad),
|
||||
sla::slice(byproducts.suptree_builder.retrieve_mesh(sla::MeshType::Support),
|
||||
byproducts.suptree_builder.retrieve_mesh(sla::MeshType::Pad),
|
||||
byproducts.slicegrid, CLOSING_RADIUS, {});
|
||||
|
||||
// The slices originate from the same slice grid so the numbers must match
|
||||
|
||||
bool support_mesh_is_empty =
|
||||
byproducts.supporttree.retrieve_mesh(sla::MeshType::Pad).empty() &&
|
||||
byproducts.supporttree.retrieve_mesh(sla::MeshType::Support).empty();
|
||||
byproducts.suptree_builder.retrieve_mesh(sla::MeshType::Pad).empty() &&
|
||||
byproducts.suptree_builder.retrieve_mesh(sla::MeshType::Support).empty();
|
||||
|
||||
if (support_mesh_is_empty)
|
||||
REQUIRE(support_slices.empty());
|
||||
@ -80,7 +84,7 @@ void export_failed_case(const std::vector<ExPolygons> &support_slices, const Sup
|
||||
|
||||
if (do_export_stl) {
|
||||
indexed_triangle_set its;
|
||||
byproducts.supporttree.retrieve_full_mesh(its);
|
||||
byproducts.suptree_builder.retrieve_full_mesh(its);
|
||||
TriangleMesh m{its};
|
||||
m.merge(byproducts.input_mesh);
|
||||
m.WriteOBJFile((Catch::getResultCapture().getCurrentTestName() + "_" +
|
||||
@ -119,10 +123,10 @@ void test_supports(const std::string &obj_filename,
|
||||
// is the input of the support point and support mesh generators
|
||||
AABBMesh emesh{mesh};
|
||||
|
||||
#ifdef SLIC3R_HOLE_RAYCASTER
|
||||
#ifdef SLIC3R_HOLE_RAYCASTER
|
||||
if (hollowingcfg.enabled)
|
||||
emesh.load_holes(drainholes);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// TODO: do the cgal hole cutting...
|
||||
|
||||
@ -187,7 +191,7 @@ void test_supports(const std::string &obj_filename,
|
||||
// Move out the support tree into the byproducts, we can examine it further
|
||||
// in various tests.
|
||||
out.obj_fname = std::move(obj_filename);
|
||||
out.supporttree = std::move(treebuilder);
|
||||
out.suptree_builder = std::move(treebuilder);
|
||||
out.input_mesh = std::move(mesh);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ struct SupportByproducts
|
||||
std::string obj_fname;
|
||||
std::vector<float> slicegrid;
|
||||
std::vector<ExPolygons> model_slices;
|
||||
sla::SupportTreeBuilder supporttree;
|
||||
sla::SupportTreeBuilder suptree_builder;
|
||||
TriangleMesh input_mesh;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user