libalmath  2.5.7.1
 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::Pose2D Struct Reference

A pose in a 2-dimentional space. More...

#include <alpose2d.h>

Public Member Functions

 Pose2D ()
 Create a Pose2D initialized with 0.0f. More...
 
 Pose2D (float pInit)
 Create a Pose2D initialize with the same float. More...
 
 Pose2D (float pX, float pY, float pTheta)
 Create a Pose2D initialized with explicit value. More...
 
 Pose2D (const std::vector< float > &pFloats)
 Create a Pose2D with an std::vector. More...
 
Pose2D operator+ (const Pose2D &pPos2) const
 Overloading of operator + for Pose2D. More...
 
Pose2D operator- (const Pose2D &pPos2) const
 Overloading of operator - for Pose2D. More...
 
Pose2D operator+ (void) const
 Overloading of operator + for Pose2D. More...
 
Pose2D operator- () const
 Overloading of operator - for Pose2D. More...
 
Pose2Doperator+= (const Pose2D &pPos2)
 Overloading of operator += for Pose2D. More...
 
Pose2Doperator-= (const Pose2D &pPos2)
 Overloading of operator -= for Pose2D. More...
 
Pose2Doperator*= (const Pose2D &pPos2)
 Overloading of operator *= for Pose2D. More...
 
Pose2D operator* (const Pose2D &pPos2) const
 Overloading of operator * for Pose2D. More...
 
bool operator== (const Pose2D &pPos2) const
 Overloading of operator == for Pose2D. More...
 
bool operator!= (const Pose2D &pPos2) const
 Overloading of operator != for Pose2D. More...
 
Pose2D operator* (float pVal) const
 Overloading of operator * for Pose2D. More...
 
Pose2D operator/ (float pVal) const
 Overloading of operator / for Pose2D. More...
 
Pose2Doperator*= (float pVal)
 Overloading of operator *= for Pose2D. More...
 
Pose2Doperator/= (float pVal)
 Overloading of operator /= for Pose2D. More...
 
float distanceSquared (const Pose2D &pPos2) const
 Compute the squared distance between the actual Pose2D and the one give in argument. More...
 
float distance (const Pose2D &pPos2) const
 Compute the distance between the actual Pose2D and the one give in argument. More...
 
Pose2D inverse () const
 Return the inverse of the Pose2D More...
 
Pose2D diff (const Pose2D &pPos2) const
 Compute the Pose2D between the actual Pose2D and the one given in argument: More...
 
bool isNear (const Pose2D &pPos2, const float &pEpsilon=0.0001f) const
 Check if the actual Pose2D is near the one given in argument. More...
 
void toVector (std::vector< float > &pReturnVector) const
 Return the Pose2D as a vector of float [x, y, theta]. More...
 
std::vector< float > toVector (void) const
 
void writeToVector (std::vector< float >::iterator &pIt) const
 Write [x, y, theta] in the vector and update the iterator. It is assumed the vector has enough space. More...
 
float norm () const
 Compute the norm of the current Pose2D. More...
 
Pose2D normalize () const
 Normalize the current Pose2D position. More...
 
float getAngle (void) const
 Returns the angle of the current Pose2D. More...
 

Static Public Member Functions

static Pose2D fromPolarCoordinates (const float pRadius, const float pAngle)
 Create a Pose2D from polar coordinates. More...
 

Public Attributes

float x
 
float y
 
float theta
 

Detailed Description

A pose in a 2-dimentional space.

On a plane a position is totally defined by the postions x,y and the rotation theta.

Definition at line 25 of file alpose2d.h.

Constructor & Destructor Documentation

AL::Math::Pose2D::Pose2D ( )

Create a Pose2D initialized with 0.0f.

$ \left[\begin{array}{c} x \\ y \\ theta \end{array}\right] = \left[\begin{array}{c} 0.0 \\ 0.0 \\ 0.0 \end{array}\right]$

AL::Math::Pose2D::Pose2D ( float  pInit)
explicit

Create a Pose2D initialize with the same float.

$ \left[\begin{array}{c} x \\ y \\ theta \end{array}\right] = \left[\begin{array}{c} pInit \\ pInit \\ pInit \end{array}\right]$

Parameters
pInitthe float value for each member
AL::Math::Pose2D::Pose2D ( float  pX,
float  pY,
float  pTheta 
)
explicit

Create a Pose2D initialized with explicit value.

$ \left[\begin{array}{c} x \\ y \\ theta \end{array}\right] = \left[\begin{array}{c} pX \\ pY \\ pTheta \end{array}\right]$

Parameters
pXthe float value for x
pYthe float value for y
pThetathe float value for theta
AL::Math::Pose2D::Pose2D ( const std::vector< float > &  pFloats)

Create a Pose2D with an std::vector.

$ \left[\begin{array}{c} x \\ y \\ theta \end{array}\right] = \left[\begin{array}{c} pFloats[0] \\ pFloats[1] \\ pFloats[2] \end{array}\right]$

Parameters
pFloatsAn std::vector<float> of size 3 for respectively:

x, y and theta

Member Function Documentation

Pose2D AL::Math::Pose2D::diff ( const Pose2D pPos2) const

Compute the Pose2D between the actual Pose2D and the one given in argument:

result: inverse(pPos1)*pPos2

Parameters
pPos2the second Pose2D
float AL::Math::Pose2D::distance ( const Pose2D pPos2) const

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

$\sqrt{(pPos1.x-pPos2.x)^2+(pPos1.y-pPos2.y)^2}$

Parameters
pPos2the second Pose2D
Returns
the float distance between the two Pose2D
float AL::Math::Pose2D::distanceSquared ( const Pose2D pPos2) const

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

This avoids doing the sqrt needed for a true distance.

$(pPos1.x-pPos2.x)^2+(pPos1.y-pPos2.y)^2$

Parameters
pPos2the second Pose2D
Returns
the float squared distance between the two Pose2D
float AL::Math::Pose2D::getAngle ( void  ) const
inline

Returns the angle of the current Pose2D.

result: $$/atan2(pose.y, pose.x)$$

Definition at line 322 of file alpose2d.h.

Pose2D AL::Math::Pose2D::inverse ( ) const

Return the inverse of the Pose2D

bool AL::Math::Pose2D::isNear ( const Pose2D pPos2,
const float &  pEpsilon = 0.0001f 
) const

Check if the actual Pose2D is near the one given in argument.

Parameters
pPos2the second Pose2D
pEpsilonan optionnal epsilon distance - default: 0.0001
Returns
true if the distance between the two Pose2D is less than pEpsilon
float AL::Math::Pose2D::norm ( ) const
inline

Compute the norm of the current Pose2D.

result: $$/sqrt(pose.x^{2} + pose.y^{2})$$

Definition at line 301 of file alpose2d.h.

Pose2D AL::Math::Pose2D::normalize ( ) const

Normalize the current Pose2D position.

$pRes = \frac{pPos}{norm(pPos)}$

Returns
the Pose2D normalized
bool AL::Math::Pose2D::operator!= ( const Pose2D pPos2) const

Overloading of operator != for Pose2D.

Parameters
pPos2the second Pose2D
Pose2D AL::Math::Pose2D::operator* ( const Pose2D pPos2) const
inline

Overloading of operator * for Pose2D.

Parameters
pPos2the second Pose2D

Definition at line 182 of file alpose2d.h.

Pose2D AL::Math::Pose2D::operator* ( float  pVal) const
inline

Overloading of operator * for Pose2D.

Parameters
pValthe float factor

Definition at line 206 of file alpose2d.h.

Pose2D& AL::Math::Pose2D::operator*= ( const Pose2D pPos2)

Overloading of operator *= for Pose2D.

Parameters
pPos2the second Pose2D
Pose2D& AL::Math::Pose2D::operator*= ( float  pVal)

Overloading of operator *= for Pose2D.

Parameters
pValthe float factor
Pose2D AL::Math::Pose2D::operator+ ( const Pose2D pPos2) const
inline

Overloading of operator + for Pose2D.

Parameters
pPos2the second Pose2D

Definition at line 130 of file alpose2d.h.

Pose2D AL::Math::Pose2D::operator+ ( void  ) const
inline

Overloading of operator + for Pose2D.

Definition at line 147 of file alpose2d.h.

Pose2D& AL::Math::Pose2D::operator+= ( const Pose2D pPos2)

Overloading of operator += for Pose2D.

Parameters
pPos2the second Pose2D
Pose2D AL::Math::Pose2D::operator- ( const Pose2D pPos2) const
inline

Overloading of operator - for Pose2D.

Parameters
pPos2the second Pose2D

Definition at line 139 of file alpose2d.h.

Pose2D AL::Math::Pose2D::operator- ( ) const
inline

Overloading of operator - for Pose2D.

Definition at line 155 of file alpose2d.h.

Pose2D& AL::Math::Pose2D::operator-= ( const Pose2D pPos2)

Overloading of operator -= for Pose2D.

Parameters
pPos2the second Pose2D
Pose2D AL::Math::Pose2D::operator/ ( float  pVal) const

Overloading of operator / for Pose2D.

Parameters
pValthe float factor
Pose2D& AL::Math::Pose2D::operator/= ( float  pVal)

Overloading of operator /= for Pose2D.

Parameters
pValthe float factor
bool AL::Math::Pose2D::operator== ( const Pose2D pPos2) const

Overloading of operator == for Pose2D.

Parameters
pPos2the second Pose2D
void AL::Math::Pose2D::toVector ( std::vector< float > &  pReturnVector) const

Return the Pose2D as a vector of float [x, y, theta].

std::vector<float> AL::Math::Pose2D::toVector ( void  ) const
void AL::Math::Pose2D::writeToVector ( std::vector< float >::iterator &  pIt) const

Write [x, y, theta] in the vector and update the iterator. It is assumed the vector has enough space.

Member Data Documentation

float AL::Math::Pose2D::theta

Definition at line 31 of file alpose2d.h.

float AL::Math::Pose2D::x

Definition at line 27 of file alpose2d.h.

float AL::Math::Pose2D::y

Definition at line 29 of file alpose2d.h.


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