Skip to content

Commit

Permalink
Merge branch '5.9' into CURA-12173_fix_infinity_and_beyond
Browse files Browse the repository at this point in the history
  • Loading branch information
HellAholic authored Oct 24, 2024
2 parents 6db4b4f + 3602113 commit 2da46b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
28 changes: 12 additions & 16 deletions src/TreeSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2037,21 +2037,28 @@ void TreeSupport::filterFloatingLines(std::vector<Shape>& support_layer_storage)
{
AABB hole_aabb = AABB(hole);
hole_aabb.expand(EPSILON);
if (! hole.intersection(PolygonUtils::clipPolygonWithAABB(outer_walls, hole_aabb)).empty())
if(hole.size() > 1)
{
// The hole contains other branches! It can not be fully removed.
// This may not fully handle this case as there could be a situation where such a hole becomes invalid, but for now this is the best solution not requiring larger changes.
holes_resting_outside[layer_idx].emplace(idx);
}
else if (hole.intersection(PolygonUtils::clipPolygonWithAABB(relevant_forbidden, hole_aabb)).area() > hole.length() * EPSILON)
else if (! hole.intersection(PolygonUtils::clipPolygonWithAABB(outer_walls, hole_aabb)).empty())
{
holes_resting_outside[layer_idx].emplace(
idx); // technically not resting outside, also not valid, but the alternative is potentially having lines go though the model
holes_resting_outside[layer_idx].emplace(idx);
}
else if (! hole.intersection(PolygonUtils::clipPolygonWithAABB(relevant_forbidden, hole_aabb)).offset(-config.xy_min_distance / 2).empty())
{
// technically not resting outside, also not valid, but the alternative is potentially having lines go through the model
holes_resting_outside[layer_idx].emplace(idx);
}
else
{
for (auto [idx2, hole2] : holeparts[layer_idx - 1] | ranges::views::enumerate)
{
// TODO should technically be outline: Check if this is fine either way as it would save an offset
if (hole_aabb.hit(AABB(hole2))
&& ! hole.intersection(hole2).empty()) // TODO should technically be outline: Check if this is fine either way as it would save an offset
&& ! hole.intersection(PolygonUtils::clipPolygonWithAABB(hole2, hole_aabb)).empty())
{
hole_rest_map[layer_idx][idx].emplace_back(idx2);
}
Expand Down Expand Up @@ -2093,17 +2100,6 @@ void TreeSupport::filterFloatingLines(std::vector<Shape>& support_layer_storage)
if (! found)
{
next_removed_holes_by_idx.emplace(idx);

// Individual pieces of the hole could still be valid (if the 'hole' is made by branches surrounding others' for instance).
for (const auto& poly : hole)
{
if (poly.area() < 0)
{
auto poly_copy = poly;
poly_copy.reverse();
valid_holes[layer_idx].push_back(poly_copy);
}
}
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions src/support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,8 @@ void AreaSupport::generateSupportRoof(SliceDataStorage& storage, const SliceMesh
{
return;
}
const coord_t z_distance_top = round_up_divide(mesh.settings.get<coord_t>("support_top_distance"), layer_height); // Number of layers between support roof and model.
const coord_t support_top_distance = mesh.settings.get<coord_t>("support_top_distance");
const coord_t z_distance_top = round_up_divide(support_top_distance, layer_height); // Number of layers between support roof and model.
const coord_t roof_line_width = mesh_group_settings.get<ExtruderTrain&>("support_roof_extruder_nr").settings_.get<coord_t>("support_roof_line_width");
const coord_t roof_outline_offset = mesh_group_settings.get<ExtruderTrain&>("support_roof_extruder_nr").settings_.get<coord_t>("support_roof_offset");

Expand All @@ -1732,7 +1733,7 @@ void AreaSupport::generateSupportRoof(SliceDataStorage& storage, const SliceMesh
Shape roofs;
generateSupportInterfaceLayer(global_support_areas_per_layer[layer_idx], mesh_outlines, roof_line_width, roof_outline_offset, minimum_roof_area, roofs);
support_layers[layer_idx].support_roof.push_back(roofs);
if (layer_idx > 0 && layer_idx < support_layers.size() - 1)
if (layer_idx > 0 && layer_idx < support_layers.size() - 1 && support_top_distance % layer_height != 0)
{
support_layers[layer_idx].support_fractional_roof.push_back(roofs.difference(support_layers[layer_idx + 1].support_roof));
}
Expand Down

0 comments on commit 2da46b1

Please sign in to comment.