ENH: protect for accuracy issue

Jira: none

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: Ief104b8ea449e1292db5bd3847ecea779bccff39
This commit is contained in:
qing.zhang 2024-10-22 15:48:50 +08:00 committed by Lane.Wei
parent 3e9006e2d4
commit 6201da0a6d
1 changed files with 2 additions and 1 deletions

View File

@ -551,7 +551,8 @@ ExtrusionLoopSloped::ExtrusionLoopSloped( ExtrusionPaths &original_paths,
paths.emplace_back(std::move(flat_path), *path);
remaining_length = 0;
} else {
remaining_length -= path_len;
// BBS: protection for accuracy issues
remaining_length = remaining_length - path_len < EPSILON ? 0 : remaining_length - path_len;
const double end_ratio = lerp(1.0, start_slope_ratio, remaining_length / slope_min_length);
add_slop(*path, path->polyline, start_ratio, end_ratio);
start_ratio = end_ratio;