#include <2DRect.h>
Inheritance diagram for C2DRect:
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 C2DPoint & | GetTopLeft (void) const |
const C2DPoint & | GetBottomRight (void) const |
double | GetTop (void) const |
double | GetLeft (void) const |
double | GetBottom (void) const |
double | GetRight (void) const |
const C2DRect & | operator= (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. |
C2DRect, a class for a rectangle with horizontal and vertical sides. C2DPoints represent the top left and bottom right.
---------------------------------------------------------------------------
|
Constructor.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Constructor.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Constructor.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Constructor.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Constructor sets both the top left and bottom right to equal the rect.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Clears the rectangle. IsSet set to false.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
True if the entire other rectangle is within.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
True if the point is within the rectangle.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the distance from this to the other rect. 0 if there is an overlap.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the distance from this to the point. 0 if the point inside.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Expands from the centre by the fixed amount given.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Expands to include the rectangle. If not set it will be set to equal the rectangle.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Expands to include the point. If not set it will be set to equal the point.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the area.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the centre.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the point which is closest to the origin (0,0).
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the point which is furthest from the origin (0,0).
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Grows it from the given point.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Grows it from its centre.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Grow the height it from its centre.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Grows the width from its centre.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Returns the height.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
If the area is positive e.g. the top is greater than the bottom.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Moves it by the vector.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Assignment.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
True if there is an overlap.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
True if there is an overlap, returns the overlap.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Projection onto the vector.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Projection onto the line.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Reflect throught the line by reflecting the centre of the rect and keeping the validity.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Reflect throught the point given. Switches Top Left and Bottom Right to maintain validity.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
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. |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Set.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Set functions. Setting causes the to be true.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
sets both the top left and bottom right to equal the rect.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |
|
Snaps this to the conceptual grid.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- Implements C2DBase. |
|
Returns the width.
-------------------------------------------------------------------------- --------------------------------------------------------------------------- |