創(chuàng)建OrientedBoundingBox的實(shí)例。某個(gè)物體的定向接地盒是一個(gè)封閉凸的長(zhǎng)方體。在許多情況下,它可以提供比
new OrientedBoundingBox(center, halfAxes)
BoundingSphere
或AxisAlignedBoundingBox
更緊的邊界體積。
Parameters:
halfAxes
(Matrix3)
(default Matrix3.ZERO
)
邊界框的三個(gè)正交半軸。等價(jià)地,轉(zhuǎn)換矩陣,旋轉(zhuǎn)并縮放一個(gè)以原點(diǎn)為中心的0x0x0立方體。
Example
// Create an OrientedBoundingBox using a transformation matrix, a position where the box will be translated, and a scale.
var center = new bmgl.Cartesian3(1.0, 0.0, 0.0);
var halfAxes = bmgl.Matrix3.fromScale(new bmgl.Cartesian3(1.0, 3.0, 2.0), new bmgl.Matrix3());
var obb = new bmgl.OrientedBoundingBox(center, halfAxes);
Members
(static) packedLength : Number
用于將對(duì)象打包到數(shù)組中的元素?cái)?shù)。
center : Cartesian3
盒子的中心。
-
Default Value:
Cartesian3.ZERO
halfAxes : Matrix3
轉(zhuǎn)換矩陣,將方框旋轉(zhuǎn)到正確的位置。
-
Default Value:
Matrix3.ZERO
Methods
(static) clone(box, result) → {OrientedBoundingBox}
復(fù)制OrientedBoundingBox實(shí)例。
Parameters:
由矢量計(jì)算的從邊界框中心到投射到方向上的位置的距離。
如果您設(shè)想具有法向的無(wú)限多個(gè)平面,這將從與邊界框相交的位置計(jì)算到最近和最遠(yuǎn)平面的最小距離。
如果您設(shè)想具有法向的無(wú)限多個(gè)平面,這將從與邊界框相交的位置計(jì)算到最近和最遠(yuǎn)平面的最小距離。
Parameters:
計(jì)算從邊界框上最近點(diǎn)到點(diǎn)的估計(jì)距離平方。
Parameters:
Example
// Sort bounding boxes from back to front
boxes.sort(function(a, b) {
return bmgl.OrientedBoundingBox.distanceSquaredTo(b, camera.positionWC) - bmgl.OrientedBoundingBox.distanceSquaredTo(a, camera.positionWC);
});
比較提供的orientedboundingbox組件,如果相等則返回
true
,否則返回false
。
Parameters:
計(jì)算給定位置的定向邊界框的實(shí)例。這是使用面向邊界框解決方案(博士論文)實(shí)現(xiàn)Stefan Gottschalk的沖突查詢(xún)。參考:http://gamma.cs.unc.edu/users/gottschalk/main.pdf
Parameters:
Example
// Compute an object oriented bounding box enclosing two points.
var box = bmgl.OrientedBoundingBox.fromPoints([new bmgl.Cartesian3(2, 0, 0), new bmgl.Cartesian3(-2, 0, 0)]);
Parameters:
minimumHeight
(Number)
(default 0.0
)
瓦片內(nèi)的最小高度(高程)。
maximumHeight
(Number)
(default 0.0
)
瓦片內(nèi)的最大高度(高程)。
Throws
-
DeveloperError : Rectangle.Width必須介于0和Pi之間。
-
DeveloperError : Rectangle.Height必須介于0和Pi之間。
-
DeveloperError : 橢球必須是旋轉(zhuǎn)橢球(
radii.x == radii.y
)
確定定向邊界框位于平面的哪一側(cè)。
Parameters:
確定封堵器是否從視圖中隱藏邊界框。
Parameters:
將提供的實(shí)例存儲(chǔ)到提供的數(shù)組中。
Parameters:
array
(Array.<Number>)
要打包的數(shù)組。
startingIndex
(Number)
(default 0
)
數(shù)組中開(kāi)始打包元素的索引。
從壓縮數(shù)組中檢索實(shí)例。
Parameters:
array
(Array.<Number>)
壓縮數(shù)組。
startingIndex
(Number)
(default 0
)
要解包的元素的起始索引。
復(fù)制此OrientedBoundingBox實(shí)例。
Parameters:
由矢量計(jì)算的從邊界框中心到投射到方向上的位置的距離。
如果您設(shè)想具有法向的無(wú)限多個(gè)平面,這將從與邊界框相交的位置計(jì)算到最近和最遠(yuǎn)平面的最小距離。
如果您設(shè)想具有法向的無(wú)限多個(gè)平面,這將從與邊界框相交的位置計(jì)算到最近和最遠(yuǎn)平面的最小距離。
Parameters:
計(jì)算從邊界框上最近點(diǎn)到點(diǎn)的估計(jì)距離平方。
Parameters:
Example
// Sort bounding boxes from back to front
boxes.sort(function(a, b) {
return b.distanceSquaredTo(camera.positionWC) - a.distanceSquaredTo(camera.positionWC);
});
將此orientedboundingbox與提供的orientedboundingbox組件進(jìn)行比較,如果相等,則返回
true
,否則返回false
。
Parameters:
確定定向邊界框位于平面的哪一側(cè)。
Parameters:
確定封堵器是否從視圖中隱藏邊界框。