Represents a positioned rectangle.
Definition at line 460 of file ge211_geometry.hxx.
Classes | |
| class | iterator |
An iterator over the Posn<COORDINATE>s of a Rect<COORDINATE>. More... | |
Public Types | |
| using | Coordinate = COORDINATE |
| The coordinate type for the rectangle. More... | |
| using | Dims_type = Dims< Coordinate > |
| The dimensions type corresponding to this type. More... | |
| using | Posn_type = Posn< Coordinate > |
| The position type corresponding to this type. More... | |
Public Member Functions | |
| iterator | begin () const |
Returns an iterator to the top left corner of this rectangle. | |
| iterator | end () const |
Returns an iterator one past the end of this rectangle. | |
Construction and Conversion | |
| Rect (Coordinate x, Coordinate y, Coordinate width, Coordinate height) | |
| Constructs a rectangle given the x and y coordinates of its top left corner, and its width and height. | |
| Rect () | |
| Default-constructs the zero-sized Rect at the origin. | |
| template<typename FROM_COORD > | |
| Rect (const Rect< FROM_COORD > &that) | |
| Casts or converts a Rect to a Rect of a different coordinate type. More... | |
| template<typename TO_COORD > | |
| ge211::Rect< TO_COORD > | into () const |
| Explicitly converts a Rect to another coordinate type. More... | |
Operators | |
| bool | operator== (const Rect &that) const |
| Equality for rectangles. More... | |
| bool | operator!= (const Rect &that) const |
| Disequality for rectangles. | |
Dims and positions | |
| Dims_type | dimensions () const |
| The dimensions of the rectangle. More... | |
| Posn_type | top_left () const |
| The position of the top left vertex. | |
| Posn_type | top_right () const |
| The position of the top right vertex. | |
| Posn_type | bottom_left () const |
| The position of the bottom left vertex. | |
| Posn_type | bottom_right () const |
| The position of the bottom right vertex. | |
| Posn_type | center () const |
| The position of the center of the rectangle. | |
Static Public Member Functions | |
Static factory functions | |
| static Rect | from_top_left (Posn_type tl, Dims_type dims) |
| Creates a Rect given the position of its top left vertex and its dimensions. | |
| static Rect | from_top_right (Posn_type tr, Dims_type dims) |
| Creates a Rect given the position of its top right vertex and its dimensions. | |
| static Rect | from_bottom_left (Posn_type bl, Dims_type dims) |
| Creates a Rect given the position of its bottom left vertex and its dimensions. | |
| static Rect | from_bottom_right (Posn_type br, Dims_type dims) |
| Creates a Rect given the position of its bottom right vertex and its dimensions. | |
| static Rect | from_center (Posn_type center, Dims_type dims) |
| Creates a Rect given the position of its center and its dimensions. | |
Public Attributes | |
| Coordinate | x |
| The x coordinate of the upper-left vertex. | |
| Coordinate | y |
| The y coordinate of the upper-left vertex. | |
| Coordinate | width |
| The width of the rectangle in pixels. | |
| Coordinate | height |
| The height of the rectangle in pixels. | |
| using Coordinate = COORDINATE |
The coordinate type for the rectangle.
This is an alias of type parameter COORDINATE.
Definition at line 464 of file ge211_geometry.hxx.
| using Dims_type = Dims<Coordinate> |
The dimensions type corresponding to this type.
This is an alias of ge211::geometry::Dims.
Definition at line 468 of file ge211_geometry.hxx.
| using Posn_type = Posn<Coordinate> |
The position type corresponding to this type.
This is an alias of ge211::geometry::Posn.
Definition at line 472 of file ge211_geometry.hxx.
Casts or converts a Rect to a Rect of a different coordinate type.
For example:
Definition at line 504 of file ge211_geometry.hxx.
|
inline |
The dimensions of the rectangle.
Equivalent to Dims<Coordinate>{rect.width, rect.height}.
Definition at line 556 of file ge211_geometry.hxx.
|
inline |
Explicitly converts a Rect to another coordinate type.
For example:
Definition at line 521 of file ge211_geometry.hxx.
|
inline |
Equality for rectangles.
Note that this is naïve, in that it considers empty rectangles with different positions to be different.
Definition at line 533 of file ge211_geometry.hxx.