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.
Public Functions
-
Rect::Rect(int x, int y, int width, int height)¶ Construct a rectangle from position coordinates and size.
-
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
Rectto aPoint- 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.
-