Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Hejl <hejl.lukas@gmail.com>2022-07-14 09:58:08 +0300
committerLukáš Hejl <hejl.lukas@gmail.com>2022-07-14 10:10:25 +0300
commitb4ff9b72a95e38b60fc756a5cd8a1964340f06d9 (patch)
tree07f5d8569c7d3566592c6b4845e06252cc2de6e3
parente2e127200341da2ad5d26390538fe766435acc21 (diff)
Fix of #8455 - Incorrect scale in ExtrusionLine::simplify() prevented removing vertices between collinear and nearly collinear lines.
-rw-r--r--src/libslic3r/Arachne/utils/ExtrusionLine.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp
index 4ddbb01d1..6a6ac0f0f 100644
--- a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp
+++ b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp
@@ -112,11 +112,11 @@ void ExtrusionLine::simplify(const int64_t smallest_line_segment_squared, const
//h = L / b [divide by b]
//h^2 = (L / b)^2 [square it]
//h^2 = L^2 / b^2 [factor the divisor]
- const int64_t height_2 = int64_t(double(area_removed_so_far) * double(area_removed_so_far) / double(base_length_2));
- coord_t weighted_average_width;
+ const auto height_2 = int64_t(double(area_removed_so_far) * double(area_removed_so_far) / double(base_length_2));
+ coord_t weighted_average_width;
const int64_t extrusion_area_error = calculateExtrusionAreaDeviationError(previous, current, next, weighted_average_width);
- if ((height_2 <= 1 //Almost exactly colinear (barring rounding errors).
- && Line::distance_to_infinite(current.p, previous.p, next.p) <= 1.) // Make sure that height_2 is not small because of cancellation of positive and negative areas
+ if ((height_2 <= scaled<coord_t>(0.001) //Almost exactly colinear (barring rounding errors).
+ && Line::distance_to_infinite(current.p, previous.p, next.p) <= scaled<double>(0.001)) // Make sure that height_2 is not small because of cancellation of positive and negative areas
// We shouldn't remove middle junctions of colinear segments if the area changed for the C-P segment is exceeding the maximum allowed
&& extrusion_area_error <= maximum_extrusion_area_deviation)
{