Open Inventor Reference
SbBox3f Class Reference

3D box class. More...

#include <Inventor/SbBox.h>

Inheritance diagram for SbBox3f:
SbXfBox3f

Public Member Functions

 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 SbBox3f &b1, const SbBox3f &b2)
 Equality comparisons. More...
 
INVENTOR_API bool operator!= (const SbBox3f &b1, const SbBox3f &b2)
 

Detailed Description

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 Inventor datatype classes and is used as input and output to geometry operations (see SoGetBoundingBoxAction).

See Also
SbXfBox3f, SbBox2f, SbBox2s, SbVec3f, SbVec2f, SbVec2s, SbMatrix, SoGetBoundingBoxAction

Definition at line 81 of file SbBox.h.

Constructor & Destructor Documentation

◆ SbBox3f() [1/3]

SbBox3f::SbBox3f ( )
inline

Definition at line 85 of file SbBox.h.

◆ SbBox3f() [2/3]

SbBox3f::SbBox3f ( float  xmin,
float  ymin,
float  zmin,
float  xmax,
float  ymax,
float  zmax 
)
inline

Definition at line 88 of file SbBox.h.

◆ SbBox3f() [3/3]

SbBox3f::SbBox3f ( const SbVec3f min,
const SbVec3f max 
)
inline

Definition at line 94 of file SbBox.h.

◆ ~SbBox3f()

SbBox3f::~SbBox3f ( )
inline

Definition at line 98 of file SbBox.h.

Member Function Documentation

◆ extendBy() [1/2]

void SbBox3f::extendBy ( const SbBox3f bb)

◆ extendBy() [2/2]

void SbBox3f::extendBy ( const SbVec3f pt)

◆ getBounds() [1/2]

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

Definition at line 149 of file SbBox.h.

Referenced by SbXfBox3f::getBounds().

◆ getBounds() [2/2]

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

Definition at line 153 of file SbBox.h.

◆ getCenter()

SbVec3f SbBox3f::getCenter ( ) const

◆ getClosestPoint()

SbVec3f SbBox3f::getClosestPoint ( const SbVec3f point)

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

◆ getMax() [1/2]

SbVec3f& SbBox3f::getMax ( )
inline

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

Definition at line 111 of file SbBox.h.

◆ getMax() [2/2]

const SbVec3f& SbBox3f::getMax ( ) const
inline

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

Definition at line 105 of file SbBox.h.

◆ getMin() [1/2]

SbVec3f& SbBox3f::getMin ( )
inline

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

Definition at line 108 of file SbBox.h.

◆ getMin() [2/2]

const SbVec3f& SbBox3f::getMin ( ) const
inline

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

Definition at line 102 of file SbBox.h.

◆ getOrigin()

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

Definition at line 161 of file SbBox.h.

Referenced by SbXfBox3f::getOrigin().

◆ getSize()

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

Definition at line 167 of file SbBox.h.

Referenced by SbXfBox3f::getSize().

◆ getSpan()

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

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()

float SbBox3f::getVolume ( ) const

◆ hasVolume()

bool SbBox3f::hasVolume ( ) const
inline

Definition at line 180 of file SbBox.h.

Referenced by SbXfBox3f::hasVolume().

◆ intersect() [1/2]

bool SbBox3f::intersect ( const SbBox3f bb) const

◆ intersect() [2/2]

bool SbBox3f::intersect ( const SbVec3f pt) const

◆ isEmpty()

bool SbBox3f::isEmpty ( ) const
inline

Definition at line 176 of file SbBox.h.

Referenced by SbXfBox3f::isEmpty().

◆ makeEmpty()

void SbBox3f::makeEmpty ( )

Referenced by SbXfBox3f::makeEmpty().

◆ outside()

bool SbBox3f::outside ( const SbMatrix MVP,
int &  cullBits 
) const

"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 SbBox3f::setBounds ( const SbVec3f _min,
const SbVec3f _max 
)
inline

Definition at line 146 of file SbBox.h.

◆ setBounds() [2/2]

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

Definition at line 142 of file SbBox.h.

Referenced by SbXfBox3f::setBounds().

◆ transform()

void SbBox3f::transform ( const SbMatrix m)

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 207 of file SbBox.h.

◆ operator==

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

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