new ObjectOrientedBoundingBox(rotation, translation, scale)
Creates an instance of an ObjectOrientedBoundingBox.
An ObjectOrientedBoundingBox model of an object or set of objects, is a closed volume (a cuboid), which completely contains the object or the set of objects.
It is oriented, so it can provide an optimum fit, it can bound more tightly.
| Name | Type | Default | Description |
|---|---|---|---|
rotation |
Matrix3 |
Matrix3.IDENTITY
|
optional The transformation matrix, to rotate the box to the right position. |
translation |
Cartesian3 |
Cartesian3.ZERO
|
optional The position of the box. |
scale |
Cartesian3 |
Cartesian3.ZERO
|
optional The scale of the box. |
Example:
// Create an ObjectOrientedBoundingBox using a transformation matrix, a position where the box will be translated, and a scale.
var rotation = Cesium.Matrix3.clone(Cesium.Matrix3.IDENTITY);
var translation = new Cesium.Cartesian3(1,0,0);
var scale = new Cesium.Cartesian3(0,5,0);
var oobb = new Cesium.ObjectOrientedBoundingBox(rotation, translation, scale);
See:
Members
-
rotation :Matrix3
-
The transformation matrix, to rotate the box to the right position.
-
Default Value:
Matrix3.IDENTITY -
scale :Cartesian3
-
The scale of the box.
-
Default Value:
Cartesian3.ZERO -
translation :Cartesian3
-
The position of the box.
-
Default Value:
Cartesian3.ZERO
Methods
-
staticObjectOrientedBoundingBox.clone(box, result) → ObjectOrientedBoundingBox
-
Duplicates a ObjectOrientedBoundingBox instance.
Name Type Description boxObjectOrientedBoundingBox The bounding box to duplicate. resultObjectOrientedBoundingBox optional The object onto which to store the result. Returns:
The modified result parameter or a new ObjectOrientedBoundingBox instance if none was provided. (Returns undefined if box is undefined) -
staticObjectOrientedBoundingBox.equals(left, right) → Boolean
-
Compares the provided ObjectOrientedBoundingBox componentwise and returns
trueif they are equal,falseotherwise.Name Type Description leftObjectOrientedBoundingBox The first ObjectOrientedBoundingBox. rightObjectOrientedBoundingBox The second ObjectOrientedBoundingBox. Returns:
trueif left and right are equal,falseotherwise. -
staticObjectOrientedBoundingBox.fromBoundingRectangle(boundingRectangle, rotation) → ObjectOrientedBoundingBox
-
Computes an ObjectOrientedBoundingBox from a BoundingRectangle. The BoundingRectangle is placed on the XY plane.
Name Type Default Description boundingRectangleBoundingRectangle A bounding rectangle. rotationNumber 0.0optional The rotation of the bounding box in radians. Returns:
The modified result parameter or a new ObjectOrientedBoundingBox instance if one was not provided.Example:
// Compute an object oriented bounding box enclosing two points. var box = Cesium.ObjectOrientedBoundingBox.fromBoundingRectangle(boundingRectangle, 0.0); -
staticObjectOrientedBoundingBox.fromPoints(positions, result) → ObjectOrientedBoundingBox
-
Computes an instance of an ObjectOrientedBoundingBox of the given positions. This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis). Reference: http://gamma.cs.unc.edu/users/gottschalk/main.pdf
Name Type Description positionsArray.<Cartesian3> List of Cartesian3points that the bounding box will enclose.resultObjectOrientedBoundingBox optional The object onto which to store the result. Returns:
The modified result parameter or a new ObjectOrientedBoundingBox instance if one was not provided.Example:
// Compute an object oriented bounding box enclosing two points. var box = Cesium.ObjectOrientedBoundingBox.fromPoints([new Cesium.Cartesian3(2, 0, 0), new Cesium.Cartesian3(-2, 0, 0)]); -
staticObjectOrientedBoundingBox.intersect(left, right) → Boolean
-
Checks if two ObjectOrientedBoundingBoxes intersect. This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).
Name Type Description leftObjectOrientedBoundingBox The first ObjectOrientedBoundingBox. rightObjectOrientedBoundingBox The second ObjectOrientedBoundingBox. Returns:
trueif they intersects each otherfalseotherwise. -
clone(result) → ObjectOrientedBoundingBox
-
Duplicates this ObjectOrientedBoundingBox instance.
Name Type Description resultObjectOrientedBoundingBox optional The object onto which to store the result. Returns:
The modified result parameter or a new ObjectOrientedBoundingBox instance if one was not provided. -
equals(right) → Boolean
-
Compares this ObjectOrientedBoundingBox against the provided ObjectOrientedBoundingBox componentwise and returns
trueif they are equal,falseotherwise.Name Type Description rightObjectOrientedBoundingBox optional The right hand side ObjectOrientedBoundingBox. Returns:
trueif they are equal,falseotherwise.
