A Point_2D holds 2-dimensional position information. More...
#include <Dimensions.hh>
Public Member Functions | |
Point_2D () | |
Constructs a Point_2D at position 0,0. | |
Point_2D (const Coordinate_Type &x, const Coordinate_Type &y) | |
Constructs a Point_2D at position x,y. | |
Point_2D (const Point_2D &point) | |
Constructs a Point_2D from another Point_2D. | |
Point_2D & | position (const Coordinate_Type &x, const Coordinate_Type &y) |
Set the position of this Point_2D. | |
Point_2D & | position (const Point_2D &point) |
Set the position of this Point_2D. | |
Point_2D & | operator= (const Point_2D &point) |
Assign the position of another Point_2D to this Point_2D. | |
Point_2D & | x (const Coordinate_Type &x_position) |
Set the horizontal (x-axis) position. | |
Coordinate_Type | x () const |
Get the horizontal (x-axis) position. | |
Point_2D & | y (const Coordinate_Type &y_position) |
Set the vertical (y-axis) position. | |
Coordinate_Type | y () const |
Get the vertical (y-axis) position. | |
bool | operator== (const Point_2D &point) const |
Test if this Point_2D is equal to another Point_2D. | |
bool | operator!= (const Point_2D &point) const |
Test if this Point_2D is not equal to another Point_2D. | |
operator bool () | |
Test for all zero coordinate values. | |
bool | is_null () |
Test for all zero coordinate values. | |
Point_2D & | operator+= (const Point_2D &offset) |
Add an offset. | |
Point_2D & | operator-= (const Point_2D &offset) |
Subtract an offset. | |
Point_2D & | operator*= (double factor) |
Multiply by a factor. | |
Point_2D & | operator/= (double factor) |
Divide by a factor. | |
Public Attributes | |
Coordinate_Type | X |
The horizontal (x-axis) position of the Point_2D. | |
Coordinate_Type | Y |
The vertical (y-axis) position of the Point_2D. | |
Static Public Attributes | |
static const char *const | ID = "PIRL::Dimensions ($Revision: 1.16 $ $Date: 2011/02/18 02:29:28 $)" |
Class identification name with source code version and date. |
A Point_2D holds 2-dimensional position information.
PIRL::Point_2D::Point_2D | ( | ) |
Constructs a Point_2D at position 0,0.
Referenced by PIRL::Rectangle::position().
PIRL::Point_2D::Point_2D | ( | const Coordinate_Type & | x, |
const Coordinate_Type & | y | ||
) |
PIRL::Point_2D::Point_2D | ( | const Point_2D & | point ) |
Point_2D& PIRL::Point_2D::position | ( | const Coordinate_Type & | x, |
const Coordinate_Type & | y | ||
) | [inline] |
Set the position of this Point_2D.
x | The horizontal (x-axis) position of the Point_2D. |
y | The vertical (y-axis) position of the Point_2D. |
Reimplemented in PIRL::Rectangle, and PIRL::Cube.
Set the position of this Point_2D.
Reimplemented in PIRL::Rectangle, and PIRL::Cube.
Assign the position of another Point_2D to this Point_2D.
Reimplemented in PIRL::Rectangle, and PIRL::Cube.
Point_2D& PIRL::Point_2D::x | ( | const Coordinate_Type & | x_position ) | [inline] |
Coordinate_Type PIRL::Point_2D::x | ( | ) | const [inline] |
Get the horizontal (x-axis) position.
References X.
Referenced by position().
Point_2D& PIRL::Point_2D::y | ( | const Coordinate_Type & | y_position ) | [inline] |
Coordinate_Type PIRL::Point_2D::y | ( | ) | const [inline] |
Get the vertical (y-axis) position.
References Y.
Referenced by position().
bool PIRL::Point_2D::operator== | ( | const Point_2D & | point ) | const [inline] |
bool PIRL::Point_2D::operator!= | ( | const Point_2D & | point ) | const [inline] |
PIRL::Point_2D::operator bool | ( | ) | [inline] |
Test for all zero coordinate values.
Reimplemented in PIRL::Rectangle, and PIRL::Cube.
bool PIRL::Point_2D::is_null | ( | ) | [inline] |
Add an offset.
offset | A Point_2D that provides the offset values. |
Reimplemented in PIRL::Rectangle.
Subtract an offset.
offset | A Point_2D that provides the offset values. |
Reimplemented in PIRL::Rectangle.
Point_2D& PIRL::Point_2D::operator*= | ( | double | factor ) | [inline] |
Multiply by a factor.
The new coordinate values will be rounded to the nearest Coordinate_Type values.
factor | A factor by which to multiply the Point_2D coordinates. |
Reimplemented in PIRL::Rectangle, and PIRL::Cube.
References PIRL::Round(), X, and Y.
Point_2D & PIRL::Point_2D::operator/= | ( | double | factor ) |
Divide by a factor.
The new coordinate values will be rounded to the nearest Coordinate_Type values.
N.B.: Divide by zero is handled as a special case. If the coordinate value was zero it will remain zero. If the Coordinate_Type has an infinity value (determined by numeric_types) that is used, or its negative if the coordinate value is negative. Otherwise, if the Coordinate_Type is signed the type's max value is used, or the min value if the coordinate value is negative; for an unsigned value the max value is used.
factor | A factor by which to divide the Point_2D dimensions. |
Reimplemented in PIRL::Rectangle, and PIRL::Cube.
References PIRL::Round().
const char *const PIRL::Point_2D::ID = "PIRL::Dimensions ($Revision: 1.16 $ $Date: 2011/02/18 02:29:28 $)" [static] |
Class identification name with source code version and date.
Referenced by PIRL::Size_2D::operator*=(), and PIRL::Size_2D::operator/=().
The horizontal (x-axis) position of the Point_2D.
Referenced by is_null(), operator bool(), operator!=(), PIRL::Rectangle::operator&=(), operator*=(), operator+=(), PIRL::operator-(), operator-=(), PIRL::operator<<(), PIRL::Cube::operator=(), PIRL::Rectangle::operator=(), operator=(), operator==(), PIRL::Rectangle::operator|=(), PIRL::Rectangle::position(), position(), and x().
The vertical (y-axis) position of the Point_2D.
Referenced by is_null(), operator bool(), operator!=(), PIRL::Rectangle::operator&=(), operator*=(), operator+=(), PIRL::operator-(), operator-=(), PIRL::operator<<(), PIRL::Cube::operator=(), PIRL::Rectangle::operator=(), operator=(), operator==(), PIRL::Rectangle::operator|=(), PIRL::Rectangle::position(), position(), and y().