BoundingSphere

new Cesium.BoundingSphere(center, radius)

有中心和半径的边界球体。
Name Type Default Description
center Cartesian3 Cartesian3.ZERO optional 边界球体的中心。
radius Number 0.0 optional 边界球体的半径。
See:

Members

static Cesium.BoundingSphere.packedLength : Number

用于将对象打包到数组中的元素数。
球体的中心点。
Default Value: Cartesian3.ZERO

radius : Number

球体的半径。
Default Value: 0.0

Methods

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

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

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


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

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

计算从边界球体上最近的点到点的估计距离平方。
Name Type Description
sphere BoundingSphere 球体。
cartesian Cartesian3 要点
Returns:
从边界球到点的估计距离的平方。
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

比较提供的BoundingSphere组件并返回 如果相等,则为true,否则为false
Name Type Description
left BoundingSphere optional 第一个边界球。
right BoundingSphere optional 第二个边界球。
Returns:
如果左右相等,则为true,否则为false

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

通过扩大提供的球体以包含提供的点来计算边界球体。
Name Type Description
sphere BoundingSphere 要展开的球体。
point Cartesian3 包围在边界球体中的点。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

计算包围提供的边界球体数组的紧密拟合边界球体。
Name Type Description
boundingSpheres Array.<BoundingSphere> optional 边界球的数组。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

从轴对齐边界框的角点计算边界球体。球体 虎视眈眈地把盒子抱起来。
Name Type Description
corner Cartesian3 optional 矩形上的最小高度。
oppositeCorner Cartesian3 optional 矩形上的最大高度。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。
Example:
// Create a bounding sphere around the unit cube
var 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:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。
Example:
var boundingSphere = Cesium.BoundingSphere.fromEllipsoid(ellipsoid);

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

计算一个紧拟合的包围球体,该球体包含一个编码的cartesian3列表,其中的点 以X,Y,Z顺序存储在平行平面阵列中。边界球是通过运行2 算法,朴素算法和里特算法。两个球体中较小的一个用来 确保紧密配合。
Name Type Description
positionsHigh Array.<Number> optional 边界球将包围的编码笛卡尔数的高位数组。每个点 由数组中按X、Y、Z顺序的三个元素组成。
positionsLow Array.<Number> optional 边界球将包围的编码笛卡尔数的低位数组。每个点 由数组中按X、Y、Z顺序的三个元素组成。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
如果未提供修改的结果参数或新的边界层实例。
See:

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

计算包围提供的定向边界框的紧密拟合边界球体。
Name Type Description
orientedBoundingBox OrientedBoundingBox 定向边界框。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

计算包含三维笛卡尔点列表的紧密拟合边界球体。 边界球是通过运行两个算法来计算的,一个是朴素算法,另一个是 里特算法。两个球体中较小的一个用于确保紧密配合。
Name Type Description
positions Array.<Cartesian3> optional 边界球体将包围的点的array。每个点必须具有x、y和z属性。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
如果未提供修改的结果参数或新的边界层实例。
See:

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

从二维投影的矩形计算边界球体。
Name Type Default Description
rectangle Rectangle optional 要围绕其创建边界球体的矩形。
projection Object GeographicProjection optional 用于将矩形投影到二维的投影。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

从三维矩形中计算边界球体。边界球体是使用点的子采样创建的 在椭圆体上并包含在矩形中。对于所有类型的椭球体上的所有矩形,它可能并不精确。
Name Type Default Description
rectangle Rectangle optional 用于创建边界球体的有效矩形。
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 用来确定矩形位置的椭球体。
surfaceHeight Number 0.0 optional 椭球表面上方的高度。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

从二维投影的矩形计算边界球体。边界球体说明 对象在矩形上的最小和最大高度。
Name Type Default Description
rectangle Rectangle optional 要围绕其创建边界球体的矩形。
projection Object GeographicProjection optional 用于将矩形投影到二维的投影。
minimumHeight Number 0.0 optional 矩形上的最小高度。
maximumHeight Number 0.0 optional 矩形上的最大高度。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

计算包含三维点列表的紧密拟合边界球体,这些点位于 以X,Y,Z顺序存储在一个平面数组中。边界球是通过运行2 算法,朴素算法和里特算法。两个球体中较小的一个用来 确保紧密配合。
Name Type Default Description
positions Array.<Number> optional 边界球体将包围的点的数组。每个点 由数组中按X、Y、Z顺序的三个元素组成。
center Cartesian3 Cartesian3.ZERO optional 位置相对的位置,不必是 坐标系原点。当位置用于 相对于中心(RTC)渲染。
stride Number 3 optional 每个顶点的数组元素数。必须至少是3,但可能是 再高一点。不管此参数的值如何,第一个位置的X坐标 位于数组索引0处,Y坐标位于数组索引1处,Z坐标位于数组索引处 2当步长为3时,下一个位置的X坐标从数组索引3开始。如果 步长是5,但是,跳过两个数组元素,下一个位置从array开始 索引5。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
如果未提供修改的结果参数或新的边界层实例。
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.
var center = new Cesium.Cartesian3(1.0, 2.0, 3.0);
var 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];
var 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如果整个球体都在飞机的侧面 法线指向,如果整个球体 在另一边,如果球体是Intersect.INTERSECTING 与平面相交。

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

确定球体是否被遮挡器隐藏。
Name Type Description
sphere BoundingSphere 围绕occludedee对象的边界球体。
occluder Occluder 封堵器。
Returns:
如果球体不可见,则为true;否则为false

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

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

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

从三维世界坐标系中的边界球体创建二维边界球体。
Name Type Default Description
sphere BoundingSphere 要转换为2D的边界球体。
projection Object GeographicProjection optional 投影到2D。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

将4x4仿射变换矩阵应用于边界球体。
Name Type Description
sphere BoundingSphere 要应用变换的边界球体。
transform Matrix4 要应用于边界球体的变换矩阵。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

将4x4仿射变换矩阵应用于没有缩放的边界球体 转换矩阵没有被验证为具有1的统一比例。 该方法比用BoundingSphere.transform计算一般的边界球变换速度快。
Name Type Description
sphere BoundingSphere 要应用变换的边界球体。
transform Matrix4 要应用于边界球体的变换矩阵。
result BoundingSphere optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。
Example:
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid);
var boundingSphere = new Cesium.BoundingSphere();
var 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:
修改后的结果参数或新的BoundingSphere实例(如果未提供)。

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

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

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 spheres from back to front
spheres.sort(function(a, b) {
    return b.distanceSquaredTo(camera.positionWC) - a.distanceSquaredTo(camera.positionWC);
});

equals(right)Boolean

将此BoundingSphere与提供的BoundingSphere组件进行比较,然后返回 如果相等,则为true,否则为false
Name Type Description
right BoundingSphere optional 右手边的边界球。
Returns:
如果相等,则为true,否则为false

intersectPlane(plane)Intersect

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

isOccluded(occluder)Boolean

确定球体是否被遮挡器隐藏。
Name Type Description
occluder Occluder 封堵器。
Returns:
如果球体不可见,则为true;否则为false

volume()Number

计算边界球体的半径。
Returns:
边界球体的半径。