具有中心和半徑的邊界球體。
new BoundingSphere(center, radius)
Parameters:
radius
(Number)
(default 0.0
)
邊界球的半徑。
- AxisAlignedBoundingBox
- BoundingRectangle
- Packable
See:
Members
(static) packedLength : Number
用于將對象打包到數(shù)組中的元素數(shù)。
center : Cartesian3
球體的中心點。
-
Default Value:
Cartesian3.ZERO
radius : Number
球體的半徑。
-
Default Value:
0.0
Methods
(static) clone(sphere, result) → {BoundingSphere}
復制邊界球體實例。
Parameters:
由矢量從邊界球的中心到投射到方向上的位置的距離加/減邊界球的半徑。
如果您設想具有法向的無限多個平面,這將從與邊界球體相交的位置計算到最近和最遠平面的最小距離。
如果您設想具有法向的無限多個平面,這將從與邊界球體相交的位置計算到最近和最遠平面的最小距離。
Parameters:
計算從邊界球上最近點到點的估計距離平方。
Parameters:
Example
// Sort bounding spheres from back to front
spheres.sort(function(a, b) {
return bmgl.BoundingSphere.distanceSquaredTo(b, camera.positionWC) - bmgl.BoundingSphere.distanceSquaredTo(a, camera.positionWC);
});
比較提供的boundingsphere組件,如果它們相等,則返回
true
,否則返回false
。
Parameters:
通過擴大提供的球體以包含提供的點來計算邊界球體。
Parameters:
計算包圍提供的邊界球數(shù)組的緊配合邊界球。
Parameters:
從軸對齊邊界框的角點計算邊界球。球體猛然完全地與盒子相碰撞。
Parameters:
Example
// Create a bounding sphere around the unit cube
var sphere = bmgl.BoundingSphere.fromCornerPoints(new bmgl.Cartesian3(-0.5, -0.5, -0.5), new bmgl.Cartesian3(0.5, 0.5, 0.5));
創(chuàng)建包含橢圓體的邊界球體。
Parameters:
計算一個緊配合的邊界球,包含一個編碼部件3列表,其中點按X、Y、Z順序存儲在平行平面陣列中。邊界球是通過運行兩種算法來計算的,一種是簡單算法,另一種是Ritter算法。兩個球體中較小的一個用于確保緊密配合。
Parameters:
positionsHigh
(Array.<Number>)
包圍球將包圍的編碼笛卡爾體的高位數(shù)組。每個點由數(shù)組中的三個元素按x、y、z的順序組成。
positionsLow
(Array.<Number>)
包圍球將包圍的編碼笛卡爾的低位數(shù)組。每個點由數(shù)組中的三個元素按x、y、z的順序組成。
計算包圍提供的定向邊界框的緊配合邊界球。
Parameters:
計算包含三維笛卡爾點列表的緊配合邊界球。邊界球是通過運行兩種算法來計算的,一種是簡單算法,另一種是Ritter算法。兩個球體中較小的一個用于確保緊密配合。
Parameters:
從二維投影的矩形計算邊界球體。
Parameters:
projection
(Object)
(default GeographicProjection
)
用于將矩形投影到二維的投影。
從三維矩形中計算邊界球。邊界球是使用橢圓體上點的子樣本創(chuàng)建的,并包含在矩形中。對于所有類型的橢球體上的所有矩形,它可能不準確。
Parameters:
surfaceHeight
(Number)
(default 0.0
)
橢圓體表面以上的高度。
從二維投影的矩形計算邊界球體。邊界球體占對象在矩形上的最小和最大高度。
Parameters:
projection
(Object)
(default GeographicProjection
)
用于將矩形投影到二維的投影。
minimumHeight
(Number)
(default 0.0
)
矩形上方的最小高度。
maximumHeight
(Number)
(default 0.0
)
矩形上的最大高度。
計算包含三維點列表的緊配合邊界球體,其中點按X、Y、Z順序存儲在平面陣列中。邊界球是通過運行兩種算法來計算的,一種是簡單算法,另一種是Ritter算法。兩個球體中較小的一個用于確保緊密配合。
Parameters:
positions
(Array.<Number>)
邊界球將包圍的點數(shù)組。每個點由數(shù)組中的三個元素按x、y、z的順序組成。
stride
(Number)
(default 3
)
每個頂點的數(shù)組元素數(shù)。它必須至少是3,但可能更高。不管這個參數(shù)的值是多少,第一個位置的x坐標是在數(shù)組索引0處,y坐標是在數(shù)組索引1處,z坐標是在數(shù)組索引2處。當跨距為3時,下一個位置的X坐標從數(shù)組索引3開始。但是,如果步幅為5,則跳過兩個數(shù)組元素,下一個位置從數(shù)組索引5開始。
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 bmgl.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 = bmgl.BoundingSphere.fromVertices(points, center, 5);
確定球體位于平面的哪一側。
Parameters:
確定遮擋器是否將球體隱藏在視圖中。
Parameters:
將提供的實例存儲到提供的數(shù)組中。
Parameters:
array
(Array.<Number>)
要打包的數(shù)組。
startingIndex
(Number)
(default 0
)
數(shù)組中開始打包元素的索引。
從三維世界坐標中的邊界球創(chuàng)建二維邊界球。
Parameters:
projection
(Object)
(default GeographicProjection
)
投影到二維。
將4x4仿射變換矩陣應用于邊界球。
Parameters:
將4x4仿射變換矩陣應用于沒有比例的邊界球。未驗證變換矩陣是否具有1的均勻比例。此方法比使用
BoundingSphere.transform
計算一般邊界球變換更快。
Parameters:
Example
var modelMatrix = bmgl.Transforms.eastNorthUpToFixedFrame(positionOnEllipsoid);
var boundingSphere = new bmgl.BoundingSphere();
var newBoundingSphere = bmgl.BoundingSphere.transformWithoutScale(boundingSphere, modelMatrix);
計算包含左右邊界球的邊界球。
Parameters:
從壓縮數(shù)組中檢索實例。
Parameters:
array
(Array.<Number>)
壓縮數(shù)組。
startingIndex
(Number)
(default 0
)
要解包的元素的起始索引。
復制此邊界球體實例。
Parameters:
由矢量從邊界球的中心到投射到方向上的位置的距離加/減邊界球的半徑。
如果您設想具有法向的無限多個平面,這將從與邊界球體相交的位置計算到最近和最遠平面的最小距離。
如果您設想具有法向的無限多個平面,這將從與邊界球體相交的位置計算到最近和最遠平面的最小距離。
Parameters:
計算從邊界球上最近點到點的估計距離平方。
Parameters:
Example
// Sort bounding spheres from back to front
spheres.sort(function(a, b) {
return b.distanceSquaredTo(camera.positionWC) - a.distanceSquaredTo(camera.positionWC);
});
將此boundingsphere與提供的boundingsphere組件進行比較,如果相等,則返回
true
,否則返回false
。
Parameters:
確定球體位于平面的哪一側。
Parameters:
確定遮擋器是否將球體隱藏在視圖中。
Parameters:
計算邊界球的半徑。