Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SbXfBox3d Class Reference

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

#include <Inventor/SbBox.h>

+ Inheritance diagram for SbXfBox3d:

Public Member Functions

 SbXfBox3d ()
 Constructor.
 
 SbXfBox3d (const SbVec3d &_min, const SbVec3d &_max)
 Constructor.
 
 SbXfBox3d (const SbBox3d &box)
 Constructor.
 
 ~SbXfBox3d ()
 Destructor.
 
void setTransform (const SbMatrixd &m)
 Sets the transformation on the box.
 
const SbMatrixdgetTransform () const
 Gets the transformation on the box.
 
const SbMatrixdgetInverse () const
 Gets the inverse of the transformation on the box.
 
SbVec3d getCenter () const
 Returns the center of the box.
 
void extendBy (const SbVec3d &pt)
 Extends the box (if necessary) to contain the given 3D point.
 
void extendBy (const SbBox3d &bb)
 Extends the box (if necessary) to contain the given box.
 
void extendBy (const SbXfBox3d &bb)
 Extends the box (if necessary) to contain the given box.
 
SbBool intersect (const SbVec3d &pt) const
 Returns TRUE if intersection of given point and this box is not empty.
 
SbBool intersect (const SbBox3d &bb) const
 Returns TRUE if intersection of this XfBox3d and the given Box3d is not empty.
 
SbXfBox3dsetValue (const SbXfBox3f &xfbox3f)
 Sets value of the box from a single precision box.
 
void setBounds (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Sets the bounds of the box.
 
void setBounds (const SbVec3d &_min, const SbVec3d &_max)
 Sets the bounds of the box.
 
void getBounds (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const
 Gets the bounds of the box.
 
void getBounds (SbVec3d &_min, SbVec3d &_max) const
 Gets the bounds of the box.
 
void getOrigin (double &originX, double &originY, double &originZ) const
 Returns origin (minimum point) of the box.
 
void getSize (double &sizeX, double &sizeY, double &sizeZ) const
 Returns size of the box.
 
double getVolume () const
 Gives the volume of the box (0 for an empty box).
 
void makeEmpty ()
 Sets the box to contain nothing.
 
SbBool isEmpty () const
 Returns TRUE if the box is empty, and FALSE otherwise.
 
SbBool hasVolume () const
 Checks if the box has volume; i.e., all three dimensions have positive size.
 
void getSpan (const SbVec3d &direction, double &dMin, double &dMax) const
 Finds the extent of the box along a particular direction.
 
void transform (const SbMatrixd &m)
 Transforms the box by the given matrix.
 
SbBox3d project () const
 Projects an SbXfBox3d to an SbBox3d.
 
- Public Member Functions inherited from SbBox3d
 SbBox3d ()
 Constructor for a 3D double box.
 
 SbBox3d (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Constructor for a 3D double box.
 
 SbBox3d (const SbVec3d &_min, const SbVec3d &_max)
 Constructor for a 3D double box.
 
 ~SbBox3d ()
 Destructor.
 
const SbVec3dgetMin () const
 Returns the minimum point of the box.
 
const SbVec3dgetMax () const
 Returns the maximum point of the box.
 
SbVec3dgetMin ()
 Returns the minimum point of the box.
 
SbVec3dgetMax ()
 Returns the maximum point of the box.
 
SbVec3d getCenter () const
 Returns the center of the box.
 
void extendBy (const SbVec3d &pt)
 Extends this box (if necessary) to contain the specified point.
 
void extendBy (const SbBox3d &bb)
 Extends this box (if necessary) to contain the specified box.
 
SbBool intersect (const SbVec3d &pt) const
 Returns TRUE if the specified point intersects this box.
 
SbBool intersect (const SbBox3d &bb) const
 Returns TRUE if the specified box intersects this box.
 
SbBox3d intersection (const SbBox3d &box) const
 Returns the intersection of the specified box with this box.
 
SbBool contains (const SbBox3d &bb) const
 Returns TRUE if the specified box is fully contained inside this box.
 
SbBool 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.
 
void setBounds (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Sets the corners of the box.
 
void setBounds (const SbVec3d &_min, const SbVec3d &_max)
 Sets the corners of the box.
 
void getBounds (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const
 Gets the corners of the box.
 
void getBounds (SbVec3d &_min, SbVec3d &_max) const
 Gets the corners of the box.
 
SbVec3d getClosestPoint (const SbVec3d &point) const
 Returns the closest point on the box to the given point.
 
void getOrigin (double &originX, double &originY, double &originZ) const
 Gets box origin which is the same as the minimum corner of the box.
 
void getSize (double &sizeX, double &sizeY, double &sizeZ) const
 Gets box size.
 
SbVec3d getSize () const
 Gets box size.
 
void makeEmpty ()
 Makes an empty box.
 
SbBool isEmpty () const
 Returns TRUE if the box is empty, and FALSE otherwise.
 
SbBool hasVolume () const
 Returns TRUE if all three dimensions of the box have positive size, and FALSE otherwise.
 
void getSpan (const SbVec3d &direction, double &dMin, double &dMax) const
 Finds the span of a box along a specified direction.
 
void transform (const SbMatrixd &m)
 Transforms box by matrix, enlarging box to contain result.
 
double getVolume () const
 Returns the volume of the box.
 
template<typename T >
 SbBox3d (const T &b)
 Constructor that converts an arbitrary SbBox3 to an SbBox3f.
 

Friends

int operator== (const SbXfBox3d &b1, const SbXfBox3d &b2)
 Equality comparison.
 
int operator!= (const SbXfBox3d &b1, const SbXfBox3d &b2)
 Inequality comparison.
 

Detailed Description

VSG extension 3D box with an associated transformation matrix.

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 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, SbVec3d, SbVec2f, SbVec2s, SbMatrix, SoGetBoundingBoxAction

Definition at line 1513 of file SbBox.h.

Constructor & Destructor Documentation

◆ SbXfBox3d() [1/3]

SbXfBox3d::SbXfBox3d ( )

Constructor.

The box is initially empty.

◆ SbXfBox3d() [2/3]

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

Constructor.

◆ SbXfBox3d() [3/3]

SbXfBox3d::SbXfBox3d ( const SbBox3d box)

Constructor.

◆ ~SbXfBox3d()

SbXfBox3d::~SbXfBox3d ( )
inline

Destructor.

Definition at line 1534 of file SbBox.h.

Member Function Documentation

◆ extendBy() [1/3]

void SbXfBox3d::extendBy ( const SbBox3d bb)
inline

Extends the box (if necessary) to contain the given box.

Definition at line 1602 of file SbBox.h.

◆ extendBy() [2/3]

void SbXfBox3d::extendBy ( const SbVec3d pt)

Extends the box (if necessary) to contain the given 3D point.

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(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 SbMatrix.h:309
void setTranslate(const SbVec3f &t)
Sets matrix to translate by given vector.
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 3D box with an a...
Definition SbBox.h:1513
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 the bbox's local (untransformed) space.

◆ extendBy() [3/3]

void SbXfBox3d::extendBy ( const SbXfBox3d bb)

Extends the box (if necessary) to contain the given box.

◆ getBounds() [1/2]

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

Gets the bounds of the box.

Definition at line 1642 of file SbBox.h.

◆ getBounds() [2/2]

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

Gets the bounds of the box.

Definition at line 1650 of file SbBox.h.

◆ getCenter()

SbVec3d SbXfBox3d::getCenter ( ) const

Returns the center of the box.

◆ getInverse()

const SbMatrixd & SbXfBox3d::getInverse ( ) const
inline

Gets the inverse of the transformation on the box.

Definition at line 1551 of file SbBox.h.

◆ getOrigin()

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

Returns origin (minimum point) of the box.

Definition at line 1656 of file SbBox.h.

◆ getSize()

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

Returns size of the box.

Definition at line 1662 of file SbBox.h.

◆ getSpan()

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

Finds the extent of the box along a particular direction.

Definition at line 1688 of file SbBox.h.

◆ getTransform()

const SbMatrixd & SbXfBox3d::getTransform ( ) const
inline

Gets the transformation on the box.

Definition at line 1545 of file SbBox.h.

◆ getVolume()

double SbXfBox3d::getVolume ( ) const

Gives the volume of the box (0 for an empty box).

◆ hasVolume()

SbBool SbXfBox3d::hasVolume ( ) const
inline

Checks if the box has volume; i.e., all three dimensions have positive size.

Definition at line 1683 of file SbBox.h.

◆ intersect() [1/2]

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

Returns TRUE if intersection of this XfBox3d and the given Box3d is not empty.

Definition at line 1618 of file SbBox.h.

◆ intersect() [2/2]

SbBool SbXfBox3d::intersect ( const SbVec3d pt) const

Returns TRUE if intersection of given point and this box is not empty.

◆ isEmpty()

SbBool SbXfBox3d::isEmpty ( ) const
inline

Returns TRUE if the box is empty, and FALSE otherwise.

Note: Setting the box to all zeros does not make it "empty". Use the makeEmpty() method. (This method only returns true if the maximum X value is less than the minimum X value.)

Definition at line 1678 of file SbBox.h.

◆ makeEmpty()

void SbXfBox3d::makeEmpty ( )
inline

Sets the box to contain nothing.

Definition at line 1673 of file SbBox.h.

◆ project()

SbBox3d SbXfBox3d::project ( ) const

Projects an SbXfBox3d to an SbBox3d.

◆ setBounds() [1/2]

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

Sets the bounds of the box.

Definition at line 1636 of file SbBox.h.

◆ setBounds() [2/2]

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

Sets the bounds of the box.

Definition at line 1629 of file SbBox.h.

◆ setTransform()

void SbXfBox3d::setTransform ( const SbMatrixd m)

Sets the transformation on the box.

◆ setValue()

SbXfBox3d & SbXfBox3d::setValue ( const SbXfBox3f xfbox3f)
inline

Sets value of the box from a single precision box.

Definition at line 1756 of file SbBox.h.

◆ transform()

void SbXfBox3d::transform ( const SbMatrixd m)

Transforms the box by the given matrix.

Friends And Related Symbol Documentation

◆ operator!=

int operator!= ( const SbXfBox3d b1,
const SbXfBox3d b2 
)
friend

Inequality comparison.

Definition at line 1709 of file SbBox.h.

◆ operator==

int operator== ( const SbXfBox3d b1,
const SbXfBox3d b2 
)
friend

Equality comparison.


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