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

Fix infinite loop in CSG Build2DFaces::_find_edge_intersections #76521

Merged
merged 1 commit into from
Apr 28, 2023

Conversation

justinwash
Copy link
Contributor

@justinwash justinwash commented Apr 27, 2023

Remaking this PR since I destroyed the last one doing git things... Sorry!

This PR solves issue #73927 in which _find_edge_intersections could loop infinitely while creating new faces from edge intersections by keeping track of which edges we have already processed and skipping edges with the same points and uvs that come up in subsequent loops.

Had some concern about the glitchy faces that appear in subtract mode, but that appears to also occur in the most recent master post- #74771 so I'm not sure they really need to be covered in this fix, or if its even related.

This branch working:
https://user-images.githubusercontent.com/6236852/234983317-df6c0734-25f3-4790-80c6-24844062dde8.mp4

Most recent Master branch crashing, also exhibiting similar geometry wonkiness:
https://user-images.githubusercontent.com/6236852/234984769-620a2f24-968e-4a08-9a56-f4cc383c6d27.mp4

This also includes the suggested edit of using LocalVector instead of Vector to hold the processed edges. More context here #76520 (comment)

Production edit: Fixes #73927

@justinwash
Copy link
Contributor Author

Looks like I missed an initialization. Fixing now.

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw the videos of the fix for the infinite loop and it seems to resolve the error.

The video also didn't seem laggy, don't have a performance test. Wanted to check the run-time complexity of the arrays (Vectors) but it's probably fine.

Looks good to me.

@akien-mga akien-mga merged commit 9f12e7b into godotengine:master Apr 28, 2023
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@justinwash
Copy link
Contributor Author

Thank you!

@akien-mga
Copy link
Member

Cherry-picked for 4.0.3.

@akien-mga akien-mga changed the title Fix infinite loop in Build2DFaces::_find_edge_intersections Fix infinite loop in CSG Build2DFaces::_find_edge_intersections May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editor freezes and crashes when editing CSG blocks (CSGCombiner issue)
4 participants