- Aldebaran documentation |
- C++ Libraries |
- index

libalmath 2.8.7.4

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
AL::Math::Position2D Struct Reference
Types

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

## Detailed Description

Create and play with a Position2D.

A Position2D is just defined by x and y.

Definition at line 24 of file alposition2d.h.

## Constructor & Destructor Documentation

AL::Math::Position2D::Position2D | ( |  | ) |

Create a Position2D initialized with 0.0f.

AL::Math::Position2D::Position2D | ( | float | pInit | ) |
| explicit

Create a Position2D initialize with the same float.

Parameters

  pInit | the float value for each member

AL::Math::Position2D::Position2D | ( | float | pX,
|  | float | pY
| ) |  |

Create a Position2D initialized with explicit value.

Parameters

  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.

Parameters

  pFloats | An std::vector<float> of size 2 for respectively: x and y

## Member Function Documentation

float AL::Math::Position2D::crossProduct | ( | const Position2D & | pPos2 | ) | const

Compute the cross Product between the actual Position2D and the one give in argument.

Parameters

  pPos2 | the second Position2D

Returns
  the float cross product between the two Position2D

float AL::Math::Position2D::distance | ( | const Position2D & | pPos2 | ) | const

Compute the distance between the actual Position2D and the one give in argument.

Parameters

  pPos2 | the second Position2D

Returns
  the float distance between the two Position2D

float AL::Math::Position2D::distanceSquared | ( | const Position2D & | pPos2 | ) | const

Compute the squared distance between the actual Position2D and the one give in argument.

Parameters

  pPos2 | the second Position2D

Returns
  the float squared distance between the two Position2D

float AL::Math::Position2D::dotProduct | ( | const Position2D & | pPos2 | ) | const

Compute the dot Product between the actual Position2D and the one give in argument.

Parameters

  pPos2 | the second Position2D

Returns
  the float dot product between the two Position2D

static Position2D AL::Math::Position2D::fromPolarCoordinates | ( | const float | pRadius,
|  | const float | pAngle
| ) |  |
| static

Build a Position2D from polar coordinates.

Parameters

  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.

Parameters

  pPos2 | the second Position2D
  pEpsilon | an optionnal epsilon distance

Returns
  true if the distance between the two Position2D is less than pEpsilon

float AL::Math::Position2D::norm | ( |  | ) | const

Compute the norm of the actual Position2D.

Returns
  the float norm of the Position2D

Position2D AL::Math::Position2D::normalize | ( |  | ) | const

Normalize the actual Position2D.

Returns
  the Position2D normalized

bool AL::Math::Position2D::operator!= | ( | const Position2D & | pPos2 | ) | const

Overloading of operator != for Position2D.

Parameters

  pPos2 | the second Position2D

Returns
  true if one of each float of the two Position2D are not equal

Position2D AL::Math::Position2D::operator* | ( | float | pVal | ) | const
| inline

Overloading of operator * for Position2D.

Parameters

  pVal | the float factor

Definition at line 180 of file alposition2d.h.

Position2D& AL::Math::Position2D::operator*= | ( | float | pVal | ) |

Overloading of operator *= for Position2D.

Parameters

  pVal | the float factor

Position2D AL::Math::Position2D::operator+ | ( | const Position2D & | pPos2 | ) | const
| inline

Overloading of operator + for Position2D.

Parameters

  pPos2 | the second Position2D

Definition at line 116 of file alposition2d.h.

Position2D AL::Math::Position2D::operator+ | ( | void |  | ) | const
| inline

Overloading of operator + for Position2D.

Definition at line 133 of file alposition2d.h.

Position2D& AL::Math::Position2D::operator+= | ( | const Position2D & | pPos2 | ) |

Overloading of operator += for Position2D.

Parameters

  pPos2 | the second Position2D

Position2D AL::Math::Position2D::operator- | ( | const Position2D & | pPos2 | ) | const
| inline

Overloading of operator - for Position2D.

Parameters

  pPos2 | the second Position2D

Definition at line 125 of file alposition2d.h.

Position2D AL::Math::Position2D::operator- | ( |  | ) | const
| inline

Overloading of operator - for Position2D.

Definition at line 141 of file alposition2d.h.

Position2D& AL::Math::Position2D::operator-= | ( | const Position2D & | pPos2 | ) |

Overloading of operator -= for Position2D.

Parameters

  pPos2 | the second Position2D

Position2D AL::Math::Position2D::operator/ | ( | float | pVal | ) | const

Overloading of operator / for Position2D.

Parameters

  pVal | the float factor

Position2D& AL::Math::Position2D::operator/= | ( | float | pVal | ) |

Overloading of operator /= for Position2D.

Parameters

  pVal | the float factor

bool AL::Math::Position2D::operator== | ( | const Position2D & | pPos2 | ) | const

Overloading of operator == for Position2D.

Parameters

  pPos2 | the second Position2D

Returns
  true if each float of the two Position2D are equal

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.

## Member Data Documentation

float AL::Math::Position2D::x

Definition at line 27 of file alposition2d.h.

float AL::Math::Position2D::y

Definition at line 29 of file alposition2d.h.

The documentation for this struct was generated from the following file:

- /home/opennao/work/release-2.8/lib/libalmath/almath/types/alposition2d.h