Reduce curling of Rear seams, improve its quality
Relevant issue: 8841 Rear Seam Not Aligned, Not Rear of Model
This commit is contained in:
parent
2781f716f4
commit
63222eb529
1 changed files with 13 additions and 6 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "SeamPlacer.hpp"
|
||||
|
||||
#include "Point.hpp"
|
||||
#include "libslic3r.h"
|
||||
#include "tbb/parallel_for.h"
|
||||
#include "tbb/blocked_range.h"
|
||||
#include "tbb/parallel_reduce.h"
|
||||
|
@ -729,8 +731,9 @@ void gather_enforcers_blockers(GlobalModelInfo &result, const PrintObject *po) {
|
|||
struct SeamComparator {
|
||||
SeamPosition setup;
|
||||
float angle_importance;
|
||||
explicit SeamComparator(SeamPosition setup) :
|
||||
setup(setup) {
|
||||
Vec2f rear_attractor;
|
||||
explicit SeamComparator(SeamPosition setup, const Vec2f& rear_attractor = Vec2f::Zero()) :
|
||||
setup(setup), rear_attractor(rear_attractor) {
|
||||
angle_importance =
|
||||
setup == spNearest ? SeamPlacer::angle_importance_nearest : SeamPlacer::angle_importance_aligned;
|
||||
}
|
||||
|
@ -761,8 +764,9 @@ struct SeamComparator {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (setup == SeamPosition::spRear && a.position.y() != b.position.y()) {
|
||||
return a.position.y() > b.position.y();
|
||||
if (setup == SeamPosition::spRear) {
|
||||
return (a.position.head<2>() - rear_attractor).squaredNorm() <
|
||||
(b.position.head<2>() - rear_attractor).squaredNorm();
|
||||
}
|
||||
|
||||
float distance_penalty_a = 0.0f;
|
||||
|
@ -824,7 +828,8 @@ struct SeamComparator {
|
|||
}
|
||||
|
||||
if (setup == SeamPosition::spRear) {
|
||||
return a.position.y() + SeamPlacer::seam_align_score_tolerance * 5.0f > b.position.y();
|
||||
return (a.position.head<2>() - rear_attractor).squaredNorm() - a.perimeter.flow_width <
|
||||
(b.position.head<2>() - rear_attractor).squaredNorm();
|
||||
}
|
||||
|
||||
float penalty_a = a.overhang + a.visibility
|
||||
|
@ -1452,7 +1457,9 @@ void SeamPlacer::init(const Print &print, std::function<void(void)> throw_if_can
|
|||
for (const PrintObject *po : print.objects()) {
|
||||
throw_if_canceled_func();
|
||||
SeamPosition configured_seam_preference = po->config().seam_position.value;
|
||||
SeamComparator comparator { configured_seam_preference };
|
||||
Vec2f rear_attractor = unscaled(po->bounding_box().center()).cast<float>() +
|
||||
1.5f * Vec2f(0.0f, unscale<float>(po->bounding_box().max.y()));
|
||||
SeamComparator comparator{configured_seam_preference, rear_attractor};
|
||||
|
||||
{
|
||||
GlobalModelInfo global_model_info { };
|
||||
|
|
Loading…
Reference in a new issue