[Suggestion] `OrientedBoundingBox.fromTransformation`
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
https://github.com/CesiumGS/cesium/pull/10130 introduces some new functions, but `OrientedBoundingBox.fromTransformation` confuses me, I think without half scale is better.

The smaller box is computed with `OrientedBoundingBox.fromTransformation`, and bigger box computed without half scale.
code:
```js
function CreateOBBPrimitiveHalfScale(matrix) {
const obb = Cesium.OrientedBoundingBox.fromTransformation(matrix)
const center = obb.center;
const halfAxes = obb.halfAxes;
const tileOBB = new Cesium.TileOrientedBoundingBox(center, halfAxes);
return tileOBB.createDebugVolume(Cesium.Color.YELLOW);
}
function CreateOBBPrimitive(matrix) {
const halfAxes = Cesium.Matrix4.getMatrix3(matrix, new Cesium.Matrix3());
const center = Cesium.Matrix4.getTranslation(matrix, new Cesium.Cartesian3());
const tileOBB = new Cesium.TileOrientedBoundingBox(center, halfAxes);
return tileOBB.createDebugVolume(Cesium.Color.YELLOW);
}
function CreateMatrixPrimitive(matrix) {
const matrixPrimitive = new Cesium.DebugModelMatrixPrimitive({
modelMatrix : matrix,
length : 1.0,
width : 3.0
});
const obbPrimitive = CreateOBBPrimitive(matrix);
const collection = new Cesium.PrimitiveCollection();
collection.add(matrixPrimitive);
collection.add(obbPrimitive);
return collection;
}
viewer.camera.lookAt(Cesium.Cartesian3.fromDegrees(114, 23, 500), new Cesium.Cartesian3(0.1, 0, 0));
const M = viewer.camera.inverseViewMatrix.clone();
const p1 = CreateMatrixPrimitive(M);
viewer.scene.primitives.add(p1);
const p2 = CreateOBBPrimitiveHalfScale(M);
viewer.scene.primitives.add(p2);
viewer.camera.lookAt(Cesium.Cartesian3.fromDegrees(114, 23, 500), new Cesium.Cartesian3(20, 20, 0));
```
[sandcastle](https://sandcastle.cesium.com/#c=zVVRb9owEP4rFi8NUmQIdC+DohVaadNgmVbWqRIvxjmoVcdGtgO0U//7HDuBBNL1adKiPMR33313991hqBTaoC2DHSh0hQTs0AQ0y1J872zBokXdeSKFIUyAWrTag4VYiAL2RQqcwIpk3FxTC9Vz+QTCUl08xD9/oHn89fbbhQtYZYIaJgWaKCAG4vH4u2IpM2wLnwlf3VHCIUiJUWzfRr8XAiHqipPLpaUr0sWKgTCQjGUmEibWY7nHKyXTuSJCr6Sy8TZFSXMkoXlU3qFlw/4wOHofbf7rPejCXx5d2SXGMJ7XXBdpnhvPSwp8hvBA3HbJFJhMiZIJU6fDDSyz9b3kWQpBwTqRXCr8cDudxr/yyNd35GtSrdJSwTpzoEu8BuM/+0VcWO2odLXbgwb1zqmc8Lyqeo1uQpSxX0QUjP+tnr6lv0qa1iH1yl3amUyAnzI5BoTSow99LLhC7+Ig1ubRWiPcLUw7ljhLH3dzw2t1GnZFq0W8vQ/VCUrOwfdbK/sQMzkAgjKuNGCSJMFJ842YamG1CR1xpfr+xsGUpKAI5lI+XZvgbGfcT/sG1gpAB1F0GaJeP0Qfut32W0vWxVGIuvYt9rfhedPslZpZgerVMbEFpSG/EP38MOVSQOD32UdtosMkTuc/y3EFo7aLDHhT+rSTbRPVmHqNMz1eke/z9Tzfv9K4Z/XtHTRuha2hNs8cRqWwn1i6kcqgTPEA446BdGMvCNCdZUafwGCqdTmcYacaOkzYFrHkquE/B1FOtLaeVcb5HXuBRWs07Fj8WSiXJL81YjszTp5z2GM0mnojxnjYscfmSCMlXxJ1wvwH)
Contributor guide
Research direction
Start by reviewing OrientedBoundingBox.fromTransformation and the behavior introduced by pull request #10130, then reproduce the two bounding-box results using the linked Sandcastle example. Determine whether the half-scale behavior is intended and what change or clarification is needed; done means the expected transformation semantics are agreed and reflected in the implementation or documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100