Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CURA-12173] Only perform 'tiny loops' fix if there's space to do so. #2153

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/infill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,12 +931,15 @@ void Infill::connectLines(OpenLinesSet& result_lines)
}
else
{
constexpr coord_t epsilon_sqd = 25;

// Resolve any intersections of the fill lines close to the boundary, by inserting extra points so the lines don't create a tiny 'loop'.
Point2LL intersect;
if (vSize2(previous_point - next_point) < half_line_distance_squared
&& LinearAlg2D::lineLineIntersection(previous_segment->start_, previous_segment->end_, crossing->start_, crossing->end_, intersect)
&& LinearAlg2D::pointIsProjectedBeyondLine(intersect, previous_segment->start_, previous_segment->end_) == 0
&& LinearAlg2D::pointIsProjectedBeyondLine(intersect, crossing->start_, crossing->end_) == 0)
&& LinearAlg2D::pointIsProjectedBeyondLine(intersect, crossing->start_, crossing->end_) == 0 && vSize2(previous_point - intersect) > epsilon_sqd
&& vSize2(next_point - intersect) > epsilon_sqd)
{
resolveIntersection(infill_line_width_, intersect, previous_point, next_point, previous_segment, crossing);
}
Expand Down
Loading