Fix SPE-2297 - slowdown after overhang.

The bug lies in the fact that SmoothPathCache comapare path attributes
in `resolve_or_fit_split_with_seam`. For some paths it does the
following: If attributes of paths are the same it merges the paths.

Since the == operator of ExtrusionAttributes did not consider
overhang_attributes in the comparison, some paths were
merged even though they had different overhang_attributes.
This led to the wrong overhang attributes being applied to
some paths.

Now the == operator of ExtrusionAttributes takes overhang_attributes
into account and it fixes the issue.
This commit is contained in:
Martin Šach 2024-05-10 17:04:36 +02:00 committed by Lukas Matena
parent b7ce546cfc
commit 80d35831fa

View File

@ -115,6 +115,19 @@ struct OverhangAttributes {
float proximity_to_curled_lines; //value between 0 and 1
};
inline bool operator==(const OverhangAttributes &lhs, const OverhangAttributes &rhs) {
if (std::abs(lhs.start_distance_from_prev_layer - rhs.start_distance_from_prev_layer) > std::numeric_limits<float>::epsilon()) {
return false;
}
if (std::abs(lhs.end_distance_from_prev_layer - rhs.end_distance_from_prev_layer) > std::numeric_limits<float>::epsilon()) {
return false;
}
if (std::abs(lhs.proximity_to_curled_lines - rhs.proximity_to_curled_lines) > std::numeric_limits<float>::epsilon()) {
return false;
}
return true;
}
struct ExtrusionAttributes : ExtrusionFlow
{
ExtrusionAttributes() = default;
@ -132,7 +145,7 @@ struct ExtrusionAttributes : ExtrusionFlow
inline bool operator==(const ExtrusionAttributes &lhs, const ExtrusionAttributes &rhs)
{
return static_cast<const ExtrusionFlow&>(lhs) == static_cast<const ExtrusionFlow&>(rhs) &&
lhs.role == rhs.role;
lhs.role == rhs.role && lhs.overhang_attributes == rhs.overhang_attributes;
}
class ExtrusionPath : public ExtrusionEntity