Box3F

Engine/source/math/mBox.h

Axis-aligned bounding box (AABB).

More...

Public Attributes

Maximum extents of box.

Minimum extents of box.

Public Static Attributes

An inverted bounds where the minimum point is positive and the maximum point is negative.

A box that covers the entire floating point range.

A null box of zero size.

Public Functions

Box3F(const F32 & xMin, const F32 & yMin, const F32 & zMin, const F32 & xMax, const F32 & yMax, const F32 & zMax)

Create a box from six extent values.

Box3F(const Point3F & in_rMin, const Point3F & in_rMax, const bool in_overrideCheck)

Create a box from two points.

Box3F(F32 cubeSize)
bool

Collide a line against the box.

bool
collideLine(const Point3F & start, const Point3F & end, F32 * t, Point3F * n)

Collide a line against the box.

bool

Collide an oriented box against the box.

Return one of the corner vertices of the box.

Extend the box to include point.

Return the bounding sphere that contains this AABB.

getCenter(Point3F * center)

Get the center of this box.

Return the closest point of the box, relative to the passed point.

Return distance of closest point on box to refPt.

Returns the max minus the min extents.

Get the length of the longest diagonal in the box.

getOverlap(const Box3F & otherBox)

Return the overlap between this box and otherBox.

Return the squared distance to closest point on box to refPt.

Return the volume of the box.

intersect(const Box3F & in_rIntersect)

Perform an intersection operation with another box and store the results in this box.

intersect(const Point3F & in_rIntersect)
bool
isContained(const Box3F & in_rContained)

Check to see if another box is contained in this box.

bool

Check if the Point2F is within the box xy extents.

bool
isContained(const Point3F & in_rContained)

Check to see if a point is contained in this box.

bool

Returns true if any of the extent axes are less than or equal to zero.

bool
isOverlapped(const Box3F & in_rOverlap)

Check to see if another box overlaps this box.

bool

Check if the given sphere overlaps with the box.

bool

Check that the min extents of the box is less than or equal to the max extents.

len()

Returns the diagonal box length.

len(S32 axis)

Returns the length of extent by axis index.

Returns the maximum box extent.

Returns the minimum box extent.

Returns the length of the x extent.

Returns the length of the y extent.

Returns the length of the z extent.

bool

Inequality operator.

bool

Equality operator.

Scale the box by a Point3F or F32.

scale(F32 amt)
set(const F32 & xMin, const F32 & yMin, const F32 & zMin, const F32 & xMax, const F32 & yMax, const F32 & zMax)
set(const Point3F & in_Length)

Create box around origin given lengths.

set(const Point3F & in_rMin, const Point3F & in_rMax)

Recenter the box.

Public Static Functions

aroundPoints(const Point3F * points, U32 numPoints)

Create an AABB that fits around the given point cloud, i.e.

Detailed Description

Axis-aligned bounding box (AABB).

A helper class for working with boxes. It runs at F32 precision.

see:

Public Attributes

Point3F maxExtents 

Maximum extents of box.

Point3F minExtents 

Minimum extents of box.

Public Static Attributes

const Box3F Invalid 

An inverted bounds where the minimum point is positive and the maximum point is negative.

Should be used with extend() to construct a minimum volume box.

see:

const Box3F Max 

A box that covers the entire floating point range.

const Box3F Zero 

A null box of zero size.

Public Functions

Box3F()

Box3F(const F32 & xMin, const F32 & yMin, const F32 & zMin, const F32 & xMax, const F32 & yMax, const F32 & zMax)

Create a box from six extent values.

No checking is performed as to the validity of these extents, unlike the other constructor.

Box3F(const Point3F & in_rMin, const Point3F & in_rMax, const bool in_overrideCheck)

Create a box from two points.

Normally, this function will compensate for mismatched min/max values. If you know your values are valid, you can set in_overrideCheck to true and skip this.

Parameters:

in_rMin

Minimum extents of box.

in_rMax

Maximum extents of box.

in_overrideCheck

Pass true to skip check of extents.

Box3F(F32 cubeSize)

collideLine(const Point3F & start, const Point3F & end)

Collide a line against the box.

Returns true on collision.

collideLine(const Point3F & start, const Point3F & end, F32 * t, Point3F * n)

Collide a line against the box.

Parameters:

start

Start of line.

end

End of line.

t

Value from 0.0-1.0, indicating position along line of collision.

n

Normal of collision.

collideOrientedBox(const Point3F & radii, const MatrixF & toUs)

Collide an oriented box against the box.

Returns true if "oriented" box collides with us. Assumes incoming box is centered at origin of source space.

Parameters:

radii

The dimension of incoming box (half x,y,z length).

toUs

A transform that takes incoming box into our space.

computeVertex(U32 corner)

Return one of the corner vertices of the box.

extend(const Point3F & p)

Extend the box to include point.

getBoundingSphere()

Return the bounding sphere that contains this AABB.

getCenter()

getCenter(Point3F * center)

Get the center of this box.

This is the average of min and max.

getClosestPoint(const Point3F & refPt)

Return the closest point of the box, relative to the passed point.

getDistanceToPoint(const Point3F & refPt)

Return distance of closest point on box to refPt.

getExtents()

Returns the max minus the min extents.

getGreatestDiagonalLength()

Get the length of the longest diagonal in the box.

getOverlap(const Box3F & otherBox)

Return the overlap between this box and otherBox.

getSqDistanceToPoint(const Point3F & refPt)

Return the squared distance to closest point on box to refPt.

getVolume()

Return the volume of the box.

intersect(const Box3F & in_rIntersect)

Perform an intersection operation with another box and store the results in this box.

intersect(const Point3F & in_rIntersect)

isContained(const Box3F & in_rContained)

Check to see if another box is contained in this box.

isContained(const Point2F & pt)

Check if the Point2F is within the box xy extents.

isContained(const Point3F & in_rContained)

Check to see if a point is contained in this box.

isEmpty()

Returns true if any of the extent axes are less than or equal to zero.

isOverlapped(const Box3F & in_rOverlap)

Check to see if another box overlaps this box.

isOverlapped(const SphereF & sphere)

Check if the given sphere overlaps with the box.

isValidBox()

Check that the min extents of the box is less than or equal to the max extents.

len()

Returns the diagonal box length.

len(S32 axis)

Returns the length of extent by axis index.

Parameters:

axis

The axis index of 0, 1, or 2.

len_max()

Returns the maximum box extent.

len_min()

Returns the minimum box extent.

len_x()

Returns the length of the x extent.

len_y()

Returns the length of the y extent.

len_z()

Returns the length of the z extent.

operator!=(const Box3F & b)

Inequality operator.

operator==(const Box3F & b)

Equality operator.

scale(const Point3F & amt)

Scale the box by a Point3F or F32.

scale(F32 amt)

set(const F32 & xMin, const F32 & yMin, const F32 & zMin, const F32 & xMax, const F32 & yMax, const F32 & zMax)

set(const Point3F & in_Length)

Create box around origin given lengths.

set(const Point3F & in_rMin, const Point3F & in_rMax)

setCenter(const Point3F & center)

Recenter the box.

Public Static Functions

aroundPoints(const Point3F * points, U32 numPoints)

Create an AABB that fits around the given point cloud, i.e.

find the minimum and maximum extents of the given point set.