A rectangle in cartesian space.
More...
#include <Rectangle.hpp>
|
| | Rectangle () throw () |
| | Construct a new Rectangle of zero size and upper-left corner located at the origin. More...
|
| |
| | Rectangle (int x, int y, int width, int height) throw () |
| | Construct a new Rectangle with the given coordinates and size. More...
|
| |
| | ~Rectangle () throw () |
| | Destructor. More...
|
| |
| void | reshape (int x, int y, int width, int height) throw () |
| | Change the shape of the rectangle. More...
|
| |
| void | merge (const Rectangle &other) throw () |
| | Reshape this rectangle such that it contains both its original shape and the shape of another rectangle. More...
|
| |
| bool | intersects (const Rectangle &other) const throw () |
| | Test if this rectangle intersects another rectangle. More...
|
| |
| void | clip (const Rectangle &other) throw () |
| | If this rectangle intersects another, reshape it such that it consists only of the intersection of the two rectangles. More...
|
| |
| bool | contains (const Rectangle &other) const throw () |
| | Test if this rectangle completely contains another rectangle. More...
|
| |
| bool | isEmpty () const throw () |
| | Test if the rectangle is empty, i.e., has zero width and/or height. More...
|
| |
| int | getX () const throw () |
| | Get the X-coordinate of the rectangle's upper-left corner. More...
|
| |
| int | getY () const throw () |
| | Get the Y-coordinate of the rectangle's upper-left corner. More...
|
| |
| int | getWidth () const throw () |
| | Get the rectangle's width. More...
|
| |
| int | getHeight () const throw () |
| | Get the rectangle's height. More...
|
| |
A rectangle in cartesian space.
- Author
- Mark Lindner
◆ Rectangle() [1/2]
Construct a new Rectangle of zero size and upper-left corner located at the origin.
◆ Rectangle() [2/2]
| Rectangle |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
| throw | ( | |
| ) | | |
Construct a new Rectangle with the given coordinates and size.
- Parameters
-
| x | The X-coordinate of the rectangle's upper-left corner. |
| y | The Y-coordinate of the rectangle's upper-left corner. |
| width | The width of the rectangle. |
| height | The height of the rectangle. |
◆ ~Rectangle()
◆ clip()
| void clip |
( |
const Rectangle & |
other | ) |
|
| throw | ( | |
| ) | | |
If this rectangle intersects another, reshape it such that it consists only of the intersection of the two rectangles.
If the rectangles do not intersect, leaves the rectangle unmodified.
◆ contains()
| bool contains |
( |
const Rectangle & |
other | ) |
const |
| throw | ( | |
| ) | | |
Test if this rectangle completely contains another rectangle.
◆ getHeight()
| int getHeight |
( |
| ) |
const |
| throw | ( | |
| ) | | |
|
inline |
Get the rectangle's height.
◆ getWidth()
| int getWidth |
( |
| ) |
const |
| throw | ( | |
| ) | | |
|
inline |
Get the rectangle's width.
◆ getX()
| int getX |
( |
| ) |
const |
| throw | ( | |
| ) | | |
|
inline |
Get the X-coordinate of the rectangle's upper-left corner.
◆ getY()
| int getY |
( |
| ) |
const |
| throw | ( | |
| ) | | |
|
inline |
Get the Y-coordinate of the rectangle's upper-left corner.
◆ intersects()
| bool intersects |
( |
const Rectangle & |
other | ) |
const |
| throw | ( | |
| ) | | |
Test if this rectangle intersects another rectangle.
◆ isEmpty()
| bool isEmpty |
( |
| ) |
const |
| throw | ( | |
| ) | | |
|
inline |
Test if the rectangle is empty, i.e., has zero width and/or height.
◆ merge()
| void merge |
( |
const Rectangle & |
other | ) |
|
| throw | ( | |
| ) | | |
Reshape this rectangle such that it contains both its original shape and the shape of another rectangle.
◆ reshape()
| void reshape |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
| throw | ( | |
| ) | | |
Change the shape of the rectangle.
- Parameters
-
| x | The new X-coordinate of the rectangle's upper-left corner. |
| y | The new Y-coordinate of the rectangle's upper-left corner. |
| width | The new width of the rectangle. |
| height | The new height of the rectangle. |
The documentation for this class was generated from the following files: