Skip to content

Commit

Permalink
[CURA-11395] Prevent islands in smoothed raft. (#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
casperlamboo authored Jan 18, 2024
2 parents 8ad432e + 30d26d7 commit b4de943
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/raft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void Raft::generate(SliceDataStorage& storage)
storage.raftInterfaceOutline = storage.raftInterfaceOutline.unionPolygons(ooze_shield_raft);
}

const auto remove_inside_corners = [](Polygons& outline, bool remove_inside_corners, coord_t smoothing)
const auto remove_inside_corners = [](Polygons& outline, bool remove_inside_corners, coord_t smoothing, coord_t line_width)
{
if (remove_inside_corners)
{
Expand Down Expand Up @@ -106,12 +106,25 @@ void Raft::generate(SliceDataStorage& storage)
}
else
{
// Closing operation for smoothing:
outline = outline.offset(smoothing, ClipperLib::jtRound).offset(-smoothing, ClipperLib::jtRound);

// Opening operation to get rid of articfacts created by the closing operation:
outline = outline.offset(-line_width, ClipperLib::jtRound).offset(line_width, ClipperLib::jtRound);
}
};
remove_inside_corners(storage.raftBaseOutline, settings.get<bool>("raft_base_remove_inside_corners"), settings.get<coord_t>("raft_base_smoothing"));
remove_inside_corners(storage.raftInterfaceOutline, settings.get<bool>("raft_interface_remove_inside_corners"), settings.get<coord_t>("raft_interface_smoothing"));
remove_inside_corners(storage.raftSurfaceOutline, settings.get<bool>("raft_surface_remove_inside_corners"), settings.get<coord_t>("raft_surface_smoothing"));
const auto nominal_raft_line_width = settings.get<coord_t>("skirt_brim_line_width");
remove_inside_corners(storage.raftBaseOutline, settings.get<bool>("raft_base_remove_inside_corners"), settings.get<coord_t>("raft_base_smoothing"), nominal_raft_line_width);
remove_inside_corners(
storage.raftInterfaceOutline,
settings.get<bool>("raft_interface_remove_inside_corners"),
settings.get<coord_t>("raft_interface_smoothing"),
nominal_raft_line_width);
remove_inside_corners(
storage.raftSurfaceOutline,
settings.get<bool>("raft_surface_remove_inside_corners"),
settings.get<coord_t>("raft_surface_smoothing"),
nominal_raft_line_width);

if (storage.primeTower.enabled_ && ! storage.primeTower.would_have_actual_tower_)
{
Expand Down

0 comments on commit b4de943

Please sign in to comment.