-
Notifications
You must be signed in to change notification settings - Fork 448
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
Math: add AABB and bounding sphere algorithms #557
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you!
Mostly just minor / style things, nothing serious.
Thanks for the thorough review, much appreciated 😊 There's one open question regarding numerical stability, I'll get back to you on that after some reading. Note: I force-pushed all the minor fixes into the initial commit (since the commit message was wrong, it had the |
Codecov Report
@@ Coverage Diff @@
## master #557 +/- ##
===========================================
- Coverage 83.84% 66.67% -17.17%
===========================================
Files 523 483 -40
Lines 33893 30070 -3823
===========================================
- Hits 28417 20050 -8367
- Misses 5476 10020 +4544
Continue to review full report at Codecov.
|
Thank you! Merged as 7f4500d...90b5379. While cross-linking those with the algorithms in |
👋 This PR adds a function for generating (approximate) bounding spheres to
MeshTools
. It lives in the newBoundingVolume.h
header (+ matching.cpp
).The algorithm used is "Bouncing Bubble: A fast algorithm for Minimal Enclosing Ball problem", specifically the "Ritter substitution algorithm" proposed in the paper. Time complexity between Ritter and this algorithm is identical (3 passes over all position values) but it produces spheres with smaller radius. One side effect of this algorithm is that the radius is always at least some minimal hard-coded value, currently set to
TypeTraits<Float>::epsilon()
. Since the use case for this function is primarily expected to be some sort of culling, this seems acceptable to me.Because it was pretty straight-forward, I also added a function for generating axis-aligned bounding boxes. It's just a wrapper around
minmax()
but it doesn't hurt to have.