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-12153] Fix 'encompassing hole' issue (tree support). #2145

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

rburema
Copy link
Member

@rburema rburema commented Oct 9, 2024

When a hole is large enough to wholly contain (sometimes many) other branches, those also get cut. This prevents that. The solution isn't ideal, as there is an offset happening somewhere, but it's better than just missing the top of trees.

When a hole is large enough to wholly contain (sometimes many) other brances, those also get cut. This prevents that. The solution isn't ideal, as there is an offset happening somewhere, but it's better than just missing the top of trees.

CURA-12153
@rburema
Copy link
Member Author

rburema commented Oct 15, 2024

02 MOD.zip

Hi @ThomasRahm -- We've found a bug with this model and partly fixed it in this PR, but the fix isn't ideal because it seems to either skip or do the offset of the holes we keep in the wrong direction. Since this is a bit of an edge case, we're probably not going to return to this anytime soon, but we thought you might like to know (we don't expect anything of course, just a heads-up).

@Vandresc Vandresc merged commit 67f9041 into 5.9 Oct 15, 2024
27 checks passed
@Vandresc Vandresc deleted the CURA-12153_missing_tree_top branch October 15, 2024 10:52
@ThomasRahm
Copy link
Contributor

ThomasRahm commented Oct 21, 2024

@rburema
I can confirm the bug this pull request fixes. But I think it was caused by git!
I vaguely remember the version with
else if (hole.intersection(PolygonUtils::clipPolygonWithAABB(relevant_forbidden, hole_aabb)).area() > hole.length() * EPSILON), but it had issues, which is why I replaced it with the slower but more accurate
else if (! hole.intersection(PolygonUtils::clipPolygonWithAABB(relevant_forbidden, hole_aabb)).offset(-config.xy_min_distance / 2).empty())
Which is present in the pull request #2088
How the former one found its way back into the code-base I do not know.
If only the latter one is used I don't have any issues, even without this workaround.

Bonus performance improvement:
If
&& ! hole.intersection(hole2).empty()) // TODO should technically be outline: Check if this is fine either way as it would save an offset
is replaced with
&& ! hole.intersection(PolygonUtils::clipPolygonWithAABB(hole2, hole_aabb)).empty()) // TODO should technically be outline: Check if this is fine either way as it would save an offset
It is a lot faster for me (15 instead of 53 seconds for the drawing part).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants