ENH: Add rotation support for 3D Honeycomb, improve stability

jira: 6701
Change-Id: I0552f7a7f59d1476f081044411557c96036a2c70
(cherry picked from commit 646fa84d42b926fe9e127a60da9c395baf39fac1)
This commit is contained in:
jianjia.ma 2024-04-03 16:46:17 +08:00 committed by Lane.Wei
parent 0142e0c358
commit 712b724d2a
1 changed files with 22 additions and 9 deletions

View File

@ -195,6 +195,9 @@ void Fill3DHoneycomb::_fill_surface_single(
Polylines &polylines_out)
{
// no rotation is supported for this infill pattern
// BBL: add support for rotation
auto infill_angle = float(this->angle);
if (std::abs(infill_angle) >= EPSILON) expolygon.rotate(-infill_angle);
BoundingBox bb = expolygon.contour.bounding_box();
// Note: with equally-scaled X/Y/Z, the pattern will create a vertically-stretched
@ -266,11 +269,21 @@ void Fill3DHoneycomb::_fill_surface_single(
// clip pattern to boundaries, chain the clipped polylines
polylines = intersection_pl(polylines, to_polygons(expolygon));
// connect lines if needed
// copy from fliplines
if (!polylines.empty()) {
int infill_start_idx = polylines_out.size(); // only rotate what belongs to us.
// connect lines
if (params.dont_connect() || polylines.size() <= 1)
append(polylines_out, chain_polylines(std::move(polylines)));
else
this->connect_infill(std::move(polylines), expolygon, polylines_out, this->spacing, params);
// rotate back
if (std::abs(infill_angle) >= EPSILON) {
for (auto it = polylines_out.begin() + infill_start_idx; it != polylines_out.end(); ++it)
it->rotate(infill_angle);
}
}
}
} // namespace Slic3r