Class: BoundingVolume

BoundingVolume

BoundingVolume forms an abstract base class for axis-aligned bounding volumes, used in the scene hierarchy.


new BoundingVolume(type)

Parameters:
Name Type Description
type

The type of bounding volume.

Author:
  • derschmale <http://www.derschmale.com>

Members


<static> EXPANSE_EMPTY

Indicates the bounds are empty


<static> EXPANSE_FINITE

Indicates the bounds have a real size and position


<static> EXPANSE_INFINITE

Indicates the bounds are infinitely large


<static> EXPANSE_INHERIT

Indicates the parent's bounds are used in selecting.


center

The center coordinate of the bounds


expanse

Describes the size of the bounding box. BoundingVolume#EXPANSE_EMPTY, BoundingVolume#EXPANSE_FINITE, or BoundingVolume#EXPANSE_INFINITE


halfExtent

The half extents of the bounds. These are the half-dimensions of the box encompassing the bounds from the center.


maximum

The maximum reach of the bounds, described as a box range.


minimum

The minimum reach of the bounds, described as a box range.

Methods


classifyAgainstPlane(plane)

Tests on which side of the plane the bounding box is (front, back or intersecting).

Parameters:
Name Type Description
plane

The plane to test against.

Returns:

The side of the plane

Type
PlaneSide

clear(expanseState)

Clear the bounds.

Parameters:
Name Type Description
expanseState

The state to reset to. Either BoundingVolume#EXPANSE_EMPTY or BoundingVolume#EXPANSE_INFINITE.


getRadius()

The radius of the sphere encompassing the bounds. This is implementation-dependent, because the radius is less precise for a box than for a sphere


intersectsBound()

Tests whether the bounds intersect another bounding volume


intersectsConvexSolid(cullPlanes, numPlanes)

Tests whether the bounds intersects a given convex solid. The convex solid is described as a list of planes pointing outward. Infinite solids are also allowed (Directional Light frusta without a near plane, for example)

Parameters:
Name Type Description
cullPlanes

An Array of planes to be tested. Planes are simply Float4 objects.

numPlanes

The amount of planes to be tested against. This so we can test less planes than are in the cullPlanes array (Directional Light frusta, for example)

Returns:

Whether or not the bounds intersect the solid.

Type
boolean

intersectsRay()

Tests whether or not this BoundingVolume intersects a ray.


transformFrom(sourceBound, matrix)

Transforms a bounding volume and stores it in this one.

Parameters:
Name Type Description
sourceBound BoundingVolume

The bounds to transform.

matrix Matrix4x4

The matrix containing the transformation.