Cesium 获取 3dtileset的包围盒各顶点坐标
export function getTilesetBoudingBoxPoints(tileset, options = {}) {
const { center, halfAxes } = tileset._root._boundingVolume._orientedBoundingBox;
const pointsVec3 = [];
const x = new Cartesian3();
const y = new Cartesian3();
const z = new Cartesian3();
Matrix3.getColumn(halfAxes, 0, x);
Matrix3.getColumn(halfAxes, 1, y);
Matrix3.getColumn(halfAxes, 2, z);
const halfXNegative = new Cartesian3();
const halfXPositive = new Cartesian3();
Cartesian3.subtract(center, x, halfXNegative)
Cartesian3.add(center, x, halfXPositive)
Cartesian3.subtract(halfXNegative, z, halfXNegative)
Cartesian3.subtract(halfXPositive, z, halfXPositive)
pointsVec3.push(Cartesian3.add(halfXNegative, y, new Cartesian3()))
pointsVec3.push(Cartesian3.subtract(halfXNegative, y, new Cartesian3()))
pointsVec3.push(Cartesian3.subtract(halfXPositive, y, new Cartesian3()))
pointsVec3.push(Cartesian3.add(halfXPositive, y, new Cartesian3()))
const pointsLL = [];
pointsVec3.forEach(item=>{
const ll = Cartographic.fromCartesian(item);
pointsLL.push(
Math.toDegrees(ll.longitude),
Math.toDegrees(ll.latitude),
)
})
return pointsLL;
}