Public Member Functions

MBoundingBox Class Reference

Search for all occurrences

Detailed Description

Implementation of a 3D bounding box.

This class provides an implementation of a bounding box. A bounding box describes a volume in space that bounds a piece of geometry. The box is defined by two points which describe the minimum and maximum corners of the box.

Examples:

apiMeshShape.cpp, apiMeshShape.h, apiMeshShapeUI.cpp, curvedArrowsNode.cpp, D3DViewportRenderer.cpp, D3DViewportRenderer.h, footPrintManip.cpp, footPrintNode.cpp, hwPhongShader.cpp, OpenGLViewportRenderer.cpp, OpenGLViewportRenderer.h, quadricShape.cpp, simpleFluidEmitter.cpp, and swissArmyManip.cpp.

#include <MBoundingBox.h>

List of all members.

Public Member Functions

  MBoundingBox ()
  Default constructor.
  MBoundingBox (const MBoundingBox &src)
  Copy constructor.
  MBoundingBox (const MPoint &corner1, const MPoint &corner2)
  Constructor that creates a bounding box which contains the given points.
  ~MBoundingBox ()
  Class destructor.
void  clear ()
  Empties the current bounding box.
void  transformUsing (const MMatrix &matrix)
  Apply the given transformation to this bounding box.
void  expand (const MPoint &point)
  Expand the bounding box to include the given point.
void  expand (const MBoundingBox &box)
  Expand the bounding box to include a second bounding box.
bool  contains (const MPoint &point) const
  Returns true if the bounding box contains the given point.
bool  intersects (const MBoundingBox &box, double tol=0.0) const
  Returns true if the bounding box intersects another given bounding box.
double  width () const
  Returns the width of the bounding box.
double  height () const
  Returns the height of the bounding box.
double  depth () const
  Returns the depth of the bounding box.
MPoint  center () const
  Returns the center of the bounding box.
MPoint  min () const
  Returns the minimum point for the bounding box.
MPoint  max () const
  Returns the maximum point for the bounding box.
MBoundingBox operator= (const MBoundingBox &other)
  Assignment operator.

Constructor & Destructor Documentation

Default constructor.

Creates an empty bounding box.

MBoundingBox ( const MBoundingBox src )

Copy constructor.

Parameters:
[in] src bounding box to copy
MBoundingBox ( const MPoint corner1,
const MPoint corner2 
)

Constructor that creates a bounding box which contains the given points.

Each point will represent one corner of the box.

Parameters:
[in] corner1 first corner point
[in] corner2 second corner point

Member Function Documentation

void transformUsing ( const MMatrix matrix )

Apply the given transformation to this bounding box.

Parameters:
[in] matrix transformation matrix
Examples:
simpleFluidEmitter.cpp.
void expand ( const MPoint point )

Expand the bounding box to include the given point.

Parameters:
[in] point new point to include in the bounding box.
Examples:
curvedArrowsNode.cpp, and quadricShape.cpp.
void expand ( const MBoundingBox box )

Expand the bounding box to include a second bounding box.

Parameters:
[in] box bounding box to include in this bounding box.
bool contains ( const MPoint point ) const

Returns true if the bounding box contains the given point.

Parameters:
[in] point point to check for inclusion in this bounding box
Returns:
true if the point is contained in this bounding box
bool intersects ( const MBoundingBox box,
double  tol = 0.0 
) const

Returns true if the bounding box intersects another given bounding box.

Parameters:
[in] box bounding box to check for intersection
[in] tol tolerance of the intersection check
Returns:
true if the bounding boxes intersect
double width ( ) const

Returns the width of the bounding box.

Returns:
The width of the bounding box
Examples:
apiMeshShapeUI.cpp.
double height ( ) const

Returns the height of the bounding box.

Returns:
The height of the bounding box
Examples:
apiMeshShapeUI.cpp.
double depth ( ) const

Returns the depth of the bounding box.

Returns:
The depth of the bounding box
Examples:
apiMeshShapeUI.cpp.
MPoint center ( ) const

Returns the center of the bounding box.

Returns:
The center of the bounding box
MPoint min ( ) const

Returns the minimum point for the bounding box.

That is the point whose x, y, and z components represent the bounding box's minimum value in each dimension.

Returns:
The minimum point of the bounding box
Examples:
apiMeshShapeUI.cpp, D3DViewportRenderer.cpp, hwPhongShader.cpp, OpenGLViewportRenderer.cpp, and simpleFluidEmitter.cpp.
MPoint max ( ) const

Returns the maximum point for the bounding box.

That is the point whose x, y, and z components represent the bounding box's maximum value in each dimension.

Returns:
The maximum point of the bounding box
Examples:
D3DViewportRenderer.cpp, hwPhongShader.cpp, OpenGLViewportRenderer.cpp, and simpleFluidEmitter.cpp.
MBoundingBox & operator= ( const MBoundingBox other )

Assignment operator.

Parameters:
[in] other bounding box to take value from
Returns:
Reference to this bounding box

MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox
MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox MBoundingBox