Open Inventor Reference
SbXfBox3f Class Reference

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

#include <Inventor/SbBox.h>

Inheritance diagram for SbXfBox3f:
SbBox3f

Public Member Functions

 SbXfBox3f ()
 Constructors and destructor. More...
 
 SbXfBox3f (const SbVec3f &_min, const SbVec3f &_max)
 Constructors and destructor. More...
 
 SbXfBox3f (const SbBox3f &box)
 Constructors and destructor. More...
 
 ~SbXfBox3f ()
 Constructors and destructor. More...
 
void setTransform (const SbMatrix &m)
 Sets the transformation on the box. More...
 
const SbMatrixgetTransform () const
 Gets the transformation on the box, and its inverse. More...
 
const SbMatrixgetInverse () const
 Gets the transformation on the box, and its inverse. More...
 
SbVec3f getCenter () const
 Returns the center of the box. More...
 
void extendBy (const SbVec3f &pt)
 Extends the box (if necessary) to contain the given 3D point. More...
 
void extendBy (const SbBox3f &bb)
 Extends the box (if necessary) to contain the given SbBox3f. More...
 
void extendBy (const SbXfBox3f &bb)
 Extends the box (if necessary) to contain the given SbXfBox3f. More...
 
bool intersect (const SbVec3f &pt) const
 Returns TRUE if intersection of given point and Box3f is not empty. More...
 
bool intersect (const SbBox3f &bb) const
 Returns TRUE if intersection of given XfBox3f and Box3f is not empty. More...
 
void setBounds (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Common get and set functions. More...
 
void setBounds (const SbVec3f &_min, const SbVec3f &_max)
 Set and get the bounds of the box. More...
 
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. More...
 
void getSize (float &sizeX, float &sizeY, float &sizeZ)
 Returns size of the box. More...
 
float getVolume () const
 Gives the volume of the box (0 for an empty box). More...
 
void makeEmpty ()
 Sets Box3f to contain nothing. More...
 
bool isEmpty () const
 Checks if the box is empty (degenerate) note that this relies on boxes being completely degenerate if they are degenerate at all. More...
 
bool hasVolume () const
 Checks if the box has volume; i.e., all three dimensions have positive size. More...
 
void getSpan (const SbVec3f &direction, float &dMin, float &dMax) const
 Finds the extent of the box along a particular direction. More...
 
void transform (const SbMatrix &m)
 Transforms the box by the given matrix. More...
 
SbBox3f project () const
 Projects an SbXfBox3f to an SbBox3f. More...
 
- Public Member Functions inherited from SbBox3f
 SbBox3f ()
 Empty box constructor. More...
 
 SbBox3f (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Constructor given bounds. More...
 
 SbBox3f (const SbVec3f &min, const SbVec3f &max)
 Constructor given minimum and maximum points min and max are the corners of the diagonal that define the box. More...
 
 ~SbBox3f ()
 Destructor. More...
 
const SbVec3fgetMin () const
 Returns the minimum point of the box. More...
 
const SbVec3fgetMax () const
 Returns the maximum point of the box. More...
 
SbVec3fgetMin ()
 Returns the minimum point of the box. More...
 
SbVec3fgetMax ()
 Returns the maximum point of the box. More...
 
SbVec3f getCenter () const
 Returns the center of the box. More...
 
void extendBy (const SbVec3f &pt)
 Extends Box3f (if necessary) to contain given 3D point. More...
 
void extendBy (const SbBox3f &bb)
 Extends Box3f (if necessary) to contain given Box3f. More...
 
bool intersect (const SbVec3f &pt) const
 Returns TRUE if intersection of given point and Box3f is not empty. More...
 
bool intersect (const SbBox3f &bb) const
 Returns TRUE if intersection of given Box3f and Box3f is not empty. More...
 
bool outside (const SbMatrix &MVP, int &cullBits) const
 Returns TRUE if bounding box is completely outside the view-volume defined by the model+view+projection matrix given. More...
 
void setBounds (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Common get and set functions. More...
 
void setBounds (const SbVec3f &_min, const SbVec3f &_max)
 
void getBounds (float &xmin, float &ymin, float &zmin, float &xmax, float &ymax, float &zmax) const
 
void getBounds (SbVec3f &_min, SbVec3f &_max) const
 
SbVec3f getClosestPoint (const SbVec3f &point)
 Returns the closest point on the box to the given point. More...
 
void getOrigin (float &originX, float &originY, float &originZ) const
 Gets box origin which is the same as the minimum corner of the box. More...
 
void getSize (float &sizeX, float &sizeY, float &sizeZ) const
 Gets box size. More...
 
void makeEmpty ()
 Makes an empty box. More...
 
bool isEmpty () const
 Returns TRUE if the box is empty, and FALSE otherwise. More...
 
bool hasVolume () const
 Returns TRUE if all three dimensions of the box have positive size, and FALSE otherwise. More...
 
void getSpan (const SbVec3f &direction, float &dMin, float &dMax) const
 Finds the span of a box along a specified direction. More...
 
void transform (const SbMatrix &m)
 Transforms box by matrix, enlarging box to contain result. More...
 
float getVolume () const
 Returns the volume of the box. More...
 

Friends

INVENTOR_API bool operator== (const SbXfBox3f &b1, const SbXfBox3f &b2)
 Equality comparisons. More...
 
INVENTOR_API bool 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 228 of file SbBox.h.

Constructor & Destructor Documentation

◆ SbXfBox3f() [1/3]

SbXfBox3f::SbXfBox3f ( )

◆ SbXfBox3f() [2/3]

SbXfBox3f::SbXfBox3f ( const SbVec3f _min,
const SbVec3f _max 
)

◆ SbXfBox3f() [3/3]

SbXfBox3f::SbXfBox3f ( const SbBox3f box)

◆ ~SbXfBox3f()

SbXfBox3f::~SbXfBox3f ( )
inline

Definition at line 241 of file SbBox.h.

Member Function Documentation

◆ extendBy() [1/3]

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.

Definition at line 272 of file SbBox.h.

◆ extendBy() [2/3]

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));
4x4 matrix class.
Definition: SbLinear.h:823
void setTranslate(const SbVec3f &t)
Sets matrix to translate by given vector.
3D vector class.
Definition: SbLinear.h:120
3D box with an associated transformation matrix.
Definition: SbBox.h:228
void setTransform(const SbMatrix &m)
Sets the transformation on the box.
void extendBy(const SbVec3f &pt)
Extends the box (if necessary) to contain the given 3D point.

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

◆ extendBy() [3/3]

void SbXfBox3f::extendBy ( const SbXfBox3f bb)

◆ getBounds() [1/2]

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

Definition at line 294 of file SbBox.h.

References SbBox3f::getBounds().

◆ getBounds() [2/2]

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

Definition at line 298 of file SbBox.h.

References SbBox3f::getBounds().

◆ getCenter()

SbVec3f SbXfBox3f::getCenter ( ) const

◆ getInverse()

const SbMatrix& SbXfBox3f::getInverse ( ) const
inline

Definition at line 249 of file SbBox.h.

◆ getOrigin()

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

Definition at line 302 of file SbBox.h.

References SbBox3f::getOrigin().

◆ getSize()

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

Definition at line 308 of file SbBox.h.

References SbBox3f::getSize().

◆ getSpan()

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

Definition at line 328 of file SbBox.h.

◆ getTransform()

const SbMatrix& SbXfBox3f::getTransform ( ) const
inline

Definition at line 247 of file SbBox.h.

◆ getVolume()

float SbXfBox3f::getVolume ( ) const

◆ hasVolume()

bool SbXfBox3f::hasVolume ( ) const
inline

Definition at line 325 of file SbBox.h.

References SbBox3f::hasVolume().

◆ intersect() [1/2]

bool SbXfBox3f::intersect ( const SbBox3f bb) const
inline

Definition at line 282 of file SbBox.h.

◆ intersect() [2/2]

bool SbXfBox3f::intersect ( const SbVec3f pt) const

◆ isEmpty()

bool SbXfBox3f::isEmpty ( ) const
inline

All member functions preserve this invariant.

Definition at line 321 of file SbBox.h.

References SbBox3f::isEmpty().

◆ makeEmpty()

void SbXfBox3f::makeEmpty ( )
inline

Definition at line 315 of file SbBox.h.

References SbBox3f::makeEmpty().

◆ project()

SbBox3f SbXfBox3f::project ( ) const

◆ setBounds() [1/2]

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

Definition at line 291 of file SbBox.h.

References SbBox3f::setBounds().

◆ setBounds() [2/2]

void SbXfBox3f::setBounds ( float  xmin,
float  ymin,
float  zmin,
float  xmax,
float  ymax,
float  zmax 
)
inline

Definition at line 286 of file SbBox.h.

References SbBox3f::setBounds().

◆ setTransform()

void SbXfBox3f::setTransform ( const SbMatrix m)

◆ transform()

void SbXfBox3f::transform ( const SbMatrix m)

Friends And Related Function Documentation

◆ operator!=

INVENTOR_API bool operator!= ( const SbXfBox3f b1,
const SbXfBox3f b2 
)
friend

Definition at line 353 of file SbBox.h.

◆ operator==

INVENTOR_API bool operator== ( const SbXfBox3f b1,
const SbXfBox3f b2 
)
friend

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