Skip to content

Commit

Permalink
Use new settings for 'inside' detection fuzzy-skin outside-only.
Browse files Browse the repository at this point in the history
Also make the ratio always true even when 0 by replacing < with <=, so fully enclosed areas don't get fuzzed/jittered ever if outside only is on.

part CURA-11887
  • Loading branch information
rburema committed Jul 4, 2024
1 parent 9f6afd3 commit 1e48764
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/FffPolygonGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,8 @@ void FffPolygonGenerator::processFuzzyWalls(SliceMeshStorage& mesh)
constexpr coord_t epsilon = 5; // the distance between two points that are considered to be the same
const coord_t line_width = mesh.settings.get<coord_t>("line_width");
const bool apply_outside_only = mesh.settings.get<bool>("magic_fuzzy_skin_outside_only");
const Ratio inside_max_part_ratio = mesh.settings.get<Ratio>("magic_fuzzy_skin_outside_convex_ratio");
const double inside_min_part_area = MM2_2INT(mesh.settings.get<double>("magic_fuzzy_skin_outside_min_area"));
const coord_t fuzziness = mesh.settings.get<coord_t>("magic_fuzzy_skin_thickness");
const coord_t avg_dist_between_points = mesh.settings.get<coord_t>("magic_fuzzy_skin_point_dist");
const coord_t min_dist_between_points = avg_dist_between_points * 3 / 4; // hardcoded: the point distance may vary between 3/4 and 5/4 the supplied value
Expand Down Expand Up @@ -1125,10 +1127,7 @@ void FffPolygonGenerator::processFuzzyWalls(SliceMeshStorage& mesh)
const auto thick_outline = hole_part.createTubeShape(line_width / 2, 0);
const auto total_area_size = thick_outline.area();
const auto open_area_size = thick_outline.difference(near_shape_area).area();

constexpr double max_ratio = 0.45; // TODO: make this a setting
constexpr coord_t min_part_area = 1000000; // TODO: make this a setting
if ((open_area_size == 0 || hole_part.area() >= min_part_area) && (open_area_size / total_area_size) < max_ratio)
if ((open_area_size == 0 || hole_part.area() >= inside_min_part_area) && (open_area_size / total_area_size) <= inside_max_part_ratio)
{
hole_area.push_back(hole_part);
}
Expand Down

0 comments on commit 1e48764

Please sign in to comment.