FIX: short edge collapse algortihm

so that it does not decimate all triangles on very high detailed models
Relevant issue 8834 Access Error when slicing
Github: #2283

Change-Id: I047361c88c561962ef4d3cf67bc0126402c41941
(cherry picked from commit f8aaa5c69d59c5fced4b7bb112376e4df94b5ddc)
This commit is contained in:
PavelMikus 2022-09-09 12:50:10 +02:00 committed by Lane.Wei
parent 731035b8b6
commit a15700e5de
3 changed files with 11 additions and 5 deletions

View file

@ -590,9 +590,10 @@ void compute_global_occlusion(GlobalModelInfo &result, const PrintObject *po, st
BOOST_LOG_TRIVIAL(debug) << "SeamPlacer: gather occlusion meshes: end";
BOOST_LOG_TRIVIAL(debug) << "SeamPlacer: decimate: start";
its_short_edge_collpase(triangle_set, 25000);
its_short_edge_collpase(negative_volumes_set, 25000);
BOOST_LOG_TRIVIAL(debug)
<< "SeamPlacer: decimate: start";
its_short_edge_collpase(triangle_set, SeamPlacer::fast_decimation_triangle_count_target);
its_short_edge_collpase(negative_volumes_set, SeamPlacer::fast_decimation_triangle_count_target);
size_t negative_volumes_start_index = triangle_set.indices.size();
its_merge(triangle_set, negative_volumes_set);

View file

@ -115,7 +115,8 @@ class SeamPlacer
public:
// Number of samples generated on the mesh. There are sqr_rays_per_sample_point*sqr_rays_per_sample_point rays casted from each samples
static constexpr size_t raycasting_visibility_samples_count = 30000;
// square of number of rays per sample point
static constexpr size_t fast_decimation_triangle_count_target = 16000;
//square of number of rays per sample point
static constexpr size_t sqr_rays_per_sample_point = 5;
// snapping angle - angles larger than this value will be snapped to during seam painting