ObjectOrientedBoundingBox

ObjectOrientedBoundingBox

new

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.

Parameters:
Name Type Argument Default Description
rotation Matrix3 <optional>
Matrix3.IDENTITY The transformation matrix, to rotate the box to the right position.
translation Cartesian3 <optional>
Cartesian3.ZERO The position of the box.
scale Cartesian3 <optional>
Cartesian3.ZERO 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 = Matrix3.clone(Matrix3.IDENTITY);
var translation = new Cartesian3(1,0,0);
var scale = new Cartesian3(0,5,0);

var oobb = new ObjectOrientedBoundingBox(rotation, translation, scale);
See:
Source:

Members

:Matrix3

The transformation matrix, to rotate the box to the right position.
Default Value:

:Cartesian3

The scale of the box.
Default Value:

:Cartesian3

The position of the box.
Default Value:

Methods

Duplicates this ObjectOrientedBoundingBox instance.

Parameters:
Name Type Argument Description
result ObjectOrientedBoundingBox <optional>
The object onto which to store the result.
Returns:
ObjectOrientedBoundingBox The modified result parameter or a new ObjectOrientedBoundingBox instance if one was not provided.

Compares this ObjectOrientedBoundingBox against the provided ObjectOrientedBoundingBox componentwise and returns true if they are equal, false otherwise.

Parameters:
Name Type Argument Description
right ObjectOrientedBoundingBox <optional>
The right hand side ObjectOrientedBoundingBox.
Returns:
Boolean true if they are equal, false otherwise.

<static>

Duplicates a ObjectOrientedBoundingBox instance.

Parameters:
Name Type Argument Description
box ObjectOrientedBoundingBox The bounding box to duplicate.
result ObjectOrientedBoundingBox <optional>
The object onto which to store the result.
Returns:
ObjectOrientedBoundingBox The modified result parameter or a new ObjectOrientedBoundingBox instance if none was provided. (Returns undefined if box is undefined)

<static>

Compares the provided ObjectOrientedBoundingBox componentwise and returns true if they are equal, false otherwise.

Parameters:
Name Type Description
left ObjectOrientedBoundingBox The first ObjectOrientedBoundingBox.
right ObjectOrientedBoundingBox The second ObjectOrientedBoundingBox.
Returns:
Boolean true if left and right are equal, false otherwise.

<static>

Computes an ObjectOrientedBoundingBox from a BoundingRectangle. The BoundingRectangle is placed on the XY plane.

Parameters:
Name Type Argument Default Description
boundingRectangle BoundingRectangle A bounding rectangle.
rotation Number <optional>
0.0 The rotation of the bounding box in radians.
Throws:
DeveloperError : boundingRectangle is required.
Returns:
ObjectOrientedBoundingBox 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 = ObjectOrientedBoundingBox.fromBoundingRectangle(boundingRectangle, 0.0);

<static>

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

Parameters:
Name Type Argument Description
positions Array List of Cartesian3 points that the bounding box will enclose.
result ObjectOrientedBoundingBox <optional>
The object onto which to store the result.
Returns:
ObjectOrientedBoundingBox 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 = ObjectOrientedBoundingBox.fromPoints([new Cartesian3(2, 0, 0), new Cartesian3(-2, 0, 0)]);

<static>

Checks if two ObjectOrientedBoundingBoxes intersect. This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).

Parameters:
Name Type Description
left ObjectOrientedBoundingBox The first ObjectOrientedBoundingBox.
right ObjectOrientedBoundingBox The second ObjectOrientedBoundingBox.
Throws:
Returns:
Boolean true if they intersects each other false otherwise.