mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 01:25:59 +08:00
additional minor fixes and simplifications
This commit is contained in:
parent
355e3ba03a
commit
b88ab02d1c
@ -678,7 +678,8 @@ struct SeamComparator {
|
||||
}
|
||||
|
||||
//avoid overhangs
|
||||
if (a.overhang > 0.1f || b.overhang > 0.1f) {
|
||||
if (a.overhang > SeamPlacer::overhang_distance_tolerance_factor * a.perimeter.flow_width ||
|
||||
b.overhang > SeamPlacer::overhang_distance_tolerance_factor * b.perimeter.flow_width) {
|
||||
return a.overhang < b.overhang;
|
||||
}
|
||||
|
||||
@ -738,7 +739,8 @@ struct SeamComparator {
|
||||
}
|
||||
|
||||
//avoid overhangs
|
||||
if (a.overhang > 0.1f || b.overhang > 0.1f) {
|
||||
if (a.overhang > SeamPlacer::overhang_distance_tolerance_factor * a.perimeter.flow_width ||
|
||||
b.overhang > SeamPlacer::overhang_distance_tolerance_factor * b.perimeter.flow_width) {
|
||||
return a.overhang < b.overhang;
|
||||
}
|
||||
|
||||
@ -761,7 +763,6 @@ struct SeamComparator {
|
||||
return a.position.y() > b.position.y();
|
||||
}
|
||||
|
||||
//ranges: [0 - 1] (0 - 1.3] ;
|
||||
float penalty_a = a.visibility
|
||||
+ SeamPlacer::angle_importance * compute_angle_penalty(a.local_ccw_angle);
|
||||
float penalty_b = b.visibility +
|
||||
@ -780,11 +781,8 @@ struct SeamComparator {
|
||||
// looks scary, but it is gaussian combined with sigmoid,
|
||||
// so that concave points have much smaller penalty over convex ones
|
||||
// https://github.com/prusa3d/PrusaSlicer/tree/master/doc/seam_placement/corner_penalty_function.png
|
||||
float f_value = gauss(ccw_angle, 0.0f, 1.0f, 3.0f) +
|
||||
1.0f / (2 + std::exp(-ccw_angle)); // sigmoid, which heavily favourizes concave angles
|
||||
//NOTE for very small angles, the noise in the angle computation cause aligned lines curving.
|
||||
//for this reason, the value will be clamped to 1.2 value, throwing away angles roughly smaller than 30 degrees
|
||||
return std::min(f_value, 1.2f);
|
||||
return gauss(ccw_angle, 0.0f, 1.0f, 3.0f) +
|
||||
1.0f / (2 + std::exp(-ccw_angle));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -121,6 +121,11 @@ public:
|
||||
// arm length used during angles computation
|
||||
static constexpr float polygon_local_angles_arm_distance = 0.1f;
|
||||
|
||||
|
||||
// max tolerable distance from the previous layer is overhang_distance_tolerance_factor * flow_width
|
||||
static constexpr float overhang_distance_tolerance_factor = 0.5f;
|
||||
|
||||
|
||||
// determines angle importance compared to visibility ( neutral value is 1.0f. )
|
||||
static constexpr float angle_importance = 0.7f;
|
||||
|
||||
@ -131,7 +136,7 @@ public:
|
||||
|
||||
// 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
|
||||
static constexpr float seam_align_score_tolerance = 0.2f;
|
||||
static constexpr float seam_align_score_tolerance = 0.27f;
|
||||
// seam_align_tolerable_dist - if next layer closes point is too far away, break string
|
||||
static constexpr float seam_align_tolerable_dist = 1.0f;
|
||||
// if the seam of the current layer is too far away, and the closest seam candidate is not very good, layer is skipped.
|
||||
@ -140,7 +145,7 @@ public:
|
||||
// minimum number of seams needed in cluster to make alignment happen
|
||||
static constexpr size_t seam_align_minimum_string_seams = 6;
|
||||
// points covered by spline; determines number of splines for the given string
|
||||
static constexpr size_t seam_align_seams_per_segment = 14;
|
||||
static constexpr size_t seam_align_seams_per_segment = 8;
|
||||
|
||||
//The following data structures hold all perimeter points for all PrintObject.
|
||||
std::unordered_map<const PrintObject*, PrintObjectSeamData> m_seam_per_object;
|
||||
|
Loading…
x
Reference in New Issue
Block a user