Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SbXfBox3f Class Reference

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

#include <Inventor/SbBox.h>

+ Inheritance diagram for SbXfBox3f:

Public Member Functions

 SbXfBox3f ()
 Constructor.
 
 SbXfBox3f (const SbVec3f &_min, const SbVec3f &_max)
 Constructor.
 
 SbXfBox3f (const SbBox3f &box)
 Constructor.
 
 ~SbXfBox3f ()
 Destructor.
 
void setTransform (const SbMatrix &m)
 Sets the transformation on the box.
 
const SbMatrixgetTransform () const
 Gets the transformation on the box.
 
const SbMatrixgetInverse () const
 Gets the inverse of the transformation on the box.
 
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 box.
 
void extendBy (const SbXfBox3f &bb)
 Extends the box (if necessary) to contain the given box.
 
SbBool intersect (const SbVec3f &pt) const
 Returns TRUE if intersection of given point and this box is not empty.
 
SbBool intersect (const SbBox3f &bb) const
 Returns TRUE if intersection of given box and this box is not empty.
 
SbXfBox3fsetValue (const SbXfBox3d &xfbox3d)
 Sets value of the box from a double precision box.
 
void setBounds (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Sets the bounds of the box.
 
void setBounds (const SbVec3f &_min, const SbVec3f &_max)
 Sets the bounds of the box.
 
void getBounds (float &xmin, float &ymin, float &zmin, float &xmax, float &ymax, float &zmax) const
 Gets the bounds of the box.
 
void getBounds (SbVec3f &_min, SbVec3f &_max) const
 Gets the bounds of the box.
 
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 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 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.
 
SbVec3f getClosestPoint (const SbVec3f &point) const
 Returns the closest point on the box to the given point.
 
float computeMaxDistance2 (const SbVec3f &p) const
 Returns the squared maximum distance between a point and the 8 bounding box's vertices.
 
- Public Member Functions inherited from SbBox3f
 SbBox3f ()
 Constructor for a 3D float box.
 
 SbBox3f (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Constructor for a 3D float box.
 
 SbBox3f (const SbVec3f &_min, const SbVec3f &_max)
 Constructor for a 3D float box.
 
 ~SbBox3f ()
 Destructor.
 
const SbVec3fgetMin () const
 Returns the minimum point of the box.
 
SbVec3fgetMin ()
 Returns the minimum point of the box.
 
const SbVec3fgetMax () const
 Returns the maximum point of the box.
 
SbVec3fgetMax ()
 Returns the maximum point of the box.
 
SbVec3f getCenter () const
 Returns the center of the box.
 
void extendBy (const SbVec3f &pt)
 Extends this box (if necessary) to contain the specified point.
 
void extendBy (const SbBox3f &bb)
 Extends this box (if necessary) to contain the specified box.
 
SbBool intersect (const SbVec3f &pt) const
 Returns TRUE if the specified point intersects this box.
 
SbBool intersect (const SbBox3f &bb) const
 Returns TRUE if the specified box intersects this box.
 
SbBox3f intersection (const SbBox3f &box) const
 Returns the intersection of the specified box with this box.
 
SbBool contains (const SbBox3f &bb) const
 Returns TRUE if the specified box is fully contained inside this box.
 
SbBool 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.
 
void setBounds (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
 Sets the corners of the box.
 
void setBounds (const SbVec3f &_min, const SbVec3f &_max)
 Sets the corners of the box.
 
void getBounds (float &xmin, float &ymin, float &zmin, float &xmax, float &ymax, float &zmax) const
 Gets the corners of the box.
 
void getBounds (SbVec3f &_min, SbVec3f &_max) const
 Gets the corners of the box.
 
SbVec3f getClosestPoint (const SbVec3f &point) const
 Returns the closest point on the box to the given point.
 
void getOrigin (float &originX, float &originY, float &originZ) const
 Gets box origin which is the same as the minimum corner of the box.
 
void getSize (float &sizeX, float &sizeY, float &sizeZ) const
 Gets box size.
 
SbVec3f 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 SbVec3f &direction, float &dMin, float &dMax) const
 Finds the span of a box along a specified direction.
 
void transform (const SbMatrix &m)
 Transforms box by matrix, enlarging box to contain result.
 
float getVolume () const
 Returns the volume of the box.
 
template<typename T >
 SbBox3f (const T &b)
 Constructor that converts an arbitrary SbBox3 to an SbBox3f.
 
float computeMaxDistance2 (const SbVec3f &p) const
 Returns the squared maximum distance between a point and the 8 bounding box's vertices.
 
SbBool triangleBoxOverlap (const SbVec3f &u0, const SbVec3f &u1, const SbVec3f &u2) const
 Return true if the given triangle intersects the bounding box.
 

Friends

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

Detailed Description

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 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 1250 of file SbBox.h.

Constructor & Destructor Documentation

◆ SbXfBox3f() [1/3]

SbXfBox3f::SbXfBox3f ( )

Constructor.

The box is initially empty.

◆ SbXfBox3f() [2/3]

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

Constructor.

◆ SbXfBox3f() [3/3]

SbXfBox3f::SbXfBox3f ( const SbBox3f box)

Constructor.

◆ ~SbXfBox3f()

SbXfBox3f::~SbXfBox3f ( )
inline

Destructor.

Definition at line 1271 of file SbBox.h.

Member Function Documentation

◆ computeMaxDistance2()

float SbXfBox3f::computeMaxDistance2 ( const SbVec3f p) const

Returns the squared maximum distance between a point and the 8 bounding box's vertices.

◆ extendBy() [1/3]

void SbXfBox3f::extendBy ( const SbBox3f bb)
inline

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

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 1341 of file SbBox.h.

◆ extendBy() [2/3]

void SbXfBox3f::extendBy ( const SbVec3f 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:

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 SbMatrix.h:309
void setTranslate(const SbVec3f &t)
Sets matrix to translate by given vector.
3D vector class.
Definition SbVec.h:932
3D box with an associated transformation matrix.
Definition SbBox.h:1250
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 the bbox's local (untransformed) space.

◆ extendBy() [3/3]

void SbXfBox3f::extendBy ( const SbXfBox3f bb)

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

◆ getBounds() [1/2]

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

Gets the bounds of the box.

Definition at line 1381 of file SbBox.h.

◆ getBounds() [2/2]

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

Gets the bounds of the box.

Definition at line 1389 of file SbBox.h.

◆ getCenter()

SbVec3f SbXfBox3f::getCenter ( ) const

Returns the center of the box.

◆ getClosestPoint()

SbVec3f SbXfBox3f::getClosestPoint ( const SbVec3f point) const

Returns the closest point on the box to the given point.

(Returns the point on the center of the Z face if passed the center.)

◆ getInverse()

const SbMatrix & SbXfBox3f::getInverse ( ) const
inline

Gets the inverse of the transformation on the box.

Definition at line 1288 of file SbBox.h.

◆ getOrigin()

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

Returns origin (minimum point) of the box.

Definition at line 1395 of file SbBox.h.

◆ getSize()

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

Returns size of the box.

Definition at line 1402 of file SbBox.h.

◆ getSpan()

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

Finds the extent of the box along a particular direction.

Definition at line 1428 of file SbBox.h.

◆ getTransform()

const SbMatrix & SbXfBox3f::getTransform ( ) const
inline

Gets the transformation on the box.

Definition at line 1282 of file SbBox.h.

◆ getVolume()

float SbXfBox3f::getVolume ( ) const

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

◆ hasVolume()

SbBool SbXfBox3f::hasVolume ( ) const
inline

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

Definition at line 1423 of file SbBox.h.

◆ intersect() [1/2]

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

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

Definition at line 1357 of file SbBox.h.

◆ intersect() [2/2]

SbBool SbXfBox3f::intersect ( const SbVec3f pt) const

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

◆ isEmpty()

SbBool SbXfBox3f::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 1418 of file SbBox.h.

◆ makeEmpty()

void SbXfBox3f::makeEmpty ( )
inline

Sets the box to contain nothing.

Definition at line 1413 of file SbBox.h.

◆ project()

SbBox3f SbXfBox3f::project ( ) const

Projects an SbXfBox3f to an SbBox3f.

◆ setBounds() [1/2]

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

Sets the bounds of the box.

Definition at line 1375 of file SbBox.h.

◆ setBounds() [2/2]

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

Sets the bounds of the box.

Definition at line 1368 of file SbBox.h.

◆ setTransform()

void SbXfBox3f::setTransform ( const SbMatrix m)

Sets the transformation on the box.

◆ setValue()

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

Sets value of the box from a double precision box.

Definition at line 1736 of file SbBox.h.

◆ transform()

void SbXfBox3f::transform ( const SbMatrix m)

Transforms the box by the given matrix.

Friends And Related Symbol Documentation

◆ operator!=

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

Inequality comparison.

Definition at line 1460 of file SbBox.h.

◆ operator==

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

Equality comparison.


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