A pair of (x, y) co-ordinates. More...
Public Member Functions | |
| Point () throw () | |
| Creates a point with co-ordinates (0, 0). | |
| Point (const Point &other) throw () | |
| Creates a copy of another point. | |
| Point (const ValueType initialX, const ValueType initialY) throw () | |
| Creates a point from an (x, y) position. | |
| ~Point () throw () | |
| Destructor. | |
| Point & | operator= (const Point &other) throw () |
| Copies this point from another one. | |
| ValueType | getX () const throw () |
| Returns the point's x co-ordinate. | |
| ValueType | getY () const throw () |
| Returns the point's y co-ordinate. | |
| bool | operator== (const Point &other) const throw () |
| bool | operator!= (const Point &other) const throw () |
| bool | isOrigin () const throw () |
| Returns true if the point is (0, 0). | |
| void | setXY (const ValueType newX, const ValueType newY) throw () |
| Changes the point's x and y co-ordinates. | |
| void | addXY (const ValueType xToAdd, const ValueType yToAdd) throw () |
| Adds a pair of co-ordinates to this value. | |
| const Point | operator+ (const Point &other) const throw () |
| Adds two points together. | |
| Point & | operator+= (const Point &other) throw () |
| Adds another point's co-ordinates to this one. | |
| const Point | operator- (const Point &other) const throw () |
| Subtracts one points from another. | |
| Point & | operator-= (const Point &other) throw () |
| Subtracts another point's co-ordinates to this one. | |
| const Point | operator- () const throw () |
| Returns the inverse of this point. | |
| ValueType | getDistanceFrom (const Point &other) const throw () |
| Returns the straight-line distance between this point and another one. | |
| void | applyTransform (const AffineTransform &transform) throw () |
| Uses a transform to change the point's co-ordinates. | |
| const String | toString () const |
| Returns the point as a string in the form "x, y". | |
A pair of (x, y) co-ordinates.
The ValueType template should be a primitive type such as int, float, double, rather than a class.
Creates a point with co-ordinates (0, 0).
Referenced by Point< int >::operator+(), and Point< int >::operator-().
| Point< ValueType >::Point | ( | const Point< ValueType > & | other | ) | throw () |
Creates a copy of another point.
| Point< ValueType >::Point | ( | const ValueType | initialX, | |
| const ValueType | initialY | |||
| ) | throw () |
Creates a point from an (x, y) position.
| Point& Point< ValueType >::operator= | ( | const Point< ValueType > & | other | ) | throw () |
Copies this point from another one.
| ValueType Point< ValueType >::getX | ( | ) | const throw () |
Returns the point's x co-ordinate.
| ValueType Point< ValueType >::getY | ( | ) | const throw () |
Returns the point's y co-ordinate.
| bool Point< ValueType >::operator== | ( | const Point< ValueType > & | other | ) | const throw () |
| bool Point< ValueType >::operator!= | ( | const Point< ValueType > & | other | ) | const throw () |
| bool Point< ValueType >::isOrigin | ( | ) | const throw () |
Returns true if the point is (0, 0).
| void Point< ValueType >::setXY | ( | const ValueType | newX, | |
| const ValueType | newY | |||
| ) | throw () |
Changes the point's x and y co-ordinates.
| void Point< ValueType >::addXY | ( | const ValueType | xToAdd, | |
| const ValueType | yToAdd | |||
| ) | throw () |
Adds a pair of co-ordinates to this value.
| const Point Point< ValueType >::operator+ | ( | const Point< ValueType > & | other | ) | const throw () |
Adds two points together.
| Point& Point< ValueType >::operator+= | ( | const Point< ValueType > & | other | ) | throw () |
Adds another point's co-ordinates to this one.
| const Point Point< ValueType >::operator- | ( | const Point< ValueType > & | other | ) | const throw () |
Subtracts one points from another.
| Point& Point< ValueType >::operator-= | ( | const Point< ValueType > & | other | ) | throw () |
Subtracts another point's co-ordinates to this one.
Returns the inverse of this point.
| ValueType Point< ValueType >::getDistanceFrom | ( | const Point< ValueType > & | other | ) | const throw () |
Returns the straight-line distance between this point and another one.
| void Point< ValueType >::applyTransform | ( | const AffineTransform & | transform | ) | throw () |
Uses a transform to change the point's co-ordinates.
This will only compile if ValueType = float!
Returns the point as a string in the form "x, y".
1.6.3