Create and play with a Position2D. More...
#include <alposition2d.h>
Public Member Functions | |
Position2D () | |
Create a Position2D initialized with 0.0f. | |
Position2D (float pInit) | |
Create a Position2D initialize with the same float. | |
Position2D (float pX, float pY) | |
Create a Position2D initialized with explicit value. | |
Position2D (const std::vector< float > &pFloats) | |
Create a Position2D with an std::vector. | |
Position2D | operator+ (const Position2D &pPos2) const |
Overloading of operator + for Position2D. | |
Position2D | operator- (const Position2D &pPos2) const |
Overloading of operator - for Position2D. | |
Position2D | operator+ () const |
Overloading of operator + for Position2D. | |
Position2D | operator- () const |
Overloading of operator - for Position2D. | |
Position2D & | operator+= (const Position2D &pPos2) |
Overloading of operator += for Position2D. | |
Position2D & | operator-= (const Position2D &pPos2) |
Overloading of operator -= for Position2D. | |
bool | operator== (const Position2D &pPos2) const |
Overloading of operator == for Position2D. | |
bool | operator!= (const Position2D &pPos2) const |
Overloading of operator != for Position2D. | |
Position2D | operator* (float pVal) const |
Overloading of operator * for Position2D. | |
Position2D | operator/ (float pVal) const |
Overloading of operator / for Position2D. | |
Position2D & | operator*= (float pVal) |
Overloading of operator *= for Position2D. | |
Position2D & | operator/= (float pVal) |
Overloading of operator /= for Position2D. | |
float | distanceSquared (const Position2D &pPos2) const |
Compute the squared distance between the actual Position2D and the one give in argument. | |
float | distance (const Position2D &pPos2) const |
Compute the distance between the actual Position2D and the one give in argument. | |
bool | isNear (const Position2D &pPos2, const float &pEpsilon=0.0001f) const |
Check if the actual Position2D is near the one give in argument. | |
float | norm () const |
Compute the norm of the actual Position2D. | |
Position2D | normalize () const |
Normalize the actual Position2D. | |
float | crossProduct (const Position2D &pPos2) const |
Compute the cross Product between the actual Position2D and the one give in argument. | |
std::vector< float > | toVector () const |
Return the Position2D as a vector of float [x, y]. | |
Public Attributes | |
float | x |
float | y |
Create and play with a Position2D.
A Position2D is just defined by x and y.
Definition at line 23 of file alposition2d.h.
Create a Position2D initialized with 0.0f.
AL::Math::Position2D::Position2D | ( | float | pInit | ) | [explicit] |
Create a Position2D initialize with the same float.
pInit | the float value for each member |
AL::Math::Position2D::Position2D | ( | float | pX, |
float | pY | ||
) |
Create a Position2D initialized with explicit value.
pX | the float value for x |
pY | the float value for y |
AL::Math::Position2D::Position2D | ( | const std::vector< float > & | pFloats | ) |
Create a Position2D with an std::vector.
pFloats | An std::vector<float> of size 2 for respectively: x and y |
float AL::Math::Position2D::crossProduct | ( | const Position2D & | pPos2 | ) | const |
Compute the cross Product between the actual Position2D and the one give in argument.
pPos2 | the second Position2D |
float AL::Math::Position2D::distance | ( | const Position2D & | pPos2 | ) | const |
Compute the distance between the actual Position2D and the one give in argument.
pPos2 | the second Position2D |
float AL::Math::Position2D::distanceSquared | ( | const Position2D & | pPos2 | ) | const |
Compute the squared distance between the actual Position2D and the one give in argument.
pPos2 | the second Position2D |
bool AL::Math::Position2D::isNear | ( | const Position2D & | pPos2, |
const float & | pEpsilon = 0.0001f |
||
) | const |
Check if the actual Position2D is near the one give in argument.
pPos2 | the second Position2D |
pEpsilon | an optionnal epsilon distance |
float AL::Math::Position2D::norm | ( | ) | const |
Compute the norm of the actual Position2D.
Position2D AL::Math::Position2D::normalize | ( | ) | const |
Normalize the actual Position2D.
bool AL::Math::Position2D::operator!= | ( | const Position2D & | pPos2 | ) | const |
Overloading of operator != for Position2D.
pPos2 | the second Position2D |
Position2D AL::Math::Position2D::operator* | ( | float | pVal | ) | const |
Overloading of operator * for Position2D.
pVal | the float factor |
Position2D& AL::Math::Position2D::operator*= | ( | float | pVal | ) |
Overloading of operator *= for Position2D.
pVal | the float factor |
Position2D AL::Math::Position2D::operator+ | ( | const Position2D & | pPos2 | ) | const |
Overloading of operator + for Position2D.
pPos2 | the second Position2D |
Position2D AL::Math::Position2D::operator+ | ( | ) | const |
Overloading of operator + for Position2D.
Position2D& AL::Math::Position2D::operator+= | ( | const Position2D & | pPos2 | ) |
Overloading of operator += for Position2D.
pPos2 | the second Position2D |
Position2D AL::Math::Position2D::operator- | ( | const Position2D & | pPos2 | ) | const |
Overloading of operator - for Position2D.
pPos2 | the second Position2D |
Position2D AL::Math::Position2D::operator- | ( | ) | const |
Overloading of operator - for Position2D.
Position2D& AL::Math::Position2D::operator-= | ( | const Position2D & | pPos2 | ) |
Overloading of operator -= for Position2D.
pPos2 | the second Position2D |
Position2D AL::Math::Position2D::operator/ | ( | float | pVal | ) | const |
Overloading of operator / for Position2D.
pVal | the float factor |
Position2D& AL::Math::Position2D::operator/= | ( | float | pVal | ) |
Overloading of operator /= for Position2D.
pVal | the float factor |
bool AL::Math::Position2D::operator== | ( | const Position2D & | pPos2 | ) | const |
Overloading of operator == for Position2D.
pPos2 | the second Position2D |
std::vector<float> AL::Math::Position2D::toVector | ( | ) | const |
Return the Position2D as a vector of float [x, y].
float AL::Math::Position2D::x |
Definition at line 26 of file alposition2d.h.
float AL::Math::Position2D::y |
Definition at line 28 of file alposition2d.h.