ObjectOrientedBoundingBox

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
box ObjectOrientedBoundingBox The bounding box to duplicate.
result ObjectOrientedBoundingBox 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 true if they are equal, false otherwise.
Name Type Description
left ObjectOrientedBoundingBox The first ObjectOrientedBoundingBox.
right ObjectOrientedBoundingBox The second ObjectOrientedBoundingBox.
Returns:
true if left and right are equal, false otherwise.

staticObjectOrientedBoundingBox.fromBoundingRectangle(boundingRectangle, rotation)ObjectOrientedBoundingBox

Computes an ObjectOrientedBoundingBox from a BoundingRectangle. The BoundingRectangle is placed on the XY plane.
Name Type Default Description
boundingRectangle BoundingRectangle A bounding rectangle.
rotation Number 0.0 optional 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
positions Array.<Cartesian3> List of Cartesian3 points that the bounding box will enclose.
result ObjectOrientedBoundingBox 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
left ObjectOrientedBoundingBox The first ObjectOrientedBoundingBox.
right ObjectOrientedBoundingBox The second ObjectOrientedBoundingBox.
Returns:
true if they intersects each other false otherwise.

clone(result)ObjectOrientedBoundingBox

Duplicates this ObjectOrientedBoundingBox instance.
Name Type Description
result ObjectOrientedBoundingBox 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 true if they are equal, false otherwise.
Name Type Description
right ObjectOrientedBoundingBox optional The right hand side ObjectOrientedBoundingBox.
Returns:
true if they are equal, false otherwise.