OrientedBox3F

Engine/source/math/mOrientedBox.h

An oriented bounding box (OBB) described by a center point, three normalizes axis vectors, and half-extents along each of the axes.

More...

Public Types

enum
Axis {
  RightVector 
  ForwardVector 
  UpVector 
}

Protected Attributes

mAxes [3]

Normalized axis vectors.

Center point.

Box half-extents along each axis.

mPoints [NUM_POINTS]

Corner points.

Protected Functions

Public Functions

OrientedBox3F(const MatrixF & transform, const Box3F & aabb)
OrientedBox3F(const MatrixF & transform, const Point3F & extents)

Return the normalized axis vector for the given world-space axis.

Return the center point of the bounding box.

Return the half-extents along each axis.

Return the corner points of the box.

bool

Return true if the given point is contained in the OBB.

Return the array of corner points for the box.

set(const MatrixF & transform, const Box3F & aabb)

Compute the OBB from an AABB in the given transform space.

set(const MatrixF & transform, const Point3F & extents)

Compute the OBB values from the given transform and extents.

Detailed Description

An oriented bounding box (OBB) described by a center point, three normalizes axis vectors, and half-extents along each of the axes.

Public Types

Axis

Enumerator

RightVector
ForwardVector
UpVector

Protected Attributes

Point3F mAxes [3]

Normalized axis vectors.

Point3F mCenter 

Center point.

Point3F mHalfExtents 

Box half-extents along each axis.

Point3F mPoints [NUM_POINTS]

Corner points.

Protected Functions

_initPoints()

Public Functions

OrientedBox3F()

OrientedBox3F(const MatrixF & transform, const Box3F & aabb)

OrientedBox3F(const MatrixF & transform, const Point3F & extents)

getAxis(U32 i)

Return the normalized axis vector for the given world-space axis.

getCenter()

Return the center point of the bounding box.

getHalfExtents()

Return the half-extents along each axis.

Since the OBBs are symmetrical across each axis, we store half-extents instead of full extents as usually half-extents are needed in the computations.

getPoints()

Return the corner points of the box.

isContained(const Point3F & point)

Return true if the given point is contained in the OBB.

operator const Point3F*()

Return the array of corner points for the box.

set(const MatrixF & transform, const Box3F & aabb)

Compute the OBB from an AABB in the given transform space.

Parameters:

transform

Transform space for the AABB.

aabb

An axis-aligned bounding box in the given transform space.

set(const MatrixF & transform, const Point3F & extents)

Compute the OBB values from the given transform and extents.

Parameters:

transform

World->object space transform.

extents

Box extent on each axis.