
Basic type: arbitrarily oriented 3D bounding box. More...
#include <bbox3d.h>
Public Member Functions  
GfBBox3d ()  
The default constructor leaves the box empty, the transformation matrix identity, and the zeroareaprimitives flag" false .  
GfBBox3d (const GfRange3d &box)  
This constructor takes a box and sets the matrix to identity.  
GfBBox3d (const GfRange3d &box, const GfMatrix4d &matrix)  
This constructor takes a box and a transformation matrix.  
void  Set (const GfRange3d &box, const GfMatrix4d &matrix) 
Sets the axisaligned box and transformation matrix.  
void  SetMatrix (const GfMatrix4d &matrix) 
Sets the transformation matrix only.  
void  SetRange (const GfRange3d &box) 
Sets the range of the axisaligned box only.  
const GfRange3d &  GetRange () const 
Returns the range of the axisaligned untransformed box.  
const GfRange3d &  GetBox () const 
Returns the range of the axisaligned untransformed box.  
const GfMatrix4d &  GetMatrix () const 
Returns the transformation matrix.  
const GfMatrix4d &  GetInverseMatrix () const 
Returns the inverse of the transformation matrix.  
void  SetHasZeroAreaPrimitives (bool hasThem) 
Sets the zeroarea primitives flag to the given value.  
bool  HasZeroAreaPrimitives () const 
Returns the current state of the zeroareaprimitives flag".  
GF_API double  GetVolume () const 
Returns the volume of the box (0 for an empty box).  
void  Transform (const GfMatrix4d &matrix) 
Transforms the bounding box by the given matrix, which is assumed to be a global transformation to apply to the box.  
GF_API GfRange3d  ComputeAlignedRange () const 
Returns the axisaligned range (as a GfRange3d ) that results from applying the transformation matrix to the wxisaligned box and aligning the result.  
GfRange3d  ComputeAlignedBox () const 
Returns the axisaligned range (as a GfRange3d ) that results from applying the transformation matrix to the axisaligned box and aligning the result.  
GF_API GfVec3d  ComputeCentroid () const 
Returns the centroid of the bounding box.  
bool  operator== (const GfBBox3d &b) const 
Componentwise equality test.  
bool  operator!= (const GfBBox3d &that) const 
Componentwise inequality test.  
Static Public Member Functions  
static GF_API GfBBox3d  Combine (const GfBBox3d &b1, const GfBBox3d &b2) 
Combines two bboxes, returning a new bbox that contains both.  
Friends  
size_t  hash_value (const GfBBox3d &b) 
Hash.  
Basic type: arbitrarily oriented 3D bounding box.
This class represents a threedimensional bounding box as an axisaligned box (GfRange3d
) and a matrix (GfMatrix4d
) to transform it into the correct space.
A GfBBox3d
is more useful than using just GfRange3d
instances (which are always axisaligned) for these reasons:
GfBBox3d
is generally much smaller than the GfRange3d
computed by transforming the box at each level.When bounding boxes are used in intersection test culling, it is sometimes useful to extend them a little bit to allow lowerdimensional objects with zero area, such as lines and points, to be intersected. For example, consider a cube constructed of line segments. The bounding box for this shape fits the cube exactly. If an application wants to allow a nearmiss of the silhouette edges of the cube to be considered an intersection, it has to loosen the bbox culling test a little bit.
To distinguish when this loosening is necessary, each GfBBox3d
instance maintains a flag indicating whether any zeroarea primitives are contained within it. The application is responsible for setting this flag correctly by calling SetHasZeroAreaPrimitives()
. The flag can be accessed during intersection tests by calling HasZeroAreaPrimitives()
. This flag is set by default in all constructors to false
.

inline 

inline 
Combines two bboxes, returning a new bbox that contains both.
This uses the coordinate space of one of the two original boxes as the space of the result; it uses the one that produces whe smaller of the two resulting boxes.

inline 
GF_API GfRange3d ComputeAlignedRange  (  )  const 
Returns the axisaligned range (as a GfRange3d
) that results from applying the transformation matrix to the wxisaligned box and aligning the result.
GF_API GfVec3d ComputeCentroid  (  )  const 
Returns the centroid of the bounding box.
The centroid is computed as the transformed centroid of the range.

inline 

inline 

inline 

inline 
GF_API double GetVolume  (  )  const 
Returns the volume of the box (0 for an empty box).

inline 

inline 

inline 

inline 

inline 
Sets the zeroarea primitives flag to the given value.

inline 

inline 

inline 