Make extrusion_entities_append_paths appends loop if first_point() == last_point()

This commit is contained in:
supermerill 2019-01-23 10:08:16 +01:00
parent 4a540e9a34
commit b07d2461d3

View File

@ -287,9 +287,15 @@ inline void extrusion_entities_append_paths(ExtrusionEntitiesPtr &dst, Polylines
dst.reserve(dst.size() + polylines.size()); dst.reserve(dst.size() + polylines.size());
for (Polyline &polyline : polylines) for (Polyline &polyline : polylines)
if (polyline.is_valid()) { if (polyline.is_valid()) {
ExtrusionPath *extrusion_path = new ExtrusionPath(role, mm3_per_mm, width, height); if (polyline.points.back() == polyline.points.front()) {
dst.push_back(extrusion_path); ExtrusionPath path(role, mm3_per_mm, width, height);
extrusion_path->polyline = polyline; path.polyline.points = polyline.points;
dst.emplace_back(new ExtrusionLoop(std::move(path)));
} else {
ExtrusionPath *extrusion_path = new ExtrusionPath(role, mm3_per_mm, width, height);
dst.push_back(extrusion_path);
extrusion_path->polyline = polyline;
}
} }
} }
@ -298,9 +304,15 @@ inline void extrusion_entities_append_paths(ExtrusionEntitiesPtr &dst, Polylines
dst.reserve(dst.size() + polylines.size()); dst.reserve(dst.size() + polylines.size());
for (Polyline &polyline : polylines) for (Polyline &polyline : polylines)
if (polyline.is_valid()) { if (polyline.is_valid()) {
ExtrusionPath *extrusion_path = new ExtrusionPath(role, mm3_per_mm, width, height); if (polyline.points.back() == polyline.points.front()) {
dst.push_back(extrusion_path); ExtrusionPath path(role, mm3_per_mm, width, height);
extrusion_path->polyline = std::move(polyline); path.polyline.points = polyline.points;
dst.emplace_back(new ExtrusionLoop(std::move(path)));
} else {
ExtrusionPath *extrusion_path = new ExtrusionPath(role, mm3_per_mm, width, height);
dst.push_back(extrusion_path);
extrusion_path->polyline = std::move(polyline);
}
} }
polylines.clear(); polylines.clear();
} }