Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::Box Class Reference

An arbitrary 3D box, useful as a bounding box. More...

#include <Box.h>

List of all members.

Public Member Functions

float area () const
Vector3 axis (int a) const
 Box (const class AABox &b)
 Box (class BinaryInput &b)
 Box (const Vector3 &min, const Vector3 &max)
 Box ()
Vector3 center () const
bool contains (const Vector3 &point) const
Vector3 corner (int i) const
bool culledBy (const Array< Plane > &plane, int32 &cullingPlaneIndex=dummy, const uint32 testMask=-1) const
bool culledBy (const Array< Plane > &plane, int32 &cullingPlaneIndex, const uint32 testMask, uint32 &childMask) const
void deserialize (class BinaryInput &b)
Vector3 extent () const
float extent (int a) const
void getBounds (class AABox &) const
void getFaceCorners (int f, Vector3 &v0, Vector3 &v1, Vector3 &v2, Vector3 &v3) const
void getLocalFrame (CoordinateFrame &frame) const
void getRandomSurfacePoint (Vector3 &P, Vector3 &N=Vector3::dummy) const
bool isFinite () const
CoordinateFrame localFrame () const
Vector3 randomInteriorPoint () const
void serialize (class BinaryOutput &b) const
float volume () const

Static Public Member Functions

static Box inf ()

Friends

class CoordinateFrame


Detailed Description

An arbitrary 3D box, useful as a bounding box.

To construct a box from a coordinate frame, center and extent, use the idiom:

Box box = cframe.toObjectSpace(Box(center - extent/2, center + extent/2));


Constructor & Destructor Documentation

G3D::Box::Box (  ) 

Does not initialize the fields.

G3D::Box::Box ( const Vector3 min,
const Vector3 max 
)

Constructs a box from two opposite corners.

G3D::Box::Box ( class BinaryInput b  ) 

G3D::Box::Box ( const class AABox b  ) 


Member Function Documentation

float G3D::Box::area (  )  const

Vector3 G3D::Box::axis ( int  a  )  const [inline]

Unit length.

Vector3 G3D::Box::center (  )  const [inline]

Returns the centroid of the box.

bool G3D::Box::contains ( const Vector3 point  )  const

Vector3 G3D::Box::corner ( int  i  )  const [inline]

bool G3D::Box::culledBy ( const Array< Plane > &  plane,
int32 cullingPlaneIndex = dummy,
const uint32  testMask = -1 
) const

Conservative culling test that does not produce a mask for children.

bool G3D::Box::culledBy ( const Array< Plane > &  plane,
int32 cullingPlaneIndex,
const uint32  testMask,
uint32 childMask 
) const

void G3D::Box::deserialize ( class BinaryInput b  ) 

Vector3 G3D::Box::extent (  )  const [inline]

float G3D::Box::extent ( int  a  )  const [inline]

Distance from corner(0) to the next corner along the box's local axis a.

void G3D::Box::getBounds ( class AABox  )  const

void G3D::Box::getFaceCorners ( int  f,
Vector3 v0,
Vector3 v1,
Vector3 v2,
Vector3 v3 
) const

Returns the four corners of a face (0 <= f < 6).

The corners are returned to form a counter clockwise quad facing outwards.

void G3D::Box::getLocalFrame ( CoordinateFrame frame  )  const

void G3D::Box::getRandomSurfacePoint ( Vector3 P,
Vector3 N = Vector3::dummy 
) const

static Box G3D::Box::inf (  )  [static]

bool G3D::Box::isFinite (  )  const [inline]

CoordinateFrame G3D::Box::localFrame (  )  const

Returns the object to world transformation for this box.

localFrame().worldToObject(...) takes objects into the space where the box axes are (1,0,0), (0,1,0), (0,0,1). Note that there is no scaling in this transformation.

Vector3 G3D::Box::randomInteriorPoint (  )  const

Uniformly distributed on the interior (includes surface).

void G3D::Box::serialize ( class BinaryOutput b  )  const

float G3D::Box::volume (  )  const


Friends And Related Function Documentation

friend class CoordinateFrame [friend]


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:45 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo