An object oriented Bounding Box.

This object contains a center, 3 axes and the half extent of the resulting box.


Maths

Constructors

  • Creates an object aligned bounding box.

    If omitted, pCenter will be set to the origin (0,0,0). If omitted, pHalfExtent will be set to (0,0,0), this is an invalid box.

    Parameters

    • Optional pCenter: Vector3
      in
      The center of the OOBB.
    • Optional pHalfExtent: Vector3
      in
      The half extent on each axis of the OOBB.
    • Optional pXAxis: Vector3

      The 'X' axis.

    • Optional pYAxis: Vector3

      The 'Y' axis.

    • Optional pZAxis: Vector3

      The 'Z' axis.

    Returns OOBB

    The newly constructed OOBB.

Properties

center: Vector3

The center of the axis aligned bounding box (x,y and z in this order).

halfExtent: Vector3

The half extent on each axis (x,y and z in this order).

xAxis: Vector3

The "X" axis (it must be unit length, but no check is done to ensure that).

yAxis: Vector3

The "Y" axis (it must be unit length, but no check is done to ensure that).

zAxis: Vector3

The "Z" axis (it must be unit length, but no check is done to ensure that).

Methods

  • Copies this to pOut OOBB. If pOut is not supplied, a new OOBB is allocated.

    Parameters

    • Optional pOut: OOBB
      out
      The OOBB to copy to.

    Returns OOBB

    The copied OOBB.

  • Tells if the two OOBB are strictly identical.

    Parameters

    • pOtherOOBB: OOBB
      in
      The other OOBB to compare to.

    Returns boolean

    true if the two OOBB are strictly identical.

  • Sets the OOBB from a valid AABB.

    No computing is done, OOBB axes will be set to world unit vectors, and center and half extent will be copied as is.

    Parameters

    • pAABB: AABB
      in
      The AABB to set from.

    Returns boolean

    true if the value was set.

  • Sets the content of the OOBB from a former call to toJSON.

    Parameters

    • pOOBBData: string | Object
      in
      Internal OOBB data to set.

    Returns boolean

    true if the data is set.

  • Gets the resulting AABB that contains the given OOBB.

    Parameters

    • pOutAABB: AABB
      out
      The resulting AABB.

    Returns void

  • Gets the radius of the sphere centered on the center of the box which contains the box.

    This is equal to √(mHalfExtent.mHalfExtent).

    Returns number

    The box radius.

  • Return if the OOBB is valid ie all values of the half extent must be positive.

    Returns boolean

    true if all HalfExtent values are positive.

  • Serializes the given OOBB to JSON.

    Parameters

    • Optional pKey: any
      in
      Unused.

    Returns Object

    The JSON representation of the object.