#include <rectangle.h>
Public Methods | |
TRectangle (double x=0, double y=0, double w=0, double h=0) | |
TRectangle (const TPoint &TopLeft, const TPoint &Size) | |
bool | Contains (double x, double y, bool proper=false) const |
bool | Contains (const TPoint &Point, bool proper=false) const |
double | GetBottom () const |
TPoint | GetCenter () const |
double | GetHeight () const |
int | GetIntersectionPoints (const TLine &line, TPoint *one, TPoint *two) const |
double | GetLeft () const |
double | GetRight () const |
TPoint | GetSize () const |
double | GetTop () const |
double | GetWidth () const |
double | GetX () const |
double | GetY () const |
bool | Intersects (const TRectangle &r) const |
bool | IsValid () const |
void | MoveBy (double dx, double dy) |
void | MoveByX (double dx) |
void | MoveByY (double dy) |
void | MoveTo (double x, double y) |
void | MoveToX (double x) |
void | MoveToY (double y) |
TRectangle | Normalize () const |
void | SetBottom (double b) |
void | SetHeight (double h) |
void | SetLeft (double l) |
void | SetRect (double x, double y, double w, double h) |
void | SetRight (double r) |
void | SetSize (double w, double h) |
void | SetSize (const TPoint &Size) |
void | SetTop (double t) |
void | SetWidth (double w) |
void | SetX (double x) |
void | SetY (double y) |
ostream & | Write (ostream &Stream) const |
Protected Attributes | |
double | x1 |
double | y1 |
double | x2 |
double | y2 |
|
Constructor for a rectangle with the top left corner at (x, y), the width w and the height h.
|
|
Constructs a rectangle with topLeft as the top left corner and size as the rectangle size.
|
|
Checks whether or not this Rectangle contains the point (x, y). If the rectangle is not valid (see IsValid) the result is always false.
|
|
Checks whether or not this rectangle contains the point (x, y). If the rectangle is not valid (see IsValid()) the result is always false.
|
|
|
|
|
|
|
|
FIXME Note: does only work for valid rectangles. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A valid rectangle has a left() <= right() and top() <= bottom().
|
|
Moves the rectangle dx along the X axis and dy along the Y axis, relative to the current position (Positive values moves the rectangle rightwards and/or downwards). The size of the rectangle does not change.
|
|
Moves the rectangle dx along the X axis, relative to the current position. The size of the rectangle does not change.
|
|
Moves the rectangle dy along the Y axis, relative to the current position. The size of the rectangle does not change.
|
|
Moves the rectangle (or more precise the top left corner) to the absolute position (x, y) without changing the size of the rectangle.
|
|
Moves the rectangle (or more precise the top left corner) to the absolute position x without changing the size of the rectangle.
|
|
Moves the rectangle (or more precise the top left corner) to the absolute position y without changing the size of the rectangle.
|
|
|
|
Sets the bottom edge of the rectangle. May change the height, but will never change the top edge of the rectangle.
|
|
Sets the height of the rectangle to h. The top edge is not moved, but the bottom edge may be moved. |
|
Sets the left edge of the rectangle. May change the width, but will never change the right edge of the rectangle. Identical to SetX().
|
|
Sets the coordinates of the rectangle's top left corner to (x,y), and its size to (w,h). |
|
Sets the right edge of the rectangle. May change the width, but will never change the left edge of the rectangle. |
|
Sets the size of the rectangle to (Size.GetX(), Size.GetY()). The top left corner is not moved.
|
|
Sets the size of the rectangle to (w, h). The top left corner is not moved.
|
|
Sets the top edge of the rectangle. May change the height, but will never change the bottom edge of the rectangle.
|
|
Sets the width of the rectangle to w. The right edge is changed, but not the left edge.
|
|
Sets the x position of the rectangle (its left end). May change the width, but will never change the right edge of the rectangle. Identical to SetLeft().
|
|
Sets the y position of the rectangle (its top). May change the height, but will never change the bottom edge of the rectangle. Identical to SetTop().
|
|
Writes the current rectangle to a stream, using the following output format: (x1, y1, x2, y2).
|