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

Additional OrientedBoundingBox functionality #12178

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

javagl
Copy link
Contributor

@javagl javagl commented Sep 1, 2024

Description

Added a few functions to the OrientedBoundingBox class:

  • fromMinMax computes an OBB from given min/max points
  • transform transforms an OBB with a matrix
  • intersect tests for intersection between two OBBs

The first ones are rather simple "convenience" functions. I used these functions, for example, in #12112 , but there, only 'drafted' them, still outside of the OrientedBoundingBox class.

The intersect function is a bit more involved. It implements the "Separating Axis Theorem", as described in https://gamma.cs.unc.edu/users/gottschalk/main.pdf . Strangely, this function already did exist, back when there was still a class called ObjectOrientedBoundingBox. This class was deprecated in #2782 and eventually removed, without a replacement for the intersect function. So I'm not even 100% sure whether it should be added again 😬

Issue number and link

No specific issue, but ...

Testing plan

In addition to the Specs/UnitTests, the following is a sandcastle that can be used for testing the intersect function this when running this branch on localhost:

http://localhost:8080/Apps/Sandcastle/#c=3Vhtb9s2EP4rhL9ExlzZWpqt0FxvdZJlBtq4SJMtMgwUlETbQijJkKjEbpH/viMpipL8kqSxjWFFapA88l6eO94d5cVRytB9QB5Igt6jiDygU5IGWWj+LdaMccMT89M4YjiISDJutND3cYTQlMYusdEE05S0xtFj87dxNI4mWeSxII6QlxDMyOckCAMW3BMjdt0W8mIaJ0153hOipyQOCUuWVeH9eDHMGAV5FzndEGcQCoMoCLPQLu8+xQmDEY6OjTeW2Wkh/dts5cfwYtsxsV/9yDPCHqVlGPuEfsIsCRagaH5ezt+akyQOr2KGudnXCY5SKoaGlAx2mzNMJx8WJG3pJY9EDMCEeVlOAD848kgVDYXBIKcqLBR2djFS1mp17fIkJ2MGEzcD422Us0LSNXaBDZ/V5X5Q54TJYoshPZozfiwjlxCWJVHZDh0MNQOUANBHIaBUnc8JTvhCxXWf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U7ezFw6bzvZ2U4elXqtSrsHsJVrgd5QVABdDoQfik8C+pquuTJmkft4I94RTw5L16qYEpPGU4iMgdqHxg3ouINmLmRTh5yQMJbdvb51hVl6qYiG1edv0bKrPjRAv1c+L5hX52eo+sXB7H+8OdcIbmvfVzR7oTXWqjXWFms4rq2qrhdX5+eXL1PUeqailSQmReDa02bbg6xTvN/qOQAyxtBNSXKPXcjypRwwbohLC5nDTDM39ZLAJYZMAetyyRN8nB3xGe2Aj0wZu2Lk7IrRLkyTCWtXjJxdMdpo2jhSRQUm9W88ImgbrUY3ZUtKejzm/wjCeZwwlCXUMM02I+EcHtUkbbuZd0eY6aXis0q3rY50/eAeBf77NV+tkUdxmgJlklH6BWJr3Oh127C/cozGmGfW4T1JKF7yLTOr91EumqbZbcN09VRRdoXWXcZx6cmk12Vu7C976nXeZUlPv/O7zO+Ja9dtw6i6rmcwD6J5Bh3Ack5AWsK7bjAoDCKYQQvGx3gBY/ElAGYpI3M+hSHAjd+4UPRhLrpvO3/Ly178RvjDRkdCwlFuwXq5jCwYZw7HYXayhXmFTcU2mCRPgOEcHAxnn2A4rwJjdHAwRvsEY/TDYMgsflA01Bem/cChytJr8HAOj4ezVzyc1+ExOjweo73i8eP3RbYGu8Lj3dNoSIH7QkN1Oq9Bwzk0Gs5e0XBeh8bo0GiM9orG824KDIt2DMZ5n6Yaun8B

It uses one fixed bounding box, and allows editing the size, position, and orientation of the other one, showing the other one in red when they intersect (and printing infos to the console)

Cesium OBB Sandcastle

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code
Copy link

github-actions bot commented Sep 1, 2024

Thank you for the pull request, @javagl!

✅ We can confirm we have a CLA on file for you.

@ggetz
Copy link
Contributor

ggetz commented Sep 10, 2024

@lukemckinstry Could you please give this a first review pass?

@lukemckinstry
Copy link
Contributor

@javagl can you help connect the dots for me on how these functions are helping solve the core issue? #12108

@ggetz
Copy link
Contributor

ggetz commented Sep 19, 2024

@javagl To clarify what we spoke about offline, you mentioned that the intersect functionality is not strictly needed in support of #12112, is that correct?

If so, what do you think of removing that for the time being in the interest of getting this merged?

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