ENH: fix 0 space exception when slicing

JIRA: none. found by cli slicing

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: I47a754e99e193394b0d34cd05e27304910af521f
This commit is contained in:
salt.wei 2023-10-07 17:29:50 +08:00 committed by Lane.Wei
parent 3059b49199
commit adce446e38
1 changed files with 2 additions and 2 deletions

View File

@ -123,11 +123,11 @@ static ExtrusionPaths thick_polyline_to_extrusion_paths_2(const ThickPolyline& t
if (start_index != i){
path = ExtrusionPath(role);
double length = lines[start_index].length();
double sum = lines[start_index].length() * lines[start_index].a_width;
double sum = lines[start_index].length() * 0.5 * (lines[start_index].a_width + lines[start_index].b_width);
path.polyline.append(lines[start_index].a);
for (int idx = start_index + 1; idx < i; idx++) {
length += lines[idx].length();
sum += lines[idx].length() * lines[idx].a_width;
sum += lines[idx].length() * 0.5 * (lines[idx].a_width + lines[idx].b_width);
path.polyline.append(lines[idx].a);
}
path.polyline.append(lines[i].a);