3D box class. More...
#include <Inventor/SbBox.h>
Public Member Functions | |
SbBox3f () | |
SbBox3f (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) | |
SbBox3f (const SbVec3f &_min, const SbVec3f &_max) | |
~SbBox3f () | |
const SbVec3f & | getMin () const |
SbVec3f & | getMin () |
const SbVec3f & | getMax () const |
SbVec3f & | getMax () |
SbVec3f | getCenter () const |
void | extendBy (const SbVec3f &pt) |
void | extendBy (const SbBox3f &bb) |
SbBool | intersect (const SbVec3f &pt) const |
SbBool | intersect (const SbBox3f &bb) const |
SbBox3f | intersection (const SbBox3f &box) const |
SbBool | contains (const SbBox3f &bb) const |
SbBool | outside (const SbMatrix &MVP, int &cullBits) const |
void | setBounds (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) |
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) const |
void | getOrigin (float &originX, float &originY, float &originZ) const |
void | getSize (float &sizeX, float &sizeY, float &sizeZ) const |
SbVec3f | getSize () const |
void | makeEmpty () |
SbBool | isEmpty () const |
SbBool | hasVolume () const |
void | getSpan (const SbVec3f &direction, float &dMin, float &dMax) const |
void | transform (const SbMatrix &m) |
float | getVolume () const |
template<typename T > | |
SbBox3f (const T &b) | |
float | computeMaxDistance2 (const SbVec3f &p) const |
SbBool | triangleBoxOverlap (const SbVec3f &u0, const SbVec3f &u1, const SbVec3f &u2) const |
Friends | |
int | operator== (const SbBox3f &b1, const SbBox3f &b2) |
int | operator!= (const SbBox3f &b1, const SbBox3f &b2) |
std::ostream & | operator<< (std::ostream &os, const SbBox3f &b) |
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).
SbXfBox3f, SbBox2f, SbBox2s, SbVec3f, SbVec2f, SbVec2s, SbMatrix, SoGetBoundingBoxAction
SbBox3f::SbBox3f | ( | ) | [inline] |
Constructor for a 3D float box.
The box is initially empty.
SbBox3f::SbBox3f | ( | float | xmin, | |
float | ymin, | |||
float | zmin, | |||
float | xmax, | |||
float | ymax, | |||
float | zmax | |||
) | [inline] |
Constructor for a 3D float box.
xmin , ymin , zmin , xmax , ymax and zmax are the bounds of the box.
Constructor for a 3D float box.
m_min and m_max are the corners of the diagonal that define the box.
SbBox3f::~SbBox3f | ( | ) | [inline] |
Destructor.
SbBox3f::SbBox3f | ( | const T & | b | ) | [inline, explicit] |
Constructor that converts an arbitrary SbBox3 to an SbBox3f.
float SbBox3f::computeMaxDistance2 | ( | const SbVec3f & | p | ) | const |
Returns the squared maximum distance between a point and the 8 bounding box's vertices.
Returns TRUE if the specified box is fully contained inside this box.
void SbBox3f::extendBy | ( | const SbBox3f & | bb | ) |
Extends this box (if necessary) to contain the specified box.
Reimplemented in SbXfBox3f.
void SbBox3f::extendBy | ( | const SbVec3f & | pt | ) | [inline] |
Extends this box (if necessary) to contain the specified point.
Reimplemented in SbXfBox3f.
Gets the corners of the box.
Reimplemented in SbXfBox3f.
void SbBox3f::getBounds | ( | float & | xmin, | |
float & | ymin, | |||
float & | zmin, | |||
float & | xmax, | |||
float & | ymax, | |||
float & | zmax | |||
) | const [inline] |
Gets the corners of the box.
Reimplemented in SbXfBox3f.
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.)
SbVec3f& SbBox3f::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.
const SbVec3f& SbBox3f::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.
SbVec3f& SbBox3f::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.
const SbVec3f& SbBox3f::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.
void SbBox3f::getOrigin | ( | float & | originX, | |
float & | originY, | |||
float & | originZ | |||
) | const [inline] |
Gets box origin which is the same as the minimum corner of the box.
SbVec3f SbBox3f::getSize | ( | void | ) | const [inline] |
Gets box size.
void SbBox3f::getSize | ( | float & | sizeX, | |
float & | sizeY, | |||
float & | sizeZ | |||
) | const [inline] |
Gets box size.
void SbBox3f::getSpan | ( | const SbVec3f & | direction, | |
float & | dMin, | |||
float & | 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.
Reimplemented in SbXfBox3f.
float SbBox3f::getVolume | ( | ) | const |
Returns the volume of the box.
Reimplemented in SbXfBox3f.
SbBool SbBox3f::hasVolume | ( | ) | const [inline] |
Returns TRUE if all three dimensions of the box have positive size, and FALSE otherwise.
Reimplemented in SbXfBox3f.
Returns TRUE if the specified box intersects this box.
Returns TRUE if the specified point intersects this box.
Reimplemented in SbXfBox3f.
Returns the intersection of the specified box with this box.
Returned box is empty if there is no intersection.
SbBool SbBox3f::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.)
Reimplemented in SbXfBox3f.
void SbBox3f::makeEmpty | ( | ) | [inline] |
Makes an empty box.
Reimplemented in SbXfBox3f.
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).
Sets the corners of the box.
Reimplemented in SbXfBox3f.
void SbBox3f::setBounds | ( | float | xmin, | |
float | ymin, | |||
float | zmin, | |||
float | xmax, | |||
float | ymax, | |||
float | zmax | |||
) | [inline] |
Sets the corners of the box.
Reimplemented in SbXfBox3f.
void SbBox3f::transform | ( | const SbMatrix & | m | ) |
Transforms box by matrix, enlarging box to contain result.
Reimplemented in SbXfBox3f.
SbBool SbBox3f::triangleBoxOverlap | ( | const SbVec3f & | u0, | |
const SbVec3f & | u1, | |||
const SbVec3f & | u2 | |||
) | const |
Return true if the given triangle intersects the bounding box.
Note that intersection considers the whole box, not just the border. Therefore a triangle completely inside the box will return true.
Inequality comparison.
Reimplemented in SbXfBox3f.
std::ostream& operator<< | ( | std::ostream & | os, | |
const SbBox3f & | b | |||
) | [friend] |
Writes the box to the specified output stream.
Equality comparison.
Reimplemented in SbXfBox3f.