Rect

class

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
See
Point

Public Functions

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

Construct a rectangle from position coordinates and size.

Rect::Rect(const Point &p, const Size &s)

Construct a rectangle from Point and Size objects.

Rect::Rect()

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

Point Rect::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 Rect::LowerRight()
const

Reutrn the position of the lower right corner.

Return
The point of the lower right corner

Point Rect::UpperRight()
const

Reutrn the position of the upper right corner.

Return
The point of the upper right corner

Point Rect::LowerLeft()
const

Reutrn the position of the lower left corner.

Return
The point of the lower left corner

class Point Rect::Center()
const

Return the position of the Rectangles center.

void Rect::setPoint(class Point p)

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

void Rect::setSize(class Size s)

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

bool Rect::contains(class Point &p)
const

Check whether or not a Point is inside this rectangle.

Rect Rect::crop(Rect const &other)
const

Return this Rect cropped by the baundaries of another rect

mono::String Rect::ToString()
const

Return a string representation of the ractangle.

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