A 2D Point template. More...
#include <Math/Point.h>
Public Member Functions | |
Point2 () | |
Defualt constructer. Constructs the origin (0,0). | |
Point2 (T _x, T _y) | |
Constructs a spacific point. | |
Point2 (const Vector2< T > &v) | |
Constructer to convert a 2D vector to a point. | |
void | Set (T _x, T _y) |
Sets the (x,y) data of th point. | |
Point2 | operator+ (const Point2 &p) const |
Overloaded point addition operator. | |
Point2 | operator+ (const Vector2< T > &v) const |
Overloaded point-vector addition operator. | |
Point2 & | operator+= (const Point2 &p) |
Overloaded sum assignment operator. Adds the given Point to this Point. | |
Vector2< T > | operator- (const Point2 &p) const |
Overloaded Point subtraction operator. | |
Point2< T > | operator- () const |
Overloaded Point negation operator. | |
Point2 & | operator-= (const Point2 &p) |
Overloaded subtraction assignment operator. Subtracts the given Point from this Point. | |
T & | operator[] (int i) |
Overloaded array access operator. | |
T | operator[] (int i) const |
Overloaded array access operator. | |
Point2 | operator* (T c) const |
Overloaded constant multiplication operator. | |
Public Attributes | |
T | x |
The (x,y) point data. | |
Friends | |
Point2 | operator* (float c, const Point2 &p) |
Overloaded constant-point multiplication operator. |
A 2D Point template.
T | the type that x and y take. Usually float , double , int or byte . |
A 2D Point template that provides useful methods for manipulating 2D Points.
Constructs a spacific point.
[in] | _x | the x position. |
[in] | _y | the y position. |
Constructer to convert a 2D vector to a point.
[in] | v | the vector to convert. |
Overloaded constant multiplication operator.
[in] | c | the constant to multiply by. |
Overloaded point-vector addition operator.
[in] | v | the vector to add to. |
Overloaded point addition operator.
[in] | p | the point to add to. |
Overloaded sum assignment operator. Adds the given Point to this Point.
[in] | p | the point to add. |
Overloaded Point negation operator.
Overloaded Point subtraction operator.
[in] | p | the point to subtract from. |
Overloaded subtraction assignment operator. Subtracts the given Point from this Point.
[in] | p | the point to subtract. |
T Point2< T >::operator[] | ( | int | i | ) | const [inline] |
Overloaded array access operator.
[in] | i | must be either 0 for x or 1 for y |
T& Point2< T >::operator[] | ( | int | i | ) | [inline] |
Overloaded array access operator.
[in] | i | must be either 0 for x or 1 for y |
void Point2< T >::Set | ( | T | _x, | |
T | _y | |||
) | [inline] |
Sets the (x,y) data of th point.
[in] | _x | the value to set x to. |
[in] | _y | the value to set y to. |
Overloaded constant-point multiplication operator.
[in] | c | the constant. |
[in] | p | the point. |