OrientedBoundingBox - Cesium Documentation

# OrientedBoundingBox

#### new OrientedBoundingBox(center, halfAxes)

  Creates an instance of an OrientedBoundingBox. An OrientedBoundingBox of some object is a closed and convex cuboid. It can provide a tighter bounding volume than `BoundingSphere` or `AxisAlignedBoundingBox` in many cases.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `center` | Cartesian3 | `Cartesian3.ZERO` | optional The center of the box.
  `halfAxes` | Matrix3 | `Matrix3.ZERO` | optional The three orthogonal half-axes of the bounding box. Equivalently, the transformation matrix, to rotate and scale a 2x2x2 cube centered at the origin.

  ##### Example:

      // Create an OrientedBoundingBox using a transformation matrix, a position where the box will be translated, and a scale.
      var center = new Cesium.Cartesian3(1.0, 0.0, 0.0);
      var halfAxes = Cesium.Matrix3.fromScale(new Cartesian3(1.0, 3.0, 2.0), new Matrix3());

      var obb = new Cesium.OrientedBoundingBox(center, halfAxes);

  ##### See:

  - BoundingSphere
  - BoundingRectangle
  Source: Core/OrientedBoundingBox.js, line 53

### Members

#### center :Cartesian3

  The center of the box.
  Default Value: ``Cartesian3.ZERO``
  Source: Core/OrientedBoundingBox.js, line 59

#### halfAxes :Matrix3

  The transformation matrix, to rotate the box to the right position.
  Default Value: ``Matrix3.IDENTITY``
  Source: Core/OrientedBoundingBox.js, line 65

### Methods

#### staticOrientedBoundingBox.clone(box, result) → OrientedBoundingBox

  Duplicates a OrientedBoundingBox instance.

  Name | Type | Description
  --- | --- | ---
  `box` | OrientedBoundingBox | The bounding box to duplicate.
  `result` | OrientedBoundingBox | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new OrientedBoundingBox instance if none was provided. (Returns undefined if box is undefined)
  Source: Core/OrientedBoundingBox.js, line 223

#### staticOrientedBoundingBox.equals(left, right) → Boolean

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

  Name | Type | Description
  --- | --- | ---
  `left` | OrientedBoundingBox | The first OrientedBoundingBox.
  `right` | OrientedBoundingBox | The second OrientedBoundingBox.

  ##### Returns:

  `true` if left and right are equal, `false` otherwise.
  Source: Core/OrientedBoundingBox.js, line 300

#### staticOrientedBoundingBox.fromRectangle(rectangle, minimumHeight, maximumHeight, ellipsoid, result) → OrientedBoundingBox

  Computes an OrientedBoundingBox that bounds a `Rectangle` on the surface of an `Ellipsoid`. There are no guarantees about the orientation of the bounding box.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `rectangle` | Rectangle |  | The cartographic rectangle on the surface of the ellipsoid.
  `minimumHeight` | Number | `0.0` | optional The minimum height (elevation) within the tile.
  `maximumHeight` | Number | `0.0` | optional The maximum height (elevation) within the tile.
  `ellipsoid` | Ellipsoid | `Ellipsoid.WGS84` | optional The ellipsoid on which the rectangle is defined.
  `result` | OrientedBoundingBox |  | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new OrientedBoundingBox instance if none was provided.

  ##### Throws:

  - DeveloperError : rectangle.width must be between 0 and pi.
  - DeveloperError : rectangle.height must be between 0 and pi.
  - DeveloperError : ellipsoid must be an ellipsoid of revolution (`radii.x == radii.y`)
  Source: Core/OrientedBoundingBox.js, line 141

#### staticOrientedBoundingBox.intersectPlane(box, plane) → Intersect

  Determines which side of a plane the oriented bounding box is located.

  Name | Type | Description
  --- | --- | ---
  `box` | OrientedBoundingBox | The oriented bounding box to test.
  `plane` | Plane | The plane to test against.

  ##### Returns:

  `Intersect.INSIDE` if the entire box is on the side of the plane the normal is pointing, `Intersect.OUTSIDE` if the entire box is on the opposite side, and `Intersect.INTERSECTING` if the box intersects the plane.
  Source: Core/OrientedBoundingBox.js, line 248

#### clone(result) → OrientedBoundingBox

  Duplicates this OrientedBoundingBox instance.

  Name | Type | Description
  --- | --- | ---
  `result` | OrientedBoundingBox | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new OrientedBoundingBox instance if one was not provided.
  Source: Core/OrientedBoundingBox.js, line 314

#### equals(right) → Boolean

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

  Name | Type | Description
  --- | --- | ---
  `right` | OrientedBoundingBox | optional The right hand side OrientedBoundingBox.

  ##### Returns:

  `true` if they are equal, `false` otherwise.
  Source: Core/OrientedBoundingBox.js, line 325

#### intersectPlane(plane) → Intersect

  Determines which side of a plane the oriented bounding box is located.

  Name | Type | Description
  --- | --- | ---
  `plane` | Plane | The plane to test against.

  ##### Returns:

  `Intersect.INSIDE` if the entire box is on the side of the plane the normal is pointing, `Intersect.OUTSIDE` if the entire box is on the opposite side, and `Intersect.INTERSECTING` if the box intersects the plane.
  Source: Core/OrientedBoundingBox.js, line 288