mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-18 01:25:58 +08:00
parameter fixes, alignemnt for enforcers simplified
This commit is contained in:
parent
c640fb854f
commit
6dbc7149be
@ -647,13 +647,15 @@ struct SeamComparator {
|
|||||||
float distance_penalty_a = 1.0f;
|
float distance_penalty_a = 1.0f;
|
||||||
float distance_penalty_b = 1.0f;
|
float distance_penalty_b = 1.0f;
|
||||||
if (setup == spNearest) {
|
if (setup == spNearest) {
|
||||||
distance_penalty_a = 1.1f - gauss((a.position.head<2>() - preffered_location).norm(), 0.0f, 1.0f, 0.001f);
|
distance_penalty_a = 1.1f - gauss((a.position.head<2>() - preffered_location).norm(), 0.0f, 1.0f, 0.01f);
|
||||||
distance_penalty_b = 1.1f - gauss((a.position.head<2>() - preffered_location).norm(), 0.0f, 1.0f, 0.001f);
|
distance_penalty_b = 1.1f - gauss((a.position.head<2>() - preffered_location).norm(), 0.0f, 1.0f, 0.01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ranges: [0 - 1] (0 - 1.3] [0.1 - 1.1) ; total range: (0 - 2.1]
|
//ranges: [0 - 1] (0 - 1.3] [0.1 - 1.1)
|
||||||
float penalty_a = (a.visibility + 0.5f) * compute_angle_penalty(a.local_ccw_angle) * distance_penalty_a;
|
float penalty_a = (a.visibility + SeamPlacer::additional_angle_importance) * compute_angle_penalty(a.local_ccw_angle)
|
||||||
float penalty_b = (b.visibility + 0.5f) * compute_angle_penalty(b.local_ccw_angle) * distance_penalty_b;
|
* distance_penalty_a;
|
||||||
|
float penalty_b = (b.visibility + SeamPlacer::additional_angle_importance) * compute_angle_penalty(b.local_ccw_angle)
|
||||||
|
* distance_penalty_b;
|
||||||
|
|
||||||
return penalty_a < penalty_b;
|
return penalty_a < penalty_b;
|
||||||
}
|
}
|
||||||
@ -662,6 +664,14 @@ struct SeamComparator {
|
|||||||
// sema point of the perimeter, to find out if the aligned point is not much worse than the current seam
|
// sema point of the perimeter, to find out if the aligned point is not much worse than the current seam
|
||||||
bool is_first_not_much_worse(const SeamCandidate &a, const SeamCandidate &b) const {
|
bool is_first_not_much_worse(const SeamCandidate &a, const SeamCandidate &b) const {
|
||||||
// Blockers/Enforcers discrimination, top priority
|
// Blockers/Enforcers discrimination, top priority
|
||||||
|
if (a.type == EnforcedBlockedSeamPoint::Enforced) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a.type == EnforcedBlockedSeamPoint::Blocked) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (a.type > b.type) {
|
if (a.type > b.type) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -682,9 +692,9 @@ struct SeamComparator {
|
|||||||
return a.position.y() > b.position.y();
|
return a.position.y() > b.position.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
//ranges: [0 - 1] (0 - 1.3] ; total range: (0 - 1.95];
|
//ranges: [0 - 1] (0 - 1.3] ;
|
||||||
float penalty_a = (a.visibility + 0.5f) * compute_angle_penalty(a.local_ccw_angle);
|
float penalty_a = (a.visibility + SeamPlacer::additional_angle_importance) * compute_angle_penalty(a.local_ccw_angle);
|
||||||
float penalty_b = (b.visibility + 0.5f) * compute_angle_penalty(b.local_ccw_angle);
|
float penalty_b = (b.visibility + SeamPlacer::additional_angle_importance) * compute_angle_penalty(b.local_ccw_angle);
|
||||||
|
|
||||||
return penalty_a <= penalty_b || std::abs(penalty_a - penalty_b) < SeamPlacer::seam_align_score_tolerance;
|
return penalty_a <= penalty_b || std::abs(penalty_a - penalty_b) < SeamPlacer::seam_align_score_tolerance;
|
||||||
}
|
}
|
||||||
@ -695,7 +705,7 @@ struct SeamComparator {
|
|||||||
return a.position.y();
|
return a.position.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (a.visibility + 0.5f) * compute_angle_penalty(a.local_ccw_angle);
|
return (a.visibility + SeamPlacer::additional_angle_importance) * compute_angle_penalty(a.local_ccw_angle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@ -1130,7 +1140,7 @@ void SeamPlacer::align_seam_points(const PrintObject *po, const SeamPlacerImpl::
|
|||||||
// points = new_points;
|
// points = new_points;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // find coefficients of polynomial fit. Z coord is treated as parameter along which to fit both X and Y coords.
|
// find coefficients of polynomial fit. Z coord is treated as parameter along which to fit both X and Y coords.
|
||||||
// std::vector<Vec2f> coefficients = polyfit(points, weights, 4);
|
// std::vector<Vec2f> coefficients = polyfit(points, weights, 4);
|
||||||
//
|
//
|
||||||
// // Do alignment - compute fitted point for each point in the string from its Z coord, and store the position into
|
// // Do alignment - compute fitted point for each point in the string from its Z coord, and store the position into
|
||||||
|
@ -87,12 +87,13 @@ public:
|
|||||||
using SeamCandidatesTree =
|
using SeamCandidatesTree =
|
||||||
KDTreeIndirect<3, float, SeamPlacerImpl::SeamCandidateCoordinateFunctor>;
|
KDTreeIndirect<3, float, SeamPlacerImpl::SeamCandidateCoordinateFunctor>;
|
||||||
static constexpr float raycasting_decimation_target_error = 1.0f;
|
static constexpr float raycasting_decimation_target_error = 1.0f;
|
||||||
static constexpr float raycasting_subdivision_target_length = 1.0f;
|
static constexpr float raycasting_subdivision_target_length = 2.0f;
|
||||||
//square of number of rays per triangle
|
//square of number of rays per triangle
|
||||||
static constexpr size_t sqr_rays_per_triangle = 7;
|
static constexpr size_t sqr_rays_per_triangle = 7;
|
||||||
|
|
||||||
// arm length used during angles computation
|
// arm length used during angles computation
|
||||||
static constexpr float polygon_local_angles_arm_distance = 0.5f;
|
static constexpr float polygon_local_angles_arm_distance = 0.5f;
|
||||||
|
static constexpr float additional_angle_importance = 0.3f;
|
||||||
|
|
||||||
// If enforcer or blocker is closer to the seam candidate than this limit, the seam candidate is set to Blocker or Enforcer
|
// If enforcer or blocker is closer to the seam candidate than this limit, the seam candidate is set to Blocker or Enforcer
|
||||||
static constexpr float enforcer_blocker_distance_tolerance = 0.3f;
|
static constexpr float enforcer_blocker_distance_tolerance = 0.3f;
|
||||||
@ -101,7 +102,7 @@ public:
|
|||||||
|
|
||||||
// When searching for seam clusters for alignment:
|
// When searching for seam clusters for alignment:
|
||||||
// following value describes, how much worse score can point have and still be picked into seam cluster instead of original seam point on the same layer
|
// following value describes, how much worse score can point have and still be picked into seam cluster instead of original seam point on the same layer
|
||||||
static constexpr float seam_align_score_tolerance = 0.6f;
|
static constexpr float seam_align_score_tolerance = 0.5f;
|
||||||
// seam_align_tolerable_dist - if seam is closer to the previous seam position projected to the current layer than this value,
|
// seam_align_tolerable_dist - if seam is closer to the previous seam position projected to the current layer than this value,
|
||||||
//it belongs automaticaly to the cluster
|
//it belongs automaticaly to the cluster
|
||||||
static constexpr float seam_align_tolerable_dist = 0.5f;
|
static constexpr float seam_align_tolerable_dist = 0.5f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user