Open Inventor Reference
SbXfBox3d Class Reference

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

#include <Inventor/SbBoxd.h>

Inheritance diagram for SbXfBox3d:
SbBox3d

Public Member Functions

 SbXfBox3d ()
 Constructors and destructor. More...
 
 SbXfBox3d (const SbVec3d &_min, const SbVec3d &_max)
 Constructors and destructor. More...
 
 SbXfBox3d (const SbBox3d &box)
 Constructors and destructor. More...
 
 ~SbXfBox3d ()
 Constructors and destructor. More...
 
void setTransform (const SbMatrixd &m)
 Sets the transformation on the box. More...
 
const SbMatrixdgetTransform () const
 Gets the transformation on the box, and its inverse. More...
 
const SbMatrixdgetInverse () const
 Gets the transformation on the box, and its inverse. More...
 
SbVec3d getCenter () const
 Returns the center of the box. More...
 
void extendBy (const SbVec3d &pt)
 Extends the box (if necessary) to contain the given 3D point. More...
 
void extendBy (const SbBox3d &bb)
 Extends the box (if necessary) to contain the given SbBox3d. More...
 
void extendBy (const SbXfBox3d &bb)
 Extends the box (if necessary) to contain the given SbXfBox3d. More...
 
bool intersect (const SbVec3d &pt) const
 Returns TRUE if intersection of given point and Box3d is not empty. More...
 
bool intersect (const SbBox3d &bb) const
 Returns TRUE if intersection of given XfBox3d and Box3d is not empty. More...
 
void setBounds (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Common get and set functions. More...
 
void setBounds (const SbVec3d &_min, const SbVec3d &_max)
 Set and get the bounds of the box. More...
 
void getBounds (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const
 
void getBounds (SbVec3d &_min, SbVec3d &_max) const
 
void getOrigin (double &originX, double &originY, double &originZ)
 Returns origin (minimum point) of the box. More...
 
void getSize (double &sizeX, double &sizeY, double &sizeZ)
 Returns size of the box. More...
 
double getVolume () const
 Gives the volume of the box (0 for an empty box). More...
 
void makeEmpty ()
 Sets Box3d 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 SbVec3d &direction, double &dMin, double &dMax) const
 Finds the extent of the box along a particular direction. More...
 
void transform (const SbMatrixd &m)
 Transforms the box by the given matrix. More...
 
SbBox3d project () const
 Projects an SbXfBox3d to an SbBox3d. More...
 
- Public Member Functions inherited from SbBox3d
 SbBox3d ()
 Empty box constructor. More...
 
 SbBox3d (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Constructor given bounds. More...
 
 SbBox3d (const SbVec3d &min, const SbVec3d &max)
 Constructor given minimum and maximum points min and max are the corners of the diagonal that define the box. More...
 
 ~SbBox3d ()
 Destructor. More...
 
const SbVec3dgetMin () const
 Returns the minimum point of the box. More...
 
const SbVec3dgetMax () const
 Returns the maximum point of the box. More...
 
SbVec3dgetMin ()
 Returns the minimum point of the box. More...
 
SbVec3dgetMax ()
 Returns the maximum point of the box. More...
 
SbVec3d getCenter () const
 Returns the center of the box. More...
 
void extendBy (const SbVec3d &pt)
 Extends Box3d (if necessary) to contain given 3D point. More...
 
void extendBy (const SbBox3d &bb)
 Extends Box3d (if necessary) to contain given Box3d. More...
 
bool intersect (const SbVec3d &pt) const
 Returns TRUE if intersection of given point and Box3d is not empty. More...
 
bool intersect (const SbBox3d &bb) const
 Returns TRUE if intersection of given Box3d and Box3d is not empty. More...
 
bool outside (const SbMatrixd &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 (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Common get and set functions. More...
 
void setBounds (const SbVec3d &_min, const SbVec3d &_max)
 
void getBounds (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const
 
void getBounds (SbVec3d &_min, SbVec3d &_max) const
 
SbVec3d getClosestPoint (const SbVec3d &point)
 Returns the closest point on the box to the given point. More...
 
void getOrigin (double &originX, double &originY, double &originZ) const
 Gets box origin which is the same as the minimum corner of the box. More...
 
void getSize (double &sizeX, double &sizeY, double &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 SbVec3d &direction, double &dMin, double &dMax) const
 Finds the span of a box along a specified direction. More...
 
void transform (const SbMatrixd &m)
 Transforms box by matrix, enlarging box to contain result. More...
 
double getVolume () const
 Returns the volume of the box. More...
 

Friends

INVENTOR_API bool operator== (const SbXfBox3d &b1, const SbXfBox3d &b2)
 Equality comparisons. More...
 
INVENTOR_API bool operator!= (const SbXfBox3d &b1, const SbXfBox3d &b2)
 

Detailed Description

A 3D box with an arbitrary transformation applied. This class is useful when a box will be transformed frequently; if an SbBox3d 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 SbXfBox3d 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, SbBox3d, SbBox2d, SbVec3d, SbVec2d, SbMatrixd

Definition at line 229 of file SbBoxd.h.

Constructor & Destructor Documentation

◆ SbXfBox3d() [1/3]

SbXfBox3d::SbXfBox3d ( )

◆ SbXfBox3d() [2/3]

SbXfBox3d::SbXfBox3d ( const SbVec3d _min,
const SbVec3d _max 
)

◆ SbXfBox3d() [3/3]

SbXfBox3d::SbXfBox3d ( const SbBox3d box)

◆ ~SbXfBox3d()

SbXfBox3d::~SbXfBox3d ( )
inline

Definition at line 242 of file SbBoxd.h.

Member Function Documentation

◆ extendBy() [1/3]

void SbXfBox3d::extendBy ( const SbBox3d bb)
inline

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

Definition at line 273 of file SbBoxd.h.

◆ extendBy() [2/3]

void SbXfBox3d::extendBy ( const SbVec3d 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:

SbXfBox3d bbox; bbox.extendBy(SbVec3d(0,0,0));
SbMatrixd trans; trans.setTranslate(SbVec3d(1,1,1));
bbox.setTransform(trans);
bbox.extendBy(SbVec3d(0,0,0));
4x4 matrix class with double values.
Definition: SbLineard.h:616
void setTranslate(const SbVec3d &t)
Sets matrix to translate by given vector.
3D vector class with double values.
Definition: SbLineard.h:116
3D box with an associated transformation matrix.
Definition: SbBoxd.h:229
void setTransform(const SbMatrixd &m)
Sets the transformation on the box.
void extendBy(const SbVec3d &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 SbXfBox3d::extendBy ( const SbXfBox3d bb)

◆ getBounds() [1/2]

void SbXfBox3d::getBounds ( double &  xmin,
double &  ymin,
double &  zmin,
double &  xmax,
double &  ymax,
double &  zmax 
) const
inline

Definition at line 295 of file SbBoxd.h.

References SbBox3d::getBounds().

◆ getBounds() [2/2]

void SbXfBox3d::getBounds ( SbVec3d _min,
SbVec3d _max 
) const
inline

Definition at line 299 of file SbBoxd.h.

References SbBox3d::getBounds().

◆ getCenter()

SbVec3d SbXfBox3d::getCenter ( ) const

◆ getInverse()

const SbMatrixd& SbXfBox3d::getInverse ( ) const
inline

Definition at line 250 of file SbBoxd.h.

◆ getOrigin()

void SbXfBox3d::getOrigin ( double &  originX,
double &  originY,
double &  originZ 
)
inline

Definition at line 303 of file SbBoxd.h.

References SbBox3d::getOrigin().

◆ getSize()

void SbXfBox3d::getSize ( double &  sizeX,
double &  sizeY,
double &  sizeZ 
)
inline

Definition at line 309 of file SbBoxd.h.

References SbBox3d::getSize().

◆ getSpan()

void SbXfBox3d::getSpan ( const SbVec3d direction,
double &  dMin,
double &  dMax 
) const
inline

Definition at line 329 of file SbBoxd.h.

◆ getTransform()

const SbMatrixd& SbXfBox3d::getTransform ( ) const
inline

Definition at line 248 of file SbBoxd.h.

◆ getVolume()

double SbXfBox3d::getVolume ( ) const

◆ hasVolume()

bool SbXfBox3d::hasVolume ( ) const
inline

Definition at line 326 of file SbBoxd.h.

References SbBox3d::hasVolume().

◆ intersect() [1/2]

bool SbXfBox3d::intersect ( const SbBox3d bb) const
inline

Definition at line 283 of file SbBoxd.h.

◆ intersect() [2/2]

bool SbXfBox3d::intersect ( const SbVec3d pt) const

◆ isEmpty()

bool SbXfBox3d::isEmpty ( ) const
inline

All member functions preserve this invariant.

Definition at line 322 of file SbBoxd.h.

References SbBox3d::isEmpty().

◆ makeEmpty()

void SbXfBox3d::makeEmpty ( )
inline

Definition at line 316 of file SbBoxd.h.

References SbBox3d::makeEmpty().

◆ project()

SbBox3d SbXfBox3d::project ( ) const

◆ setBounds() [1/2]

void SbXfBox3d::setBounds ( const SbVec3d _min,
const SbVec3d _max 
)
inline

Definition at line 292 of file SbBoxd.h.

References SbBox3d::setBounds().

◆ setBounds() [2/2]

void SbXfBox3d::setBounds ( double  xmin,
double  ymin,
double  zmin,
double  xmax,
double  ymax,
double  zmax 
)
inline

Definition at line 287 of file SbBoxd.h.

References SbBox3d::setBounds().

◆ setTransform()

void SbXfBox3d::setTransform ( const SbMatrixd m)

◆ transform()

void SbXfBox3d::transform ( const SbMatrixd m)

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 354 of file SbBoxd.h.

◆ operator==

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

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