torque Torque Game Engine Documentation
CVS Revision Label 1.3.x

Box3F Class Reference

#include <mBox.h>


Detailed Description

Bounding Box.

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

See also:
Box3D


Public Member Functions

 Box3F ()
 Box3F (const Point3F &in_rMin, const Point3F &in_rMax, const bool in_overrideCheck=false)
 Create a box from two points.
 Box3F (F32 xmin, F32 ymin, F32 zmin, F32 max, F32 ymax, F32 zmax)
 Create a box from six extent values.
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)
 Perform an intersection operation with another box and store the results in this box.
void intersect (const Point3F &in_rIntersect)
void getCenter (Point3F *center) const
 Get the center of this box.
bool collideLine (const Point3F &start, const Point3F &end, F32 *t, Point3F *n) const
 Collide a line against the box.
bool collideLine (const Point3F &start, const Point3F &end) const
 Collide a line against the box.
bool collideOrientedBox (const Point3F &radii, const MatrixF &toUs) const
 Collide an oriented box against the box.
bool isValidBox () const
 Check that the box is valid.
Point3F getClosestPoint (const Point3F &refPt) const
 Return the closest point of the box, relative to the passed point.

Data Fields

Point3F min
 Minimum extents of box.
Point3F max
 Maximum extents of box.


Constructor & Destructor Documentation

Box3F::Box3F  )  [inline]
 

Box3F::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_rMin Minimum extents of box.
in_rMax Maximum extents of box.
in_overrideCheck Pass true to skip check of extents.

Box3F::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 Box3F::isContained const Point3F in_rContained  )  const [inline]
 

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

bool Box3F::isOverlapped const Box3F in_rOverlap  )  const [inline]
 

Check to see if another box overlaps this box.

bool Box3F::isContained const Box3F in_rContained  )  const [inline]
 

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

F32 Box3F::len_x  )  const [inline]
 

F32 Box3F::len_y  )  const [inline]
 

F32 Box3F::len_z  )  const [inline]
 

void Box3F::intersect const Box3F in_rIntersect  )  [inline]
 

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

void Box3F::intersect const Point3F in_rIntersect  )  [inline]
 

void Box3F::getCenter Point3F center  )  const [inline]
 

Get the center of this box.

This is the average of min and max.

bool Box3F::collideLine const Point3F start,
const Point3F end,
F32 t,
Point3F n
const
 

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.

bool Box3F::collideLine const Point3F start,
const Point3F end
const
 

Collide a line against the box.

Returns true on collision.

bool Box3F::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:
radii The dimension of incoming box (half x,y,z length).
toUs A transform that takes incoming box into our space.

bool Box3F::isValidBox  )  const [inline]
 

Check that the box is valid.

Currently, this just means that min < max.

Point3F Box3F::getClosestPoint const Point3F refPt  )  const [inline]
 

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


Field Documentation

Point3F Box3F::min
 

Minimum extents of box.

Point3F Box3F::max
 

Maximum extents of box.




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen