-
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
Account for degenerate axes of OrientedBoundingBox in distanceSquaredTo #9670
Conversation
Thanks for the pull request @j9liu!
Reviewers, don't forget to make sure that:
|
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.
Overall the approach makes sense and it fits into the current algorithm cleanly, though it feels a little verbose and I wonder if specialized distance functions for each degenerate axes case would be less code and/or faster. The non-degenerate case ought to run fast still which is most important.
Since distanceSquaredTo
is a hotspot in the code it would be worth benchmarking. The benchmark should create some randomly sized, non-degenerate OBBs, and call distanceSquaredTo
multiple times for each. You can look at @sanjeetsuhag's sandcastles in #9599 for reference. Make sure to test with the built version of CesiumJS (npm run minifyRelease
npm run combineRelease
, npm run buildApps
, then go to http://localhost:8080/Build/Apps/Sandcastle/index.html). Run the benchmark on this branch and master
.
Other than that, very robust tests like usual!
EDIT: truncated the numbers for easier reading. @lilleyse - Here's the benchmark sandcastle (localhost) I used to get the following numbers:
It seems that right now, |
I'm seeing similar results on Firefox Linux: 0.013468 ( |
I confirmed this fixes the particle system crash in #9658 when @kring @baothientran would you like to review as well? Assuming this makes its way back to cesium-native. |
I'm going to merge - but any more feedback is welcome after. Thanks @j9liu! |
Fixes #9658. Before normalizing the
halfAxes
, the function will check if their magnitude is nonzero. If not, it will generate new substitute axes based on which ones are degenerate, then proceed with the same algorithm. I added a bunch of specs to account for these changes.I'm sure the code organization / style can be cleaned up a bit. @lilleyse - do you mind taking a look?