|
The blo Library
|
Rectangle. More...
#include <Rectangle.h>
Public Member Functions | |
| Rectangle ()=default | |
| Default constructor. | |
| Rectangle (const T &x1, const T &y1, const T &x2, const T &y2) | |
| Constructs rectangle from the coordinates of two points. | |
| Rectangle (const Point< T, 2 > &point1, const Point< T, 2 > &point2) | |
| Constructs rectangle from two points. | |
| Rectangle (const Rectangle< T > &rhs)=default | |
| Copy constructor. | |
| virtual | ~Rectangle ()=default |
| Destructor. | |
| Rectangle< T > & | operator= (const Rectangle< T > &rhs)=default |
| Assignment operator. | |
| bool | empty () const |
| Tests if the rectangle is empty. | |
| void | clear () |
| Resizes rectangle to zero width and zero height. | |
| void | coords (T &x1, T &y1, T &x2, T &y2) const |
| Retrieves coordinates of the two points that define the rectangle. | |
| void | points (Point< T, 2 > &point1, Point< T, 2 > &point2) const |
| Retrieves the two points that define the rectangle. | |
| void | setCoords (const T &x1, const T &y1, const T &x2, const T &y2) |
| Sets coordinates of the two points that define the rectangle. | |
| void | setPoints (const Point< T, 2 > &point1, const Point< T, 2 > &point2) |
| Sets the two points that define the rectangle. | |
| const T | x1 () const |
| Retrieves the x coordinate of the first point that defines the rectangle. | |
| const T | y1 () const |
| Retrieves the y coordinate of the first point that defines the rectangle. | |
| const T | x2 () const |
| Retrieves the x coordinate of the second point that defines the rectangle. | |
| const T | y2 () const |
| Retrieves the y coordinate of the second point that defines the rectangle. | |
| const Point< T, 2 > | point1 () const |
| Retrieves the first point that defines the rectangle. | |
| const Point< T, 2 > | point2 () const |
| Retrieves the second point that defines the rectangle. | |
| const T | width () const |
| Width of the rectangle. | |
| const T | height () const |
| Height of the rectangle. | |
Rectangle.
| T | Data type. |
A rectangle defined by the two points point1 = (x1, y1)^T and point2 = (x2, y2)^T. The point (x, y)^T is in the rectangle if x1 <= x < x2 and y1 <= y < y2.
|
default |
Default constructor.
| blo::Rectangle< T >::Rectangle | ( | const T & | x1, |
| const T & | y1, | ||
| const T & | x2, | ||
| const T & | y2 | ||
| ) |
Constructs rectangle from the coordinates of two points.
| x1,y1 | Coordinates of the first point. |
| x2,y2 | Coordinates of the second point. |
| blo::Rectangle< T >::Rectangle | ( | const Point< T, 2 > & | point1, |
| const Point< T, 2 > & | point2 | ||
| ) |
Constructs rectangle from two points.
| point1 | The first point. |
| point2 | The second point. |
|
default |
Copy constructor.
|
virtualdefault |
Destructor.
| void blo::Rectangle< T >::clear | ( | ) |
Resizes rectangle to zero width and zero height.
| void blo::Rectangle< T >::coords | ( | T & | x1, |
| T & | y1, | ||
| T & | x2, | ||
| T & | y2 | ||
| ) | const |
Retrieves coordinates of the two points that define the rectangle.
point1 = (x1, y1)^T and point2 = (x2, y2)^T, where x1 <= x2 and y1 <= y2.
| x1,y1 | Coordinates of the first point. |
| x2,y2 | Coordinates of the second point. |
| bool blo::Rectangle< T >::empty | ( | ) | const |
Tests if the rectangle is empty.
| const T blo::Rectangle< T >::height | ( | ) | const |
Height of the rectangle.
|
default |
Assignment operator.
| const Point< T, 2 > blo::Rectangle< T >::point1 | ( | ) | const |
Retrieves the first point that defines the rectangle.
point1 = (x1, y1)^T and point2 = (x2, y2)^T, where x1 <= x2 and y1 <= y2.
| const Point< T, 2 > blo::Rectangle< T >::point2 | ( | ) | const |
Retrieves the second point that defines the rectangle.
point1 = (x1, y1)^T and point2 = (x2, y2)^T, where x1 <= x2 and y1 <= y2.
| void blo::Rectangle< T >::points | ( | Point< T, 2 > & | point1, |
| Point< T, 2 > & | point2 | ||
| ) | const |
Retrieves the two points that define the rectangle.
point1 = (x1, y1)^T and point2 = (x2, y2)^T, where x1 <= x2 and y1 <= y2.
| point1 | The first point. |
| point2 | The second point. |
| void blo::Rectangle< T >::setCoords | ( | const T & | x1, |
| const T & | y1, | ||
| const T & | x2, | ||
| const T & | y2 | ||
| ) |
Sets coordinates of the two points that define the rectangle.
| x1,y1 | Coordinates of the first point. |
| x2,y2 | Coordinates of the second point. |
| void blo::Rectangle< T >::setPoints | ( | const Point< T, 2 > & | point1, |
| const Point< T, 2 > & | point2 | ||
| ) |
Sets the two points that define the rectangle.
| point1 | The first point. |
| point2 | The second point. |
| const T blo::Rectangle< T >::width | ( | ) | const |
Width of the rectangle.
| const T blo::Rectangle< T >::x1 | ( | ) | const |
Retrieves the x coordinate of the first point that defines the rectangle.
point1 = (x1, y1)^T and point2 = (x2, y2)^T, where x1 <= x2 and y1 <= y2.
| const T blo::Rectangle< T >::x2 | ( | ) | const |
Retrieves the x coordinate of the second point that defines the rectangle.
point1 = (x1, y1)^T and point2 = (x2, y2)^T, where x1 <= x2 and y1 <= y2.
| const T blo::Rectangle< T >::y1 | ( | ) | const |
Retrieves the y coordinate of the first point that defines the rectangle.
point1 = (x1, y1)^T and point2 = (x2, y2)^T, where x1 <= x2 and y1 <= y2.
| const T blo::Rectangle< T >::y2 | ( | ) | const |
Retrieves the y coordinate of the second point that defines the rectangle.
point1 = (x1, y1)^T and point2 = (x2, y2)^T, where x1 <= x2 and y1 <= y2.