-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Improved degenerate barycentric check #9175
Conversation
Thanks for the pull request @IanLilleyT!
Reviewers, don't forget to make sure that:
|
One potential issue is that the code will return (1,0,0) even if the point doesn't touch the degenerate triangle. Another approach might be to throw an error if the triangle is degenerate, which could occur whenever it's zero area (not just collinear). |
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
3 similar comments
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 90 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 90 days. If you'd like me to stop, just comment with |
1 similar comment
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 90 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 90 days. If you'd like me to stop, just comment with |
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 90 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 90 days. If you'd like me to stop, just comment with |
Since barycentric coordinates are not well defined for degenerate triangles we decided to return |
When the three points given to the barycentric function are colinear (which is not a valid triangle), the barycentric calculation will return a nan by doing 0/0. This new check safeguards against that happening, and ends up returning
1,0,0
.Also I replaced the old spec because it seemed to be doing the same thing as
evaluates on the p0-p1 edge
test and also altered thep0
var which could be used for future tests (but luckily wasn't).