Rect

class mono::geo::Rect

A Rectangle in a Cartesian coordinate system, having a size and position.

This class defines a geometric rectangle. It exists in a std. cartesian coordinate system. It is defined by its upper left corner (X,Y), and a width and height.

The rectangle cannot be rotated, its sides a parallel to the coordinate system axis.

It defines helper methods to calculate different positions and properties. You can also extract interpolation information.

See

Size

Point

Inherits from mono::geo::Point, mono::geo::Size

Public Functions

Rect(int x, int y, int width, int height)

Construct a rectangle from position coordinates and size.

Rect(Point &p, Size &s)

Construct a rectangle from Point and Size objects.

Rect()

COnstruct an empty rectangle having position (0,0) and size (0,0)

Point UpperLeft() const

Reutrn the position of the upper left corner.

This method is the same as casting the Rect to a Point

Return
The point of the upper left corner

Point LowerRight() const

Reutrn the position of the lower right corner.

Return
The point of the lower right corner

Point UpperRight() const

Reutrn the position of the upper right corner.

Return
The point of the upper right corner

Point LowerLeft() const

Reutrn the position of the lower left corner.

Return
The point of the lower left corner

class Point Center() const

Return the position of the Rectangles center.

void setPoint(class Point p)

Move (translate) the rectangle by its upper left corner.

void setSize(class Size s)

Set a new size (width/height) of the rectangle.

bool contains(class Point &p) const

Check whether or not a Point is inside this rectangle.

Rect crop(Rect const &other) const

Return this Rect cropped by the baundaries of another rect

mono::String ToString() const

Return a string representation of the ractangle.

Return
A string of the form Rect( x, y, w, h )