new Cesium.BoundingSphere(center, radius)

具有中心与半径的边框球体.
Name Type Default Description
center Cartesian3 Cartesian3.ZERO optional The center of the bounding sphere.
radius number 0.0 optional 边界球体的半径.
See:

Members

static Cesium.BoundingSphere.packedLength : number

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

center : Cartesian3

球体的中心点.
Default Value: Cartesian3.ZERO

radius : number

球体的半径.
Default Value: 0.0

Methods

static Cesium.BoundingSphere.clone(sphere, result)BoundingSphere

Duplicates a BoundingSphere instance.
Name Type Description
sphere BoundingSphere 限制球体重复.
result BoundingSphere optional 存储结果的对象 .
Returns:
The modified result parameter or a new BoundingSphere instance if none was provided. (Returns undefined if sphere is undefined)

static Cesium.BoundingSphere.computePlaneDistances(sphere, position, direction, result)Interval

矢量从边框中心到投射方向的距离 +/减去边框的半径.
如果你想象到有正常航向的飞机的无限数量, 这计算出离飞机最小的距离 距离交界球体位置最近最远的飞机.
Name Type Description
sphere BoundingSphere 用来计算距离的边框.
position Cartesian3 计算距离的位置 .
direction Cartesian3 方向从位置.
result Interval optional 一个存储最近最远距离的Interval.
Returns:
距离方位最近最远.

static Cesium.BoundingSphere.distanceSquaredTo(sphere, cartesian)number

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

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

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

static Cesium.BoundingSphere.expand(sphere, point, result)BoundingSphere

通过扩大提供的范围以控制提供的点来计算一个界限范围.
Name Type Description
sphere BoundingSphere 一个扩张的球体.
point Cartesian3 在一个有界限的球体中.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

static Cesium.BoundingSphere.fromBoundingSpheres(boundingSpheres, result)BoundingSphere

计算一个紧凑的边框,其中包含所提供的边框数组.
Name Type Description
boundingSpheres Array.<BoundingSphere> optional 界域数列.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

static Cesium.BoundingSphere.fromCornerPoints(corner, oppositeCorner, result)BoundingSphere

从轴对齐的边框的角点计算一个边框。 领域 紧紧地和完全地囊括了盒子.
Name Type Description
corner Cartesian3 optional 在矩形上的最低高度.
oppositeCorner Cartesian3 optional 最大高度超过矩形.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .
Example:
// Create a bounding sphere around the unit cube
const sphere = Cesium.BoundingSphere.fromCornerPoints(new Cesium.Cartesian3(-0.5, -0.5, -0.5), new Cesium.Cartesian3(0.5, 0.5, 0.5));

static Cesium.BoundingSphere.fromEllipsoid(ellipsoid, result)BoundingSphere

创建包含椭圆的边框.
Name Type Description
ellipsoid Ellipsoid 椭圆形,以周围形成一个边框球体.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .
Example:
const boundingSphere = Cesium.BoundingSphere.fromEllipsoid(ellipsoid);

static Cesium.BoundingSphere.fromEncodedCartesianVertices(positionsHigh, positionsLow, result)BoundingSphere

计算一个紧凑的边框,其中包含一个编码的Cartesian3s的列表,其中的点是 以X,Y,Z,顺序的平行平面阵列存储. 边框通过运行两个来计算 算法,一种天真的算法和Ritter的算法. 两个领域的较小部分用于 保证一个紧身合身.
Name Type Description
positionsHigh Array.<number> optional 一组高位编码的笛卡尔, 绑定球体会将它附着 。 每个点 由排列在X、Y、Z的数组中的三个元素组成.
positionsLow Array.<number> optional 一组低位的编码的笛卡尔, 绑定球体会将它包围 。 每个点 由排列在X、Y、Z的数组中的三个元素组成.
result BoundingSphere optional 存储结果的对象 .
Returns:
未提供修改的结果参数或新的 NT% 0 实例 .
See:

static Cesium.BoundingSphere.fromOrientedBoundingBox(orientedBoundingBox, result)BoundingSphere

计算包含向导边框的紧凑边框.
Name Type Description
orientedBoundingBox OrientedBoundingBox 方向的边框.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

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

计算包含3D笛卡尔点列表的紧凑边框. 极限球是通过运行两个算法,一个天真算法和 瑞特的算法. 两个球体中体积较小的球体用于确保紧合.
Name Type Description
positions Array.<Cartesian3> optional 边框将包含的一系列点。 每点必须拥有 x , y ,以及 z 5 的属性.
result BoundingSphere optional 存储结果的对象 .
Returns:
未提供修改的结果参数或新的 NT% 0 实例 .
See:

static Cesium.BoundingSphere.fromRectangle2D(rectangle, projection, result)BoundingSphere

从2D投影的矩形计算一个边框.
Name Type Default Description
rectangle Rectangle optional 圆形的矩形,以形成一个边框球体.
projection object 地理预测 optional 用于将矩形投射为2D的投影.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

static Cesium.BoundingSphere.fromRectangle3D(rectangle, ellipsoid, surfaceHeight, result)BoundingSphere

从 3D 中的矩形计算一个边框。 边框是使用点数的子样本创建的 在椭圆形上,并包含在矩形上。 对于所有类型椭圆形上的所有矩形可能并不准确.
Name Type Default Description
rectangle Rectangle optional 用于创建边框的有效矩形 .
ellipsoid Ellipsoid Ellipsoid.default optional The ellipsoid used to determine positions of the rectangle.
surfaceHeight number 0.0 optional 椭圆形表面以上的高度.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

static Cesium.BoundingSphere.fromRectangleWithHeights2D(rectangle, projection, minimumHeight, maximumHeight, result)BoundingSphere

从2D投影的矩形计算一个边框. 边界域是指: 物体在矩形上的最低高度和最大高度.
Name Type Default Description
rectangle Rectangle optional 圆形的矩形,以形成一个边框球体.
projection object 地理预测 optional 用于将矩形投射为2D的投影.
minimumHeight number 0.0 optional 矩形上的最低高度.
maximumHeight number 0.0 optional 矩形上的最大高度.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

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

计算一个紧凑的边框, 内含给定的亲缘转换 .
Name Type Description
transformation Matrix4 芳香之变.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

static Cesium.BoundingSphere.fromVertices(positions, center, stride, result)BoundingSphere

计算一个紧凑的边框,其中包含3D点的列表,其中点的位置 以 X, Y, Z, 顺序存储在一个平面阵列中. 边框通过运行两个来计算 算法,一种天真的算法和Ritter的算法. 两个领域的较小部分用于 保证一个紧身合身.
Name Type Default Description
positions Array.<number> | TypedArray optional 边框将包含的一系列点。 每个点 由排列在X、Y、Z的数组中的三个元素组成.
center Cartesian3 Cartesian3.ZERO optional The position to which the positions are relative, which need not be the 坐标系统的源。 当这些职位用于 相对对中心( RTC )渲染.
stride number 3 optional The number of array elements per vertex. It must be at least 3, but it may 高点 无论此参数的值, 第一个位置的 X 坐标 位于数组指数0, Y坐标位于数组指数1, Z坐标位于数组指数 2. 当步向3时,下一个位置的X坐标从数组指数3开始。 若为 但是, 跳过两个阵列元素, 下一个位置从阵列开始 index 5.
result BoundingSphere optional 存储结果的对象 .
Returns:
未提供修改的结果参数或新的 NT% 0 实例 .
Example:
// Compute the bounding sphere from 3 positions, each specified relative to a center.
// In addition to the X, Y, and Z coordinates, the points array contains two additional
// elements per point which are ignored for the purpose of computing the bounding sphere.
const center = new Cesium.Cartesian3(1.0, 2.0, 3.0);
const points = [1.0, 2.0, 3.0, 0.1, 0.2,
              4.0, 5.0, 6.0, 0.1, 0.2,
              7.0, 8.0, 9.0, 0.1, 0.2];
const sphere = Cesium.BoundingSphere.fromVertices(points, center, 5);
See:

static Cesium.BoundingSphere.intersectPlane(sphere, plane)Intersect

确定一个平面的哪一边是球体.
Name Type Description
sphere BoundingSphere 极限的球体测试.
plane Plane 要测试的飞机.
Returns:
Intersect.INSIDE if the entire sphere is on the side of the plane the normal is pointing, Intersect.OUTSIDE if the entire sphere is on the opposite side, and Intersect.INTERSECTING if the sphere 飞机交叉.

static Cesium.BoundingSphere.isOccluded(sphere, occluder)boolean

确定一个球体是否被占地者隐藏在视图中.
Name Type Description
sphere BoundingSphere 围绕被包围物体的边框球体.
occluder Occluder The occluder.
Returns:
如果球体不可见,则使用 NT 0 real NT 1 ;否则使用 NT 2 false NT 3 .

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

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

static Cesium.BoundingSphere.projectTo2D(sphere, projection, result)BoundingSphere

在3D世界坐标的2D中创建一个边界球体.
Name Type Default Description
sphere BoundingSphere 极限球体转换为2D.
projection object 地理预测 optional 投影到二维.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

static Cesium.BoundingSphere.transform(sphere, transform, result)BoundingSphere

将一个4x4的芳基变换矩阵应用到一个边框中.
Name Type Description
sphere BoundingSphere 将变换应用到的界限范围.
transform Matrix4 适用于边框的变换矩阵 .
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

static Cesium.BoundingSphere.transformWithoutScale(sphere, transform, result)BoundingSphere

将一个 4x4 等离子变换矩阵应用到没有尺度的边框 变换矩阵未核实统一比例为1. This method is faster than computing the general bounding sphere transform using BoundingSphere.transform.
Name Type Description
sphere BoundingSphere 将变换应用到的界限范围.
transform Matrix4 适用于边框的变换矩阵 .
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .
Example:
const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid);
const boundingSphere = new Cesium.BoundingSphere();
const newBoundingSphere = Cesium.BoundingSphere.transformWithoutScale(boundingSphere, modelMatrix);

static Cesium.BoundingSphere.union(left, right, result)BoundingSphere

计算包含左右边框的边框.
Name Type Description
left BoundingSphere 一个可以捆绑在边缘的球体.
right BoundingSphere 一个可以捆绑在边缘的球体.
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

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

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

clone(result)BoundingSphere

重复这个 NT+0+ 实例 .
Name Type Description
result BoundingSphere optional 存储结果的对象 .
Returns:
如果未提供修改的结果参数或新的 NT% 0 实例 .

computePlaneDistances(position, direction, result)Interval

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

distanceSquaredTo(cartesian)number

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

equals(right)boolean

Compares this BoundingSphere against the provided BoundingSphere componentwise and returns -NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.
Name Type Description
right BoundingSphere optional 右手侧 NT 0 .
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 sphere is on the side of the plane the normal is pointing, Intersect.OUTSIDE if the entire sphere is on the opposite side, and Intersect.INTERSECTING if the sphere 飞机交叉.

isOccluded(occluder)boolean

确定一个球体是否被占地者隐藏在视图中.
Name Type Description
occluder Occluder The occluder.
Returns:
如果球体不可见,则使用 NT 0 real NT 1 ;否则使用 NT 2 false NT 3 .

volume()number

计算 NT 0 的半径.
Returns:
The radius of the BoundingSphere.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.