A position in the COORDINATE-valued Cartesian plane, where COORDINATE can be any arithmetic type.
In graphics, the origin is traditionally in the upper left, so the x coordinate increases to the right and the y coordinate increases downward.
Definition at line 265 of file ge211_geometry.hxx.
Public Types | |
| using | Coordinate = COORDINATE |
| The coordinate type for the position. More... | |
| using | Dims_type = Dims< COORDINATE > |
| The dimensions type corresponding to this type. More... | |
Public Member Functions | |
Constructors and Conversions | |
| Posn (Coordinate x, Coordinate y) | |
| Constructs a position from the given x and y coordinates. | |
| Posn (origin_type) | |
| Constructs the origin when given the_origin. | |
| Posn (Dims_type dims) | |
| Constructs a position from a Dims, which gives the displacement of the position from the origin. | |
| template<typename FROM_COORD > | |
| Posn (const Posn< FROM_COORD > &that) | |
| Casts or converts a Posn to a Posn of a different coordinate type. More... | |
| template<typename TO_COORD > | |
| ge211::Posn< TO_COORD > | into () const |
| Explicitly converts a Posn to another coordinate type. More... | |
Operators | |
| bool | operator== (Posn that) const |
| Equality for positions. | |
| bool | operator!= (Posn p2) const |
| Disequality for positions. | |
| Posn | operator+ (Dims_type dims) const |
| Translates a position by some displacement. More... | |
| Posn | operator- (Dims_type dims) const |
| Translates a position by the opposite of some displacement. More... | |
| Dims_type | operator- (Posn that) const |
| Subtracts two Posns, yields a Dims. | |
| Posn & | operator+= (Dims_type dims) |
| Succinct position translation. | |
| Posn & | operator-= (Dims_type dims) |
| Succinct position translation. | |
Shifting member functions | |
| Posn | up_by (Coordinate dy) const |
| Constructs the position that is above this position by the given amount. | |
| Posn | down_by (Coordinate dy) const |
| Constructs the position that is below this position by the given amount. | |
| Posn | left_by (Coordinate dx) const |
| Constructs the position that is to the left of this position by the given amount. | |
| Posn | right_by (Coordinate dx) const |
| Constructs the position that is to the right of this position by the given amount. | |
| Posn | up_left_by (Dims_type dims) const |
| Constructs the position that is above and left of this position by the given dimensions. | |
| Posn | up_right_by (Dims_type dims) const |
| Constructs the position that is above and right of this position by the given dimensions. | |
| Posn | down_left_by (Dims_type dims) const |
| Constructs the position that is below and left of this position by the given dimensions. | |
| Posn | down_right_by (Dims_type dims) const |
| Constructs the position that is below and right of this position by the given dimensions. | |
Public Attributes | |
| Coordinate | x |
| The x coordinate. | |
| Coordinate | y |
| The y coordiante. | |
| using Coordinate = COORDINATE |
The coordinate type for the position.
This is an alias of type parameter COORDINATE.
Definition at line 269 of file ge211_geometry.hxx.
The dimensions type corresponding to this type.
This is an alias of ge211::geometry::Dims.
Definition at line 273 of file ge211_geometry.hxx.
Casts or converts a Posn to a Posn of a different coordinate type.
For example:
Definition at line 309 of file ge211_geometry.hxx.
|
inline |
Explicitly converts a Posn to another coordinate type.
For example:
Definition at line 324 of file ge211_geometry.hxx.
Translates a position by some displacement.
This is the same as Posn::down_right_by(Dims_type) const.
Definition at line 350 of file ge211_geometry.hxx.
Translates a position by the opposite of some displacement.
This is the same as Posn::up_left_by(Dims_type) const.
Definition at line 358 of file ge211_geometry.hxx.