創建OrientedBoundingBox的實例。某個物體的定向接地盒是一個封閉凸的長方體。在許多情況下,它可以提供比
new OrientedBoundingBox(center, halfAxes)
BoundingSphere
或AxisAlignedBoundingBox
更緊的邊界體積。
Parameters:
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
用于將對象打包到數組中的元素數。
center : Cartesian3
盒子的中心。
-
Default Value:
Cartesian3.ZERO
halfAxes : Matrix3
轉換矩陣,將方框旋轉到正確的位置。
-
Default Value:
Matrix3.ZERO
Methods
(static) clone(box, result) → {OrientedBoundingBox}
復制OrientedBoundingBox實例。
Parameters:
由矢量計算的從邊界框中心到投射到方向上的位置的距離。
如果您設想具有法向的無限多個平面,這將從與邊界框相交的位置計算到最近和最遠平面的最小距離。
如果您設想具有法向的無限多個平面,這將從與邊界框相交的位置計算到最近和最遠平面的最小距離。
Parameters:
計算從邊界框上最近點到點的估計距離平方。
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:
計算給定位置的定向邊界框的實例。這是使用面向邊界框解決方案(博士論文)實現Stefan Gottschalk的沖突查詢。參考: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
)
瓦片內的最小高度(高程)。
maximumHeight
(Number)
(default 0.0
)
瓦片內的最大高度(高程)。
Throws
-
DeveloperError : Rectangle.Width必須介于0和Pi之間。
-
DeveloperError : Rectangle.Height必須介于0和Pi之間。
-
DeveloperError : 橢球必須是旋轉橢球(
radii.x == radii.y
)
確定定向邊界框位于平面的哪一側。
Parameters:
確定封堵器是否從視圖中隱藏邊界框。
Parameters:
將提供的實例存儲到提供的數組中。
Parameters:
array
(Array.<Number>)
要打包的數組。
startingIndex
(Number)
(default 0
)
數組中開始打包元素的索引。
從壓縮數組中檢索實例。
Parameters:
array
(Array.<Number>)
壓縮數組。
startingIndex
(Number)
(default 0
)
要解包的元素的起始索引。
復制此OrientedBoundingBox實例。
Parameters:
由矢量計算的從邊界框中心到投射到方向上的位置的距離。
如果您設想具有法向的無限多個平面,這將從與邊界框相交的位置計算到最近和最遠平面的最小距離。
如果您設想具有法向的無限多個平面,這將從與邊界框相交的位置計算到最近和最遠平面的最小距離。
Parameters:
計算從邊界框上最近點到點的估計距離平方。
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組件進行比較,如果相等,則返回
true
,否則返回false
。
Parameters:
確定定向邊界框位于平面的哪一側。
Parameters:
確定封堵器是否從視圖中隱藏邊界框。