OrientedBoundingBox

new Cesium.OrientedBoundingBox(center, halfAxes)

创建OrientedBoundingBox的实例。 一个物体的定向边界盒是一个封闭的凸长方体。在许多情况下,它可以提供比BoundingSphereAxisAlignedBoundingBox更紧的边界体积。
Name Type Default Description
center Cartesian3 Cartesian3.ZERO optional 盒子的中心。
halfAxes Matrix3 Matrix3.ZERO optional 边界框的三个正交半轴。 等价地,转换矩阵,以旋转和缩放0x0x0 以原点为中心的立方体。
Example:
// Create an OrientedBoundingBox using a transformation matrix, a position where the box will be translated, and a scale.
var center = new Cesium.Cartesian3(1.0, 0.0, 0.0);
var halfAxes = Cesium.Matrix3.fromScale(new Cesium.Cartesian3(1.0, 3.0, 2.0), new Cesium.Matrix3());

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

Members

static Cesium.OrientedBoundingBox.packedLength : Number

用于将对象打包到数组中的元素数。
盒子的中心。
Default Value: Cartesian3.ZERO
变换矩阵,将长方体旋转到正确的位置。
Default Value: Matrix3.ZERO

Methods

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

复制OrientedBoundingBox实例。
Name Type Description
box OrientedBoundingBox 要复制的边界框。
result OrientedBoundingBox optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的OrientedBoundingBox实例(如果未提供)。(如果框未定义,则返回undefined)

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


由矢量计算的从边界框中心到投影到方向的距离。 如果你想象有无限多个法线方向的平面,这将计算到 距与边界框相交位置最近和最远的平面。
Name Type Description
box OrientedBoundingBox 要计算到的距离的边界框。
position Cartesian3 计算距离的位置。
direction Cartesian3 从位置开始的方向。
result Interval optional 存储最近和最远距离的间隔。
Returns:
边界框上距位置方向最近和最远的距离。

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

计算边界框上最近点到点的估计距离平方。
Name Type Description
box OrientedBoundingBox 盒子。
cartesian Cartesian3 要点
Returns:
从边界球到点的估计距离的平方。
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组件并返回 如果相等,则为true,否则为false
Name Type Description
left OrientedBoundingBox 第一个定向边界框。
right OrientedBoundingBox 第二个定向边界框。
Returns:
如果左右相等,则为true,否则为false

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

计算给定位置的OrientedBoundingBox的实例。 这是Stefan Gottschalk的冲突查询的一个实现,使用了定向包围盒解决方案(博士论文)。 参考文献:http://gamma.cs.unc.edu/users/gottschalk/main.pdf
Name Type Description
positions Array.<Cartesian3> optional 边界框将封闭的Cartesian3点的列表。
result OrientedBoundingBox optional 要将结果存储到的对象。
Returns:
修改的结果参数或新的OrientedBoundingBox实例(如果未提供实例)。
Example:
// Compute an object oriented bounding box enclosing two points.
var 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

计算将Rectangle绑定到Ellipsoid曲面上的OrientedBoundingBox。 无法保证边界框的方向。
Name Type Default Description
rectangle Rectangle 椭球面上的制图矩形。
minimumHeight Number 0.0 optional 瓷砖内的最小高度(标高)。
maximumHeight Number 0.0 optional 瓷砖内的最大高度(标高)。
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 定义矩形的椭球体。
result OrientedBoundingBox optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的OrientedBoundingBox实例(如果未提供)。
Throws:

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

确定定向边界框位于平面的哪一侧。
Name Type Description
box OrientedBoundingBox 要测试的定向边界框。
plane Plane 要测试的飞机。
Returns:
Intersect.INSIDE如果整个箱子都在飞机侧面 法线是指向的,如果整个盒子是Intersect.OUTSIDE 在另一边,如果盒子是Intersect.INTERSECTING 与平面相交。

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

确定封堵器是否从边界框中隐藏。
Name Type Description
box OrientedBoundingBox 围绕occludee对象的边界框。
occluder Occluder 封堵器。
Returns:
如果盒子看不见,则为true;否则为false

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

将提供的实例存储到提供的数组中。
Name Type Default Description
value OrientedBoundingBox 要打包的值。
array Array.<Number> 要打包到的数组。
startingIndex Number 0 optional 数组中开始打包元素的索引。
Returns:
被压缩到的数组

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

从压缩数组检索实例。
Name Type Default Description
array Array.<Number> 压缩数组。
startingIndex Number 0 optional 要解包的元素的起始索引。
result OrientedBoundingBox optional 要将结果存储到其中的对象。
Returns:
修改的结果参数或新的OrientedBoundingBox实例(如果未提供实例)。
复制此OrientedBoundingBox实例。
Name Type Description
result OrientedBoundingBox optional 要将结果存储到的对象。
Returns:
修改的结果参数或新的OrientedBoundingBox实例(如果未提供实例)。

computePlaneDistances(position, direction, result)Interval


由矢量计算的从边界框中心到投影到方向的距离。 如果你想象有无限多个法线方向的平面,这将计算到 距与边界框相交位置最近和最远的平面。
Name Type Description
position Cartesian3 计算距离的位置。
direction Cartesian3 从位置开始的方向。
result Interval optional 存储最近和最远距离的间隔。
Returns:
边界框上距位置方向最近和最远的距离。

distanceSquaredTo(cartesian)Number

计算边界框上最近点到点的估计距离平方。
Name Type Description
cartesian Cartesian3 要点
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

将此OrientedBoundingBox与提供的OrientedBoundingBox组件进行比较,然后返回 如果相等,则为true,否则为false
Name Type Description
right OrientedBoundingBox optional 右侧定向接线盒。
Returns:
如果相等,则为true,否则为false

intersectPlane(plane)Intersect

确定定向边界框位于平面的哪一侧。
Name Type Description
plane Plane 要测试的飞机。
Returns:
Intersect.INSIDE如果整个箱子都在飞机侧面 法线是指向的,如果整个盒子是Intersect.OUTSIDE 在另一边,如果盒子是Intersect.INTERSECTING 与平面相交。

isOccluded(occluder)Boolean

确定封堵器是否从边界框中隐藏。
Name Type Description
occluder Occluder 封堵器。
Returns:
如果球体不可见,则为true;否则为false