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

VSG extension 3D box class. More...

#include <Inventor/SbBox.h>

+ Inheritance diagram for SbBox3d:

Public Member Functions

 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 SbBox3d &b1, const SbBox3d &b2)
 Equality comparison.
 
int operator!= (const SbBox3d &b1, const SbBox3d &b2)
 Inequality comparison.
 

Detailed Description

VSG extension 3D box class.

3D box which has planes parallel to the major axes and is specified by two points on a diagonal. This class is part of the standard Open Inventor datatype classes and is used as input and output to geometry operations (see SoGetBoundingBoxAction).

SEE ALSO

SbXfBox3f, SbBox2f, SbBox2s, SbVec3d, SbVec2f, SbVec2s, SbMatrix, SoGetBoundingBoxAction

Definition at line 972 of file SbBox.h.

Constructor & Destructor Documentation

◆ SbBox3d() [1/4]

SbBox3d::SbBox3d ( )
inline

Constructor for a 3D double box.

The box is initially empty.

Definition at line 978 of file SbBox.h.

◆ SbBox3d() [2/4]

SbBox3d::SbBox3d ( double  xmin,
double  ymin,
double  zmin,
double  xmax,
double  ymax,
double  zmax 
)
inline

Constructor for a 3D double box.

xmin , ymin , zmin , xmax , ymax and zmax are the bounds of the box.

Definition at line 985 of file SbBox.h.

◆ SbBox3d() [3/4]

SbBox3d::SbBox3d ( const SbVec3d _min,
const SbVec3d _max 
)
inline

Constructor for a 3D double box.

m_min and m_max are the corners of the diagonal that define the box.

Definition at line 993 of file SbBox.h.

◆ ~SbBox3d()

SbBox3d::~SbBox3d ( )
inline

Destructor.

Definition at line 999 of file SbBox.h.

◆ SbBox3d() [4/4]

template<typename T >
SbBox3d::SbBox3d ( const T &  b)
inlineexplicit

Constructor that converts an arbitrary SbBox3 to an SbBox3f.

Definition at line 1214 of file SbBox.h.

Member Function Documentation

◆ contains()

SbBool SbBox3d::contains ( const SbBox3d bb) const
inline

Returns TRUE if the specified box is fully contained inside this box.

Definition at line 1067 of file SbBox.h.

◆ extendBy() [1/2]

void SbBox3d::extendBy ( const SbBox3d bb)

Extends this box (if necessary) to contain the specified box.

◆ extendBy() [2/2]

void SbBox3d::extendBy ( const SbVec3d pt)

Extends this box (if necessary) to contain the specified point.

◆ getBounds() [1/2]

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

Gets the corners of the box.

Definition at line 1111 of file SbBox.h.

◆ getBounds() [2/2]

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

Gets the corners of the box.

Definition at line 1119 of file SbBox.h.

◆ getCenter()

SbVec3d SbBox3d::getCenter ( ) const

Returns the center of the box.

◆ getClosestPoint()

SbVec3d SbBox3d::getClosestPoint ( const SbVec3d 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.)

◆ getMax() [1/2]

SbVec3d & SbBox3d::getMax ( )
inline

Returns the maximum point of the box.

The maximum point is the corner of the box with the highest X, Y, and Z values.

Definition at line 1029 of file SbBox.h.

◆ getMax() [2/2]

const SbVec3d & SbBox3d::getMax ( ) const
inline

Returns the maximum point of the box.

The maximum point is the corner of the box with the highest X, Y, and Z values.

Definition at line 1015 of file SbBox.h.

◆ getMin() [1/2]

SbVec3d & SbBox3d::getMin ( )
inline

Returns the minimum point of the box.

The minimum point is the corner of the box with the lowest X, Y, and Z values.

Definition at line 1022 of file SbBox.h.

◆ getMin() [2/2]

const SbVec3d & SbBox3d::getMin ( ) const
inline

Returns the minimum point of the box.

The minimum point is the corner of the box with the lowest X, Y, and Z values.

Definition at line 1007 of file SbBox.h.

◆ getOrigin()

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

Gets box origin which is the same as the minimum corner of the box.

Definition at line 1131 of file SbBox.h.

◆ getSize() [1/2]

SbVec3d SbBox3d::getSize ( ) const
inline

Gets box size.

Definition at line 1154 of file SbBox.h.

◆ getSize() [2/2]

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

Gets box size.

Definition at line 1137 of file SbBox.h.

◆ getSpan()

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

Finds the span of a box along a specified direction.

The span is the total distance the box occupies along a given direction. The total distance is returned in the form of a minimum and maximum distance from the origin of each of the corners of the box along the given direction. The difference between these two values is the span.

◆ getVolume()

double SbBox3d::getVolume ( ) const

Returns the volume of the box.

◆ hasVolume()

SbBool SbBox3d::hasVolume ( ) const
inline

Returns TRUE if all three dimensions of the box have positive size, and FALSE otherwise.

Definition at line 1177 of file SbBox.h.

◆ intersect() [1/2]

SbBool SbBox3d::intersect ( const SbBox3d bb) const

Returns TRUE if the specified box intersects this box.

◆ intersect() [2/2]

SbBool SbBox3d::intersect ( const SbVec3d pt) const

Returns TRUE if the specified point intersects this box.

◆ intersection()

SbBox3d SbBox3d::intersection ( const SbBox3d box) const

Returns the intersection of the specified box with this box.

Returned box is empty if there is no intersection.

◆ isEmpty()

SbBool SbBox3d::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 1170 of file SbBox.h.

◆ makeEmpty()

void SbBox3d::makeEmpty ( )

Makes an empty box.

◆ outside()

SbBool SbBox3d::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.

"cullBits" keeps track of which view-volume clipping planes the box is completely inside of; if a 'parent' bounding box of this bounding box was found to be completely inside the left/right clipping planes, the low bit of cullBits will be set to zero, and this routine will not test this box against those planes. When cullBits is zero, it is a waste of time to call this function! Before calling this the first time, set cullBits to 7 (SoGLRenderAction and SoSeparator will handle this automatically for render culling).

◆ setBounds() [1/2]

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

Sets the corners of the box.

Definition at line 1105 of file SbBox.h.

◆ setBounds() [2/2]

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

Sets the corners of the box.

Definition at line 1098 of file SbBox.h.

◆ transform()

void SbBox3d::transform ( const SbMatrixd m)

Transforms box by matrix, enlarging box to contain result.

Friends And Related Symbol Documentation

◆ operator!=

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

Inequality comparison.

Definition at line 1207 of file SbBox.h.

◆ operator==

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

Equality comparison.


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