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

Various OrientedBoundingBox, AxisAlignedBoundingBox, BoundingSphere, and Rectangle functions #10130

Merged
merged 2 commits into from
Feb 24, 2022

Conversation

IanLilleyT
Copy link
Contributor

@IanLilleyT IanLilleyT commented Feb 23, 2022

Merge #10124 first.

This could have been split up into 6 small PRs, but they're all kinda similar and hopefully non-controversial. These functions aren't used in CesiumJS yet, but I have a private branch that does use all of them. Plus, I think these functions will be useful for other things. They all have 100% coverage.

I put a ❓ where I wasn't sure about naming. Let me know.

AxisAlignedBoundingBox.fromCorners

Basically identical to the AxisAlignedBoundingBox constructor. It exists so that you can use a result parameter instead of allocating.

BoundingSphere.fromTransformation

Pretty similar to BoundingSphere.fromOrientedBoundingBox, but avoids the intermediate conversion to an OrientedBoundingBox.

OrientedBoundingBox.fromTransformation

The box's center becomes the translation and the half axes become the top left Matrix3 (but with half the scale).

OrientedBoundingBox.computeTransformation

Opposite of OrientedBoundingBox.fromTransformation. Is this a good name ❓

OrientedBoundingBox.computeCorners

Computes the eight corners of the OrientedBoundingBox and stores them in an array. Useful for debug visualizations or as an intermediate step for other algorithms.

Rectangle.subsection

Returns a subsection (aka patch / subregion / etc) of a rectangle given interpolation factors for west, south, east, and north. Is this a good name ❓

@cesium-concierge
Copy link

Thanks for the pull request @IanLilleyT!

  • ✔️ Signed CLA found.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.

@ggetz
Copy link
Contributor

ggetz commented Feb 23, 2022

Thanks @IanLilleyT! @sanjeetsuhag Could you please review?

@IanLilleyT IanLilleyT force-pushed the obbConversion branch 2 times, most recently from 34bb6c5 to 41105a3 Compare February 23, 2022 14:47
Copy link
Contributor

@sanjeetsuhag sanjeetsuhag left a comment

Choose a reason for hiding this comment

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

@IanLilleyT The code here mostly looks good. The only suggested change I have is in the JSDoc.

Regarding computeTransformation, could you give a use case for this function? I think that will help us decide if it's the right name for this or not.

Regarding subsection, would inset work here? Semantically, would that be more appropriate?

Source/Core/AxisAlignedBoundingBox.js Outdated Show resolved Hide resolved
Base automatically changed from matrixFunctions to main February 23, 2022 20:49
Copy link
Contributor

@sanjeetsuhag sanjeetsuhag left a comment

Choose a reason for hiding this comment

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

Changes look good. Thanks @IanLilleyT!

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

Successfully merging this pull request may close these issues.

None yet

4 participants