Various OrientedBoundingBox, AxisAlignedBoundingBox, BoundingSphere, and Rectangle functions #10130
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 anOrientedBoundingBox
.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 ❓