TBBox2D Class Reference
[Data Structures]

Inheritance diagram for TBBox2D:
TMCObject

List of all members.

Public Member Functions

 TBBox2D ()
 TBBox2D (const TVector2 &min, const TVector2 &max)
 TBBox2D (const TVector2 &max)
void SetMax (const TVector2 &max)
 Setter function for fMax.
void SetMin (const TVector2 &min)
 Setter function for fMin.
void GetCenter (TVector2 &center) const
void GetDelta (TVector2 &delta) const
real GetMax () const
real GetMin () const
boolean IsEmpty () const
void AddPoint (const TVector2 &PP)
void Inset (const TVector2 &PP)
TVector2 operator[] (int16 ii) const
void FixInvertedFields ()
boolean IsInside (const TVector2 &point) const
boolean Valid () const
 Returns true if every coordinate of fMin is smaller than its fMax counterpart.
void ClipBy (const TBBox2D &clipBounds)
void Union (const TBBox2D &box)
 Union.
boolean Intersect (const TBBox2D &boundingBox) const
real GetWidth (void) const
 Returns the width (in x) of the box.
real GetHeight (void) const
 Returns the height (in y) of the box.
boolean operator== (const TBBox2D &rhs)
 Returns true if the two boxes are equal.

Public Attributes

TVector2 fMin
 The lower corner of the box.
TVector2 fMax
 The upper corner of the box.

Detailed Description

TBBox2D defines a two dimentional bounding box. It uses two TVector2 to store the lower (fMin) and the upper (fMax) corners of the rectangle


Constructor & Destructor Documentation

TBBox2D::TBBox2D (  ) 

Default constructor: fMin is initialized with kRealMax, fMax with kRealMin

TBBox2D::TBBox2D ( const TVector2 min,
const TVector2 max 
)

Init constructor

Parameters:
min initial value for fMin.
max initial value for fMax.
TBBox2D::TBBox2D ( const TVector2 max  ) 

Init constructor

Parameters:
max initial value for fMax. fMin is initialized with -max

Member Function Documentation

void TBBox2D::AddPoint ( const TVector2 PP  ) 

Expands the box to encompass the given point

Parameters:
PP the point to add to the box
void TBBox2D::ClipBy ( const TBBox2D clipBounds  ) 

Clips the box by another box

Parameters:
clipBounds the bounds that this box should not cross
void TBBox2D::FixInvertedFields (  ) 

if (fMin .x > fMax .x) {fMin .x = fMax .x = kRealZero;} and same for y

void TBBox2D::GetCenter ( TVector2 center  )  const

Computes the center of the box

Parameters:
center the return value for the center of the box
void TBBox2D::GetDelta ( TVector2 delta  )  const

Computes the main diagonal of the box (fMax - fMin)

Parameters:
delta the return value
real TBBox2D::GetHeight ( void   )  const [inline]

Returns the height (in y) of the box.

real TBBox2D::GetMax (  )  const

Returns the bigger coordinate of the diagonal

real TBBox2D::GetMin (  )  const

Returns the smaller coordinate of the diagonal

real TBBox2D::GetWidth ( void   )  const [inline]

Returns the width (in x) of the box.

void TBBox2D::Inset ( const TVector2 PP  ) 

Shrinks the box by adding PP to fMin, and substracting it from fMax

Parameters:
PP the amount to shrink the box with
boolean TBBox2D::Intersect ( const TBBox2D boundingBox  )  const

Returns true if the two boxes intersect

Parameters:
boundingBox the box to test for intersection with this box
boolean TBBox2D::IsEmpty (  )  const

Returns true if the box is empty

boolean TBBox2D::IsInside ( const TVector2 point  )  const

Returns true if the point is inside the box.

Parameters:
point the point to intersect with the box
boolean TBBox2D::operator== ( const TBBox2D rhs  )  [inline]

Returns true if the two boxes are equal.

TVector2 TBBox2D::operator[] ( int16  ii  )  const

Returns one of the corners of the box

Parameters:
ii the corner index (0 => fMin, 1 => TVector2(fMax[0], fMin[1]), 2 => TVector2(fMin[0], fMax[1]), 3 => fMax, 4 => (fMax + fMin)/2. For any other value, returns 0
void TBBox2D::SetMax ( const TVector2 max  )  [inline]

Setter function for fMax.

void TBBox2D::SetMin ( const TVector2 min  )  [inline]

Setter function for fMin.

void TBBox2D::Union ( const TBBox2D box  ) 

Union.

boolean TBBox2D::Valid (  )  const [inline]

Returns true if every coordinate of fMin is smaller than its fMax counterpart.


Member Data Documentation

The upper corner of the box.

The lower corner of the box.


The documentation for this class was generated from the following file:
Generated on Mon Apr 26 22:47:59 2010 for Carrara SDK Doc by  doxygen 1.6.3