Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

C2DRect Class Reference

Class representing a rectangle. More...

#include <2DRect.h>

Inheritance diagram for C2DRect:

C2DBase List of all members.

Public Member Functions

 C2DRect (void)
 Constructor.
 ~C2DRect (void)
 Constructor.
 C2DRect (const C2DPoint &ptTopLeft, const C2DPoint &ptBottomRight)
 Constructor.
 C2DRect (double dLeft, double dTop, double dRight, double dBottom)
 Constructor.
 C2DRect (const C2DPoint &pt)
 Constructor sets both the top left and bottom right to equal the rect.
void Set (const C2DPoint &pt)
 sets both the top left and bottom right to equal the rect.
void Set (const C2DPoint &ptTopLeft, const C2DPoint &ptBottomRight)
 Set functions. Setting causes the to be true.
void Set (double dLeft, double dTop, double dRight, double dBottom)
 Set.
void SetTop (double dTop)
void SetLeft (double dLeft)
void SetBottom (double dBottom)
void SetRight (double dRight)
void Clear (void)
 Clears the rectangle. IsSet set to false.
void ExpandToInclude (const C2DPoint &NewPt)
 Expands to include the point. If not set it will be set to equal the point.
void ExpandToInclude (const C2DRect &Other)
 Expands to include the rectangle. If not set it will be set to equal the rectangle.
bool Overlaps (const C2DRect &Other, C2DRect &Overlap) const
 True if there is an overlap, returns the overlap.
bool Contains (const C2DPoint &Pt) const
 True if the point is within the rectangle.
bool Contains (const C2DRect &Other) const
 True if the entire other rectangle is within.
bool Overlaps (const C2DRect &Other) const
 True if there is an overlap.
bool IsValid (void) const
 If the area is positive e.g. the top is greater than the bottom.
double GetArea (void) const
 Returns the area.
double Width (void) const
 Returns the width.
double Height (void) const
 Returns the height.
const C2DPointGetTopLeft (void) const
const C2DPointGetBottomRight (void) const
double GetTop (void) const
double GetLeft (void) const
double GetBottom (void) const
double GetRight (void) const
const C2DRectoperator= (const C2DRect &Other)
 Assignment.
void Grow (double dFactor)
 Grows it from its centre.
void GrowHeight (double dFactor)
 Grow the height it from its centre.
void GrowWidth (double dFactor)
 Grows the width from its centre.
void Expand (double dRange)
 Expands from the centre by the fixed amount given.
void Grow (double dFactor, const C2DPoint &Origin)
 Grows it from the given point.
void Move (const C2DVector &Vector)
 Moves it by the vector.
void Reflect (const C2DPoint &Point)
 Reflect throught the point given. Switches Top Left and Bottom Right to maintain validity.
void Reflect (const C2DLine &Line)
 Reflect throught the line by reflecting the centre of the rect and keeping the validity.
void RotateToRight (double dAng, const C2DPoint &Origin)
 Rotates to the right. Note that as the horizontal/vertical line property will be preserved. If you rotate an object and its bounding box, the box may not still bound the object.
double Distance (const C2DPoint &TestPoint) const
 Returns the distance from this to the point. 0 if the point inside.
double Distance (const C2DRect &Other) const
 Returns the distance from this to the other rect. 0 if there is an overlap.
void GetBoundingRect (C2DRect &Rect) const
 Returns the bounding rectangle. (Required for virtual base class).
void Scale (const C2DPoint ptScale)
C2DPoint GetCentre (void) const
 Returns the centre.
C2DPoint GetPointClosestToOrigin (void) const
 Returns the point which is closest to the origin (0,0).
C2DPoint GetPointFurthestFromOrigin (void) const
 Returns the point which is furthest from the origin (0,0).
void Project (const C2DLine &Line, CInterval &Interval) const
 Projection onto the line.
void Project (const C2DVector &Vector, CInterval &Interval) const
 Projection onto the vector.
void SnapToGrid (void)
 Snaps this to the conceptual grid.

Detailed Description

Class representing a rectangle.

C2DRect, a class for a rectangle with horizontal and vertical sides. C2DPoints represent the top left and bottom right.

---------------------------------------------------------------------------


Constructor & Destructor Documentation

C2DRect::C2DRect void   ) 
 

Constructor.

--------------------------------------------------------------------------
C2DRect::C2DRect

---------------------------------------------------------------------------

C2DRect::~C2DRect void   ) 
 

Constructor.

--------------------------------------------------------------------------
C2DRect::~C2DRect

---------------------------------------------------------------------------

C2DRect::C2DRect const C2DPoint ptTopLeft,
const C2DPoint ptBottomRight
 

Constructor.

--------------------------------------------------------------------------
C2DRect::C2DRect

---------------------------------------------------------------------------

C2DRect::C2DRect double  dLeft,
double  dTop,
double  dRight,
double  dBottom
 

Constructor.

--------------------------------------------------------------------------
C2DRect::C2DRect

---------------------------------------------------------------------------

C2DRect::C2DRect const C2DPoint pt  ) 
 

Constructor sets both the top left and bottom right to equal the rect.

--------------------------------------------------------------------------
C2DRect::C2DRect

---------------------------------------------------------------------------


Member Function Documentation

void C2DRect::Clear void   ) 
 

Clears the rectangle. IsSet set to false.

--------------------------------------------------------------------------
C2DRect::Clear

---------------------------------------------------------------------------

bool C2DRect::Contains const C2DRect Other  )  const
 

True if the entire other rectangle is within.

--------------------------------------------------------------------------
C2DRect::Contains

---------------------------------------------------------------------------

bool C2DRect::Contains const C2DPoint Pt  )  const
 

True if the point is within the rectangle.

--------------------------------------------------------------------------
C2DRect::Contains

---------------------------------------------------------------------------

double C2DRect::Distance const C2DRect Other  )  const
 

Returns the distance from this to the other rect. 0 if there is an overlap.

--------------------------------------------------------------------------
C2DRect::Distance

---------------------------------------------------------------------------

double C2DRect::Distance const C2DPoint TestPoint  )  const [virtual]
 

Returns the distance from this to the point. 0 if the point inside.

--------------------------------------------------------------------------
C2DRect::Distance

---------------------------------------------------------------------------

Implements C2DBase.

void C2DRect::Expand double  dRange  ) 
 

Expands from the centre by the fixed amount given.

--------------------------------------------------------------------------
C2DRect::Expand

---------------------------------------------------------------------------

void C2DRect::ExpandToInclude const C2DRect Other  ) 
 

Expands to include the rectangle. If not set it will be set to equal the rectangle.

--------------------------------------------------------------------------
C2DRect::ExpandToInclude

---------------------------------------------------------------------------

void C2DRect::ExpandToInclude const C2DPoint NewPt  ) 
 

Expands to include the point. If not set it will be set to equal the point.

--------------------------------------------------------------------------
C2DRect::Clear

---------------------------------------------------------------------------

double C2DRect::GetArea void   )  const
 

Returns the area.

--------------------------------------------------------------------------
C2DRect::GetArea

---------------------------------------------------------------------------

double C2DRect::GetBottom void   )  const [inline]
 

--------------------------------------------------------------------------
C2DRect::GetBottom
Returns the bottom.

---------------------------------------------------------------------------

const C2DPoint& C2DRect::GetBottomRight void   )  const [inline]
 

--------------------------------------------------------------------------
C2DRect::GetBottomRight
Returns the bottom right.

---------------------------------------------------------------------------

C2DPoint C2DRect::GetCentre void   )  const
 

Returns the centre.

--------------------------------------------------------------------------
C2DRect::Clear

---------------------------------------------------------------------------

double C2DRect::GetLeft void   )  const [inline]
 

--------------------------------------------------------------------------
C2DRect::GetLeft
Returns the left side.

---------------------------------------------------------------------------

C2DPoint C2DRect::GetPointClosestToOrigin void   )  const
 

Returns the point which is closest to the origin (0,0).

--------------------------------------------------------------------------
C2DRect::GetPointClosestToOrigin

---------------------------------------------------------------------------

C2DPoint C2DRect::GetPointFurthestFromOrigin void   )  const
 

Returns the point which is furthest from the origin (0,0).

--------------------------------------------------------------------------
C2DRect::GetPointFurthestFromOrigin

---------------------------------------------------------------------------

double C2DRect::GetRight void   )  const [inline]
 

--------------------------------------------------------------------------
C2DRect::GetRight
Returns the right side.

---------------------------------------------------------------------------

double C2DRect::GetTop void   )  const [inline]
 

--------------------------------------------------------------------------
C2DRect::GetTop
Returns the top.

---------------------------------------------------------------------------

const C2DPoint& C2DRect::GetTopLeft void   )  const [inline]
 

--------------------------------------------------------------------------
C2DRect::GetTopLeft
Returns the top left.

---------------------------------------------------------------------------

void C2DRect::Grow double  dFactor,
const C2DPoint Origin
[virtual]
 

Grows it from the given point.

--------------------------------------------------------------------------
C2DRect::Grow

---------------------------------------------------------------------------

Implements C2DBase.

void C2DRect::Grow double  dFactor  ) 
 

Grows it from its centre.

--------------------------------------------------------------------------
C2DRect::Clear

---------------------------------------------------------------------------

void C2DRect::GrowHeight double  dFactor  ) 
 

Grow the height it from its centre.

--------------------------------------------------------------------------
C2DRect::GrowHeight

---------------------------------------------------------------------------

void C2DRect::GrowWidth double  dFactor  ) 
 

Grows the width from its centre.

--------------------------------------------------------------------------
C2DRect::GrowWidth

---------------------------------------------------------------------------

double C2DRect::Height void   )  const
 

Returns the height.

--------------------------------------------------------------------------
C2DRect::Height

---------------------------------------------------------------------------

bool C2DRect::IsValid void   )  const
 

If the area is positive e.g. the top is greater than the bottom.

--------------------------------------------------------------------------
C2DRect::IsValid

---------------------------------------------------------------------------

void C2DRect::Move const C2DVector Vector  )  [virtual]
 

Moves it by the vector.

--------------------------------------------------------------------------
C2DRect::Clear

---------------------------------------------------------------------------

Implements C2DBase.

const C2DRect & C2DRect::operator= const C2DRect Other  ) 
 

Assignment.

--------------------------------------------------------------------------
C2DRect::operator =

---------------------------------------------------------------------------

bool C2DRect::Overlaps const C2DRect Other  )  const
 

True if there is an overlap.

--------------------------------------------------------------------------
C2DRect::Overlaps

---------------------------------------------------------------------------

bool C2DRect::Overlaps const C2DRect Other,
C2DRect Overlap
const
 

True if there is an overlap, returns the overlap.

--------------------------------------------------------------------------
C2DRect::Overlaps

---------------------------------------------------------------------------

void C2DRect::Project const C2DVector Vector,
CInterval Interval
const [virtual]
 

Projection onto the vector.

--------------------------------------------------------------------------
C2DRect::Distance

---------------------------------------------------------------------------

Implements C2DBase.

void C2DRect::Project const C2DLine Line,
CInterval Interval
const [virtual]
 

Projection onto the line.

--------------------------------------------------------------------------
C2DRect::Distance

---------------------------------------------------------------------------

Implements C2DBase.

void C2DRect::Reflect const C2DLine Line  )  [virtual]
 

Reflect throught the line by reflecting the centre of the rect and keeping the validity.

--------------------------------------------------------------------------
C2DRect::Reflect

---------------------------------------------------------------------------

Implements C2DBase.

void C2DRect::Reflect const C2DPoint Point  )  [virtual]
 

Reflect throught the point given. Switches Top Left and Bottom Right to maintain validity.

--------------------------------------------------------------------------
C2DRect::Reflect

---------------------------------------------------------------------------

Implements C2DBase.

void C2DRect::RotateToRight double  dAng,
const C2DPoint Origin
[virtual]
 

Rotates to the right. Note that as the horizontal/vertical line property will be preserved. If you rotate an object and its bounding box, the box may not still bound the object.

Rotates to the right. Note that as the horizontal/vertical line property will be preserved. If you rotate an object and its bounding box, the box may not still bound the object.

Implements C2DBase.

void C2DRect::Scale const C2DPoint  ptScale  )  [inline]
 

--------------------------------------------------------------------------
C2DRect::Scale
Scales the rectangle accordingly.

---------------------------------------------------------------------------

void C2DRect::Set double  dLeft,
double  dTop,
double  dRight,
double  dBottom
 

Set.

--------------------------------------------------------------------------
C2DRect::Set

---------------------------------------------------------------------------

void C2DRect::Set const C2DPoint ptTopLeft,
const C2DPoint ptBottomRight
 

Set functions. Setting causes the to be true.

--------------------------------------------------------------------------
C2DRect::Set

---------------------------------------------------------------------------

void C2DRect::Set const C2DPoint pt  ) 
 

sets both the top left and bottom right to equal the rect.

--------------------------------------------------------------------------
C2DRect::Set

---------------------------------------------------------------------------

void C2DRect::SetBottom double  dBottom  )  [inline]
 

--------------------------------------------------------------------------
C2DRect::SetBottom
Sets the bottom.

---------------------------------------------------------------------------

void C2DRect::SetLeft double  dLeft  )  [inline]
 

--------------------------------------------------------------------------
C2DRect::SetLeft
Sets the left side.

---------------------------------------------------------------------------

void C2DRect::SetRight double  dRight  )  [inline]
 

--------------------------------------------------------------------------
C2DRect::SetRight
Sets the right side.

---------------------------------------------------------------------------

void C2DRect::SetTop double  dTop  )  [inline]
 

--------------------------------------------------------------------------
C2DRect::SetTop
Sets the top.

---------------------------------------------------------------------------

void C2DRect::SnapToGrid void   )  [virtual]
 

Snaps this to the conceptual grid.

--------------------------------------------------------------------------
C2DRect::SnapToGrid

---------------------------------------------------------------------------

Implements C2DBase.

double C2DRect::Width void   )  const
 

Returns the width.

--------------------------------------------------------------------------
C2DRect::Width

---------------------------------------------------------------------------


The documentation for this class was generated from the following files:
Generated on Mon Apr 21 11:43:52 2008 for GeoLib by  doxygen 1.4.4