libalmath
2.5.11.14a
|
Create and play with a Position2D. More...
#include <alposition2d.h>
Public Member Functions | |
Position2D () | |
Create a Position2D initialized with 0.0f. More... | |
Position2D (float pInit) | |
Create a Position2D initialize with the same float. More... | |
Position2D (float pX, float pY) | |
Create a Position2D initialized with explicit value. More... | |
Position2D (const std::vector< float > &pFloats) | |
Create a Position2D with an std::vector. More... | |
Position2D | operator+ (const Position2D &pPos2) const |
Overloading of operator + for Position2D. More... | |
Position2D | operator- (const Position2D &pPos2) const |
Overloading of operator - for Position2D. More... | |
Position2D | operator+ (void) const |
Overloading of operator + for Position2D. More... | |
Position2D | operator- () const |
Overloading of operator - for Position2D. More... | |
Position2D & | operator+= (const Position2D &pPos2) |
Overloading of operator += for Position2D. More... | |
Position2D & | operator-= (const Position2D &pPos2) |
Overloading of operator -= for Position2D. More... | |
bool | operator== (const Position2D &pPos2) const |
Overloading of operator == for Position2D. More... | |
bool | operator!= (const Position2D &pPos2) const |
Overloading of operator != for Position2D. More... | |
Position2D | operator* (float pVal) const |
Overloading of operator * for Position2D. More... | |
Position2D | operator/ (float pVal) const |
Overloading of operator / for Position2D. More... | |
Position2D & | operator*= (float pVal) |
Overloading of operator *= for Position2D. More... | |
Position2D & | operator/= (float pVal) |
Overloading of operator /= for Position2D. More... | |
float | distanceSquared (const Position2D &pPos2) const |
Compute the squared distance between the actual Position2D and the one give in argument. More... | |
float | distance (const Position2D &pPos2) const |
Compute the distance between the actual Position2D and the one give in argument. More... | |
bool | isNear (const Position2D &pPos2, const float &pEpsilon=0.0001f) const |
Check if the actual Position2D is near the one give in argument. More... | |
float | norm () const |
Compute the norm of the actual Position2D. More... | |
Position2D | normalize () const |
Normalize the actual Position2D. More... | |
float | dotProduct (const Position2D &pPos2) const |
Compute the dot Product between the actual Position2D and the one give in argument. More... | |
float | crossProduct (const Position2D &pPos2) const |
Compute the cross Product between the actual Position2D and the one give in argument. More... | |
void | toVector (std::vector< float > &pReturnVector) const |
Return the Position2D as a vector of float [x, y]. More... | |
std::vector< float > | toVector (void) const |
void | writeToVector (std::vector< float >::iterator &pIt) const |
Write [x, y] in the vector and update the iterator. It is assumed the vector has enough space. More... | |
float | getAngle () const |
Return the angular direction of a Position2D. More... | |
Static Public Member Functions | |
static Position2D | fromPolarCoordinates (const float pRadius, const float pAngle) |
Build a Position2D from polar coordinates. More... | |
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.
AL::Math::Position2D::Position2D | ( | ) |
Create a Position2D initialized with 0.0f.
|
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 |
float AL::Math::Position2D::dotProduct | ( | const Position2D & | pPos2 | ) | const |
Compute the dot Product between the actual Position2D and the one give in argument.
pPos2 | the second Position2D |
|
static |
Build a Position2D from polar coordinates.
pRadius | polar radius |
pAngle | polar angle in radians |
float AL::Math::Position2D::getAngle | ( | ) | const |
Return the angular direction of a 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 |
Position2D AL::Math::Position2D::normalize | ( | ) | const |
bool AL::Math::Position2D::operator!= | ( | const Position2D & | pPos2 | ) | const |
Overloading of operator != for Position2D.
pPos2 | the second Position2D |
|
inline |
Overloading of operator * for Position2D.
pVal | the float factor |
Definition at line 179 of file alposition2d.h.
Position2D& AL::Math::Position2D::operator*= | ( | float | pVal | ) |
Overloading of operator *= for Position2D.
pVal | the float factor |
|
inline |
Overloading of operator + for Position2D.
pPos2 | the second Position2D |
Definition at line 115 of file alposition2d.h.
|
inline |
Overloading of operator + for Position2D.
Definition at line 132 of file alposition2d.h.
Position2D& AL::Math::Position2D::operator+= | ( | const Position2D & | pPos2 | ) |
Overloading of operator += for Position2D.
pPos2 | the second Position2D |
|
inline |
Overloading of operator - for Position2D.
pPos2 | the second Position2D |
Definition at line 124 of file alposition2d.h.
|
inline |
Overloading of operator - for Position2D.
Definition at line 140 of file alposition2d.h.
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 |
void AL::Math::Position2D::toVector | ( | std::vector< float > & | pReturnVector | ) | const |
Return the Position2D as a vector of float [x, y].
std::vector<float> AL::Math::Position2D::toVector | ( | void | ) | const |
void AL::Math::Position2D::writeToVector | ( | std::vector< float >::iterator & | pIt | ) | const |
Write [x, y] in the vector and update the iterator. It is assumed the vector has enough space.
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.