new Cesium.OrientedBoundingBox(center, halfAxes)

创建 OrientedBoundingBox 实例 . An OrientedBoundingBox of some object is a closed and convex rectangular cuboid. It can provide a tighter bounding volume than BoundingSphere or AxisAlignedBoundingBox in many cases.
Name Type Default Description
center Cartesian3 Cartesian3.ZERO optional The center of the box.
halfAxes Matrix3 Matrix3.ZERO optional The three orthogonal half-axes of the bounding box. 等价转换矩阵,用于旋转和缩放 2x2x2 立方体以原产地为中心.
Example:
// Create an OrientedBoundingBox using a transformation matrix, a position where the box will be translated, and a scale.
const center = new Cesium.Cartesian3(1.0, 0.0, 0.0);
const halfAxes = Cesium.Matrix3.fromScale(new Cesium.Cartesian3(1.0, 3.0, 2.0), new Cesium.Matrix3());

const obb = new Cesium.OrientedBoundingBox(center, halfAxes);
See:

Members

static Cesium.OrientedBoundingBox.packedLength : number

用于将对象组合成数组的元素数量.

center : Cartesian3

箱之中心处.
Default Value: Cartesian3.ZERO

halfAxes : Matrix3

边框的三根正交半轴. 同样 变换矩阵,以旋转和缩放一个以 2x2x2 立方体为中心 origin.
Default Value: Matrix3.ZERO

Methods

static Cesium.OrientedBoundingBox.clone(box, result)OrientedBoundingBox

复制 OrientedBondingBox 实例 .
Name Type Description
box OrientedBoundingBox 要复制的边框 .
result OrientedBoundingBox optional 存储结果的对象 .
Returns:
The modified result parameter or a new OrientedBoundingBox instance if none was provided. (Returns undefined if box is undefined)

static Cesium.OrientedBoundingBox.computeCorners(box, result)Array.<Cartesian3>

Computes the eight corners of an oriented bounding box. The corners are ordered by (-X, -Y, -Z), (-X, -Y, +Z), (-X, +Y, -Z), (-X, +Y, +Z), (+X, -Y, -Z), (+X, -Y, +Z), (+X, +Y, -Z), (+X, +Y, +Z).
Name Type Description
box OrientedBoundingBox 方向的边框.
result Array.<Cartesian3> optional An array of eight Cartesian3 instances onto which to store the corners.
Returns:
如果没有提供修改的结果参数或新数组.

static Cesium.OrientedBoundingBox.computePlaneDistances(box, position, direction, result)Interval

矢量从边框中心到投射方向的距离.
如果你想象到有正常航向的飞机的无限数量, 这计算出离飞机最小的距离 最接近和最远的飞机 离交界箱的位置.
Name Type Description
box OrientedBoundingBox 用于计算距离的边框.
position Cartesian3 计算距离的位置 .
direction Cartesian3 方向从位置.
result Interval optional 一个存储最近最远距离的Interval.
Returns:
边框离方向位置最近最远的地方.

static Cesium.OrientedBoundingBox.computeTransformation(box, result)Matrix4

从方向边框计算变换矩阵.
Name Type Description
box OrientedBoundingBox 方向的边框.
result Matrix4 存储结果的对象 .
Returns:
The modified result parameter or a new Matrix4 instance if none was provided.

static Cesium.OrientedBoundingBox.distanceSquaredTo(box, cartesian)number

计算从边框上最近点到某一点的估计距离.
Name Type Description
box OrientedBoundingBox The box.
cartesian Cartesian3 The point
Returns:
从方向边框到点的距离正方形. 如果点位于框内,则返回 0.
Example:
// Sort bounding boxes from back to front
boxes.sort(function(a, b) {
    return Cesium.OrientedBoundingBox.distanceSquaredTo(b, camera.positionWC) - Cesium.OrientedBoundingBox.distanceSquaredTo(a, camera.positionWC);
});

static Cesium.OrientedBoundingBox.equals(left, right)boolean

比较所提供的 OrientedBoundingBox 组件并返回 -NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.
Name Type Description
left OrientedBoundingBox optional 第一东方宝瓶.
right OrientedBoundingBox optional 第二东方宝瓶.
Returns:
如果左右对等, 则使用 NT 0 true NT 1 , 否则使用 NT 2 false NT 3 .

static Cesium.OrientedBoundingBox.fromPoints(positions, result)OrientedBoundingBox

计算给定位置的 OrientedBoundingBox 实例 . 这是Stefan Gottschalk使用Oriented Boundingboxes溶液( NT 0 论文)进行的碰撞查询的一次执行. 参考: NT 0
Name Type Description
positions Array.<Cartesian3> optional List of Cartesian3 points that the bounding box will enclose.
result OrientedBoundingBox optional 存储结果的对象 .
Returns:
如果不提供修改的结果参数或新的OrientedBoundingBox实例.
Example:
// Compute an object oriented bounding box enclosing two points.
const box = Cesium.OrientedBoundingBox.fromPoints([new Cesium.Cartesian3(2, 0, 0), new Cesium.Cartesian3(-2, 0, 0)]);

static Cesium.OrientedBoundingBox.fromRectangle(rectangle, minimumHeight, maximumHeight, ellipsoid, result)OrientedBoundingBox

Computes an OrientedBoundingBox that bounds a Rectangle on the surface of an Ellipsoid. 约束框的方向没有保障.
Name Type Default Description
rectangle Rectangle 椭圆形表面的制图矩形.
minimumHeight number 0.0 optional 瓦片内最小高度(升降).
maximumHeight number 0.0 optional 瓦片内最大高度(升降).
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid on which the rectangle is defined.
result OrientedBoundingBox optional 存储结果的对象 .
Returns:
没有提供修改的结果参数或新的OrientedBoundingBox实例.
Throws:

static Cesium.OrientedBoundingBox.fromTransformation(transformation, result)OrientedBoundingBox

计算一个将affine转换绑定的OrientedBondingBox.
Name Type Description
transformation Matrix4 芳香之变.
result OrientedBoundingBox optional 存储结果的对象 .
Returns:
没有提供修改的结果参数或新的OrientedBoundingBox实例.

static Cesium.OrientedBoundingBox.intersectPlane(box, plane)Intersect

确定方向边框位于平面的哪一边.
Name Type Description
box OrientedBoundingBox 方向的边框测试.
plane Plane 要测试的飞机.
Returns:
Intersect.INSIDE if the entire box is on the side of the plane the normal is pointing, Intersect.OUTSIDE if the entire box is on the opposite side, and Intersect.INTERSECTING if the box 飞机交叉.

static Cesium.OrientedBoundingBox.isOccluded(box, occluder)boolean

确定边框是否被占地者隐藏在视图中.
Name Type Description
box OrientedBoundingBox 包围 Occulate 对象的边框 .
occluder Occluder The occluder.
Returns:
NT##0 真 NT####1 如果框不可见;否则 NT 2 假 NT 3 .

static Cesium.OrientedBoundingBox.pack(value, array, startingIndex)Array.<number>

将所提供的实例存储到所提供的数组中.
Name Type Default Description
value OrientedBoundingBox 包装的价值.
array Array.<number> 装入的阵列.
startingIndex number 0 optional The index into the array at which to start packing the elements.
Returns:
装入的阵列

static Cesium.OrientedBoundingBox.unpack(array, startingIndex, result)OrientedBoundingBox

从组合的数组中获取实例 .
Name Type Default Description
array Array.<number> 装填的阵列.
startingIndex number 0 optional The starting index of the element to be unpacked.
result OrientedBoundingBox optional 存储结果的对象.
Returns:
如果不提供修改的结果参数或新的OrientedBoundingBox实例.

clone(result)OrientedBoundingBox

复制此 OrientedBoundingBox 实例 .
Name Type Description
result OrientedBoundingBox optional 存储结果的对象 .
Returns:
如果不提供修改的结果参数或新的OrientedBoundingBox实例.

computeCorners(result)Array.<Cartesian3>

Computes the eight corners of an oriented bounding box. The corners are ordered by (-X, -Y, -Z), (-X, -Y, +Z), (-X, +Y, -Z), (-X, +Y, +Z), (+X, -Y, -Z), (+X, -Y, +Z), (+X, +Y, -Z), (+X, +Y, +Z).
Name Type Description
result Array.<Cartesian3> optional An array of eight Cartesian3 instances onto which to store the corners.
Returns:
如果没有提供修改的结果参数或新数组.

computePlaneDistances(position, direction, result)Interval

矢量从边框中心到投射方向的距离.
如果你想象到有正常航向的飞机的无限数量, 这计算出离飞机最小的距离 最接近和最远的飞机 离交界箱的位置.
Name Type Description
position Cartesian3 计算距离的位置 .
direction Cartesian3 方向从位置.
result Interval optional 一个存储最近最远距离的Interval.
Returns:
边框离方向位置最近最远的地方.

computeTransformation(result)Matrix4

从方向边框计算变换矩阵.
Name Type Description
result Matrix4 存储结果的对象 .
Returns:
The modified result parameter or a new Matrix4 instance if none was provided.

distanceSquaredTo(cartesian)number

计算从边框上最近点到某一点的估计距离.
Name Type Description
cartesian Cartesian3 The point
Returns:
估计距离从边框到点均匀.
Example:
// Sort bounding boxes from back to front
boxes.sort(function(a, b) {
    return b.distanceSquaredTo(camera.positionWC) - a.distanceSquaredTo(camera.positionWC);
});

equals(right)boolean

将此 OrientedBondingBox 与所提供的 OrientedBondingBox 组件进行比较,然后返回 -NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.
Name Type Description
right OrientedBoundingBox optional 右手边东方波浪.
Returns:
-NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.

intersectPlane(plane)Intersect

确定方向边框位于平面的哪一边.
Name Type Description
plane Plane 要测试的飞机.
Returns:
Intersect.INSIDE if the entire box is on the side of the plane the normal is pointing, Intersect.OUTSIDE if the entire box is on the opposite side, and Intersect.INTERSECTING if the box 飞机交叉.

isOccluded(occluder)boolean

确定边框是否被占地者隐藏在视图中.
Name Type Description
occluder Occluder The occluder.
Returns:
如果球体不可见,则使用 NT 0 real NT 1 ;否则使用 NT 2 false NT 3 .
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.