Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Public Attributes | List of all members
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. More...
 
bool isOverlapped (const Box3F &in_rOverlap) const
 Check to see if another box overlaps this box. More...
 
bool isContained (const Box3F &in_rContained) const
 Check to see if another box is contained in this box. More...
 
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. More...
 

Public Attributes

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

Detailed Description

Bounding Box

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

See Also
Box3D

Constructor & Destructor Documentation

Box3F ( )
inline
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 ( 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

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.
bool collideLine ( const Point3F start,
const Point3F end 
) const

Collide a line against the box.

Returns true on collision.

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.
void getCenter ( Point3F center) const
inline

Get the center of this box.

This is the average of min and mMax.

Point3F getClosestPoint ( const Point3F refPt) const
inline

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

void intersect ( const Box3F in_rIntersect)
inline

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

void intersect ( const Point3F in_rIntersect)
inline
bool isContained ( const Point3F in_rContained) const
inline

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

bool isContained ( const Box3F in_rContained) const
inline

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

bool isOverlapped ( const Box3F in_rOverlap) const
inline

Check to see if another box overlaps this box.

bool isValidBox ( ) const
inline

Check that the box is valid.

Currently, this just means that min < mMax.

F32 len_x ( ) const
inline
F32 len_y ( ) const
inline
F32 len_z ( ) const
inline

Member Data Documentation

Point3F mMax

Maximum extents of box.

Point3F mMin

Minimum extents of box.


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