Open Inventor Reference
SbXfBox3f Class Reference

3D box with an associated transformation matrix. More...

#include <Inventor/SbBox.h>

Inheritance diagram for SbXfBox3f:
SbBox3f

List of all members.

Public Member Functions

 SbXfBox3f ()
 Constructors and destructor.
 SbXfBox3f (const SbVec3f &_min, const SbVec3f &_max)
 Constructors and destructor.
 SbXfBox3f (const SbBox3f &box)
 Constructors and destructor.
 ~SbXfBox3f ()
 Constructors and destructor.
void setTransform (const SbMatrix &m)
 Sets the transformation on the box.
const SbMatrixgetTransform () const
 Gets the transformation on the box, and its inverse.
const SbMatrixgetInverse () const
 Gets the transformation on the box, and its inverse.
SbVec3f getCenter () const
 Returns the center of the box.
void extendBy (const SbVec3f &pt)
 Extends the box (if necessary) to contain the given 3D point.
void extendBy (const SbBox3f &bb)
 Extends the box (if necessary) to contain the given SbBox3f.
void extendBy (const SbXfBox3f &bb)
 Extends the box (if necessary) to contain the given SbXfBox3f.
SbBool intersect (const SbVec3f &pt) const
 Returns TRUE if intersection of given point and Box3f is not empty.
SbBool intersect (const SbBox3f &bb) const
 Returns TRUE if intersection of given XfBox3f and Box3f is not empty.
void setBounds (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Common get and set functions.
void setBounds (const SbVec3f &_min, const SbVec3f &_max)
 Set and get the bounds of the box.
void getBounds (float &xmin, float &ymin, float &zmin, float &xmax, float &ymax, float &zmax) const
void getBounds (SbVec3f &_min, SbVec3f &_max) const
void getOrigin (float &originX, float &originY, float &originZ)
 Returns origin (minimum point) of the box.
void getSize (float &sizeX, float &sizeY, float &sizeZ)
 Returns size of the box.
float getVolume () const
 Gives the volume of the box (0 for an empty box).
void makeEmpty ()
 Sets Box3f to contain nothing.
SbBool isEmpty () const
 Checks if the box is empty (degenerate) note that this relies on boxes being completely degenerate if they are degenerate at all.
SbBool hasVolume () const
 Checks if the box has volume; i.e., all three dimensions have positive size.
void getSpan (const SbVec3f &direction, float &dMin, float &dMax) const
 Finds the extent of the box along a particular direction.
void transform (const SbMatrix &m)
 Transforms the box by the given matrix.
SbBox3f project () const
 Projects an SbXfBox3f to an SbBox3f.

Friends

INVENTOR_API int operator== (const SbXfBox3f &b1, const SbXfBox3f &b2)
 Equality comparisons.
INVENTOR_API int operator!= (const SbXfBox3f &b1, const SbXfBox3f &b2)

Detailed Description

A 3D box with an arbitrary transformation applied. This class is useful when a box will be transformed frequently; if an SbBox3f is used for this purpose it will expand each time it is transformed in order to keep itself axis-aligned. Transformations can be accumulated on an SbXfBox3f without expanding the box, and after all transformations have been done, the box can be expanded to an axis-aligned box if necessary.

See Also
SbBox3f, SbBox2f, SbBox2s, SbVec3f, SbVec2f, SbVec2s, SbMatrix, SoGetBoundingBoxAction

Definition at line 225 of file SbBox.h.


Constructor & Destructor Documentation

SbXfBox3f::SbXfBox3f ( )
SbXfBox3f::SbXfBox3f ( const SbVec3f _min,
const SbVec3f _max 
)
SbXfBox3f::SbXfBox3f ( const SbBox3f box)
SbXfBox3f::~SbXfBox3f ( ) [inline]

Definition at line 238 of file SbBox.h.


Member Function Documentation

void SbXfBox3f::extendBy ( const SbVec3f pt)

If the box has had a non-identity transformation applied using the setTransform() method, the point is assumed to be in the transformed space. For example, the following code sequence:

 SbXfBox3f bbox; bbox.extendBy(SbVec3f(0,0,0));
 SbMatrix trans; trans.setTranslate(SbVec3f(1,1,1));
 bbox.setTransform(trans);
 bbox.extendBy(SbVec3f(0,0,0));

will result in a bounding box extending from (-1,-1,-1) to (0,0,0) in bbox'es local (untransformed) space.

Reimplemented from SbBox3f.

void SbXfBox3f::extendBy ( const SbBox3f bb) [inline]

If the box has had a non-identity transformation applied using the setTransform() method, the given SbBox3f is assumed to be in the transformed space.

Reimplemented from SbBox3f.

Definition at line 269 of file SbBox.h.

References extendBy().

Referenced by extendBy().

void SbXfBox3f::extendBy ( const SbXfBox3f bb)
void SbXfBox3f::getBounds ( float &  xmin,
float &  ymin,
float &  zmin,
float &  xmax,
float &  ymax,
float &  zmax 
) const [inline]

Reimplemented from SbBox3f.

Definition at line 291 of file SbBox.h.

References SbBox3f::getBounds().

void SbXfBox3f::getBounds ( SbVec3f _min,
SbVec3f _max 
) const [inline]

Reimplemented from SbBox3f.

Definition at line 295 of file SbBox.h.

References SbBox3f::getBounds().

SbVec3f SbXfBox3f::getCenter ( ) const

Reimplemented from SbBox3f.

const SbMatrix& SbXfBox3f::getInverse ( ) const [inline]

Definition at line 246 of file SbBox.h.

void SbXfBox3f::getOrigin ( float &  originX,
float &  originY,
float &  originZ 
) [inline]

Definition at line 299 of file SbBox.h.

References SbBox3f::getOrigin().

void SbXfBox3f::getSize ( float &  sizeX,
float &  sizeY,
float &  sizeZ 
) [inline]

Definition at line 305 of file SbBox.h.

References SbBox3f::getSize().

void SbXfBox3f::getSpan ( const SbVec3f direction,
float &  dMin,
float &  dMax 
) const [inline]

Reimplemented from SbBox3f.

Definition at line 325 of file SbBox.h.

const SbMatrix& SbXfBox3f::getTransform ( ) const [inline]

Definition at line 244 of file SbBox.h.

float SbXfBox3f::getVolume ( ) const

Reimplemented from SbBox3f.

SbBool SbXfBox3f::hasVolume ( ) const [inline]

Reimplemented from SbBox3f.

Definition at line 322 of file SbBox.h.

References SbBox3f::hasVolume().

SbBool SbXfBox3f::intersect ( const SbVec3f pt) const

Reimplemented from SbBox3f.

SbBool SbXfBox3f::intersect ( const SbBox3f bb) const [inline]

Reimplemented from SbBox3f.

Definition at line 279 of file SbBox.h.

SbBool SbXfBox3f::isEmpty ( ) const [inline]

All member functions preserve this invariant.

Reimplemented from SbBox3f.

Definition at line 318 of file SbBox.h.

References SbBox3f::isEmpty().

void SbXfBox3f::makeEmpty ( ) [inline]

Reimplemented from SbBox3f.

Definition at line 312 of file SbBox.h.

References SbBox3f::makeEmpty().

SbBox3f SbXfBox3f::project ( ) const
void SbXfBox3f::setBounds ( float  xmin,
float  ymin,
float  zmin,
float  xmax,
float  ymax,
float  zmax 
) [inline]

Reimplemented from SbBox3f.

Definition at line 283 of file SbBox.h.

References SbBox3f::setBounds().

void SbXfBox3f::setBounds ( const SbVec3f _min,
const SbVec3f _max 
) [inline]

Reimplemented from SbBox3f.

Definition at line 288 of file SbBox.h.

References SbBox3f::setBounds().

void SbXfBox3f::setTransform ( const SbMatrix m)
void SbXfBox3f::transform ( const SbMatrix m)

Reimplemented from SbBox3f.


Friends And Related Function Documentation

INVENTOR_API int operator!= ( const SbXfBox3f b1,
const SbXfBox3f b2 
) [friend]

Definition at line 337 of file SbBox.h.

INVENTOR_API int operator== ( const SbXfBox3f b1,
const SbXfBox3f b2 
) [friend]

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