Torque2D Reference
Loading...
Searching...
No Matches
Box3F Class Reference

#include <mBox.h>

Public Member Functions

 Box3F ()
 Box3F (const Point3F &in_rMin, const Point3F &in_rMax, const bool in_overrideCheck=false)
 Box3F (F32 xmin, F32 ymin, F32 zmin, F32 max, F32 ymax, F32 zmax)
bool isContained (const Point3F &in_rContained) const
 Check to see if a point is contained in this box.
bool isOverlapped (const Box3F &in_rOverlap) const
 Check to see if another box overlaps this box.
bool isContained (const Box3F &in_rContained) const
 Check to see if another box is contained in this box.
F32 len_x () const
F32 len_y () const
F32 len_z () const
void intersect (const Box3F &in_rIntersect)
void intersect (const Point3F &in_rIntersect)
void getCenter (Point3F *center) const
bool collideLine (const Point3F &start, const Point3F &end, F32 *t, Point3F *n) const
bool collideLine (const Point3F &start, const Point3F &end) const
bool collideOrientedBox (const Point3F &radii, const MatrixF &toUs) const
bool isValidBox () const
Point3F getClosestPoint (const Point3F &refPt) const
 Return the closest point of the box, relative to the passed point.

Public Attributes

Point3F mMin
 Minimum extents of box.
Point3F mMax
 Maximum extents of box.

Detailed Description

Bounding Box

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

See also
Box3D

Constructor & Destructor Documentation

◆ Box3F() [1/3]

Box3F ( )
inline

◆ Box3F() [2/3]

Box3F ( const Point3F & in_rMin,
const Point3F & in_rMax,
const bool in_overrideCheck = false )
inline

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_rMinMinimum extents of box.
in_rMaxMaximum extents of box.
in_overrideCheckPass true to skip check of extents.

◆ Box3F() [3/3]

Box3F ( F32 xmin,
F32 ymin,
F32 zmin,
F32 max,
F32 ymax,
F32 zmax )
inline

Create a box from six extent values.

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

Member Function Documentation

◆ collideLine() [1/2]

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

Collide a line against the box.

Returns true on collision.

◆ collideLine() [2/2]

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

Collide a line against the box.

Parameters
startStart of line.
endEnd of line.
tValue from 0.0-1.0, indicating position along line of collision.
nNormal of collision.

◆ collideOrientedBox()

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

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
radiiThe dimension of incoming box (half x,y,z length).
toUsA transform that takes incoming box into our space.

◆ getCenter()

void getCenter ( Point3F * center) const
inline

Get the center of this box.

This is the average of min and mMax.

◆ getClosestPoint()

Point3F getClosestPoint ( const Point3F & refPt) const
inline

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

◆ intersect() [1/2]

void intersect ( const Box3F & in_rIntersect)
inline

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

◆ intersect() [2/2]

void intersect ( const Point3F & in_rIntersect)
inline

◆ isContained() [1/2]

bool isContained ( const Box3F & in_rContained) const
inline

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

◆ isContained() [2/2]

bool isContained ( const Point3F & in_rContained) const
inline

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

◆ isOverlapped()

bool isOverlapped ( const Box3F & in_rOverlap) const
inline

Check to see if another box overlaps this box.

◆ isValidBox()

bool isValidBox ( ) const
inline

Check that the box is valid.

Currently, this just means that min < mMax.

◆ len_x()

F32 len_x ( ) const
inline

◆ len_y()

F32 len_y ( ) const
inline

◆ len_z()

F32 len_z ( ) const
inline

Member Data Documentation

◆ mMax

Point3F mMax

Maximum extents of box.

◆ mMin

Point3F mMin

Minimum extents of box.


The documentation for this class was generated from the following files: