qCC_db  version 2.5.4 (Qt) - 19 Apr 2014
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Attributes | List of all members
ccBBox Class Reference

Bounding box structure. More...

#include <ccBBox.h>

Public Member Functions

 ccBBox ()
 Default constructor.
 
 ccBBox (const ccBBox &aBBox)
 Copy constructor.
 
 ccBBox (const CCVector3 &bbMinCorner, const CCVector3 &bbMaxCorner)
 Constructor from two vectors (lower min. and upper max. corners)
 
ccBBox operator+ (const ccBBox &aBBox) const
 Returns the 'sum' of this bounding-box and another one.
 
const ccBBoxoperator+= (const ccBBox &aBBox)
 In place 'sum' of this bounding-box with another one.
 
const ccBBoxoperator+= (const CCVector3 &aVector)
 Shifts the bounding box with a vector.
 
const ccBBoxoperator-= (const CCVector3 &aVector)
 Shifts the bounding box with a vector.
 
const ccBBoxoperator*= (const PointCoordinateType &scaleFactor)
 Scales the bounding box.
 
const ccBBoxoperator*= (const CCLib::SquareMatrix &aMatrix)
 Rotates the bounding box.
 
const ccBBoxoperator*= (const ccGLMatrix &mat)
 Applies transformation to the bounding box.
 
void clear ()
 Resets the bounding box. More...
 
void add (const CCVector3 &aVector)
 'Enlarges' the bounding box with a vector More...
 
const CCVector3 & minCorner () const
 Returns min corner (const)
 
const CCVector3 & maxCorner () const
 Returns max corner (const)
 
CCVector3 & minCorner ()
 Returns min corner.
 
CCVector3 & maxCorner ()
 Returns max corner.
 
CCVector3 getCenter () const
 Returns center.
 
CCVector3 getDiagVec () const
 Returns diagonal vector.
 
PointCoordinateType getDiagNorm () const
 Returns diagonal length.
 
PointCoordinateType getMinBoxDim () const
 Returns minimal box dimension.
 
PointCoordinateType getMaxBoxDim () const
 Returns maximal box dimension.
 
void draw (const colorType col[]) const
 Draws bounding box (OpenGL) More...
 
void setValidity (bool state)
 Sets bonding box validity.
 
bool isValid () const
 Returns whether bounding box is valid or not.
 
PointCoordinateType minDistTo (const ccBBox &box) const
 Computes min gap (absolute distance) between this bounding-box and another one. More...
 
bool contains (const CCVector3 &P) const
 Returns whether a points is inside the box or not. More...
 

Protected Attributes

CCVector3 m_bbMin
 Lower min. corner.
 
CCVector3 m_bbMax
 Upper max. corner.
 
bool m_valid
 Validity.
 

Detailed Description

Bounding box structure.

Supports several operators such addition (to a matrix or a vector) and multiplication (by a matrix or a scalar).

Member Function Documentation

void ccBBox::add ( const CCVector3 &  aVector)

'Enlarges' the bounding box with a vector

equivalent to operator +=(CCVector3)

void ccBBox::clear ( )

Resets the bounding box.

(0,0,0) –> (0,0,0)

bool ccBBox::contains ( const CCVector3 &  P) const
inline

Returns whether a points is inside the box or not.

Warning: box should be valid!

void ccBBox::draw ( const colorType  col[]) const

Draws bounding box (OpenGL)

Parameters
col(R,G,B) color
PointCoordinateType ccBBox::minDistTo ( const ccBBox box) const

Computes min gap (absolute distance) between this bounding-box and another one.

Returns
min gap (>=0) or -1 if at least one of the box is not valid

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