libalmath  2.1.4.13
 All Classes Namespaces Functions Variables Typedefs Groups Pages
Public Member Functions | Public Attributes | List of all members
AL::Math::Position3D Struct Reference

Create and play with a Position3D. More...

#include <alposition3d.h>

Public Member Functions

 Position3D ()
 Create a Position3D initialize with 0.0f. More...
 
 Position3D (float pInit)
 Create a Position3D initialize with the same float. More...
 
 Position3D (float pX, float pY, float pZ)
 Create a Position3D initialize with explicit value. More...
 
 Position3D (const std::vector< float > &pFloats)
 Create a Position3D with an std::vector. More...
 
Position3D operator+ (const Position3D &pPos2) const
 Overloading of operator + for Position3D. More...
 
Position3D operator- (const Position3D &pPos2) const
 Overloading of operator - for Position3D. More...
 
Position3D operator+ (void) const
 Overloading of operator + for Position3D. More...
 
Position3D operator- () const
 Overloading of operator - for Position3D. More...
 
Position3Doperator+= (const Position3D &pPos2)
 Overloading of operator += for Position3D. More...
 
Position3Doperator-= (const Position3D &pPos2)
 Overloading of operator -= for Position3D. More...
 
bool operator== (const Position3D &pPos2) const
 Overloading of operator == for Position3D. More...
 
bool operator!= (const Position3D &pPos2) const
 Overloading of operator != for Position3D. More...
 
Position3D operator* (float pVal) const
 Overloading of operator * for Position3D. More...
 
Position3D operator/ (float pVal) const
 Overloading of operator / for Position3D. More...
 
Position3Doperator*= (float pVal)
 Overloading of operator *= for Position3D. More...
 
Position3Doperator/= (float pVal)
 Overloading of operator /= for Position3D. More...
 
float distanceSquared (const Position3D &pPos2) const
 Compute the squared distance between the actual Position3D and the one given in argument. More...
 
float distance (const Position3D &pPos2) const
 Compute the distance between the actual Position3D and the one given in argument. More...
 
bool isNear (const Position3D &pPos2, const float &pEpsilon=0.0001f) const
 Check if the actual Position3D is near the one give in argument. More...
 
float norm () const
 Compute the norm of the actual Position3D. More...
 
Position3D normalize () const
 Normalize the actual Position3D. More...
 
float dotProduct (const Position3D &pPos2) const
 Compute the dot Product between the actual Position3D and the one give in argument. More...
 
Position3D crossProduct (const Position3D &pPos2) const
 Compute the cross Product between the actual Position3D and the one give in argument. More...
 
void toVector (std::vector< float > &pReturnVector) const
 Return the Position3D as a vector of float [x, y, z]. More...
 
std::vector< float > toVector (void) const
 

Public Attributes

float x
 
float y
 
float z
 

Detailed Description

Create and play with a Position3D.

A Position3D is just defined by x, y and z.

Definition at line 23 of file alposition3d.h.

Constructor & Destructor Documentation

AL::Math::Position3D::Position3D ( )

Create a Position3D initialize with 0.0f.

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

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

Create a Position3D initialize with the same float.

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

Parameters
pInitthe float value for each member
AL::Math::Position3D::Position3D ( float  pX,
float  pY,
float  pZ 
)

Create a Position3D initialize with explicit value.

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

Parameters
pXthe float value for x
pYthe float value for y
pZthe float value for z
AL::Math::Position3D::Position3D ( const std::vector< float > &  pFloats)

Create a Position3D with an std::vector.

$ \left[\begin{array}{c} x \\ y \\ z \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 z

Member Function Documentation

Position3D AL::Math::Position3D::crossProduct ( const Position3D pPos2) const

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

$pRes.x = pPos1.y*pPos2.z - pPos1.z*pPos2.y$
$pRes.y = pPos1.z*pPos2.x - pPos1.x*pPos2.z$
$pRes.z = pPos1.x*pPos2.y - pPos1.y*pPos2.x$

Parameters
pPos2the second Position3D
Returns
the Position3D cross product between the two Position3D
float AL::Math::Position3D::distance ( const Position3D pPos2) const

Compute the distance between the actual Position3D and the one given in argument.

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

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

Compute the squared distance between the actual Position3D and the one given in argument.

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

Parameters
pPos2the second Position3D
Returns
the float squared distance between the two Position3D
float AL::Math::Position3D::dotProduct ( const Position3D pPos2) const

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

$result = (pPos1.x*pPos2.x + pPos1.y*pPos2.y + pPos1.z*pPos2.z)$

Parameters
pPos2the second Position3D
Returns
the float dot product between the two Position3D
bool AL::Math::Position3D::isNear ( const Position3D pPos2,
const float &  pEpsilon = 0.0001f 
) const

Check if the actual Position3D is near the one give in argument.

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

Compute the norm of the actual Position3D.

$\sqrt{pPos.x^2+pPos.y^2+pPos.z^2}$

Returns
the float norm of the Position3D
Position3D AL::Math::Position3D::normalize ( ) const

Normalize the actual Position3D.

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

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

Overloading of operator != for Position3D.

Parameters
pPos2the second Position3D
Position3D AL::Math::Position3D::operator* ( float  pVal) const

Overloading of operator * for Position3D.

Parameters
pValthe float factor
Position3D& AL::Math::Position3D::operator*= ( float  pVal)

Overloading of operator *= for Position3D.

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

Overloading of operator + for Position3D.

Parameters
pPos2the second Position3D

Definition at line 119 of file alposition3d.h.

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

Overloading of operator + for Position3D.

Definition at line 136 of file alposition3d.h.

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

Overloading of operator += for Position3D.

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

Overloading of operator - for Position3D.

Parameters
pPos2the second Position3D

Definition at line 128 of file alposition3d.h.

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

Overloading of operator - for Position3D.

Definition at line 144 of file alposition3d.h.

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

Overloading of operator -= for Position3D.

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

Overloading of operator / for Position3D.

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

Overloading of operator /= for Position3D.

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

Overloading of operator == for Position3D.

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

Return the Position3D as a vector of float [x, y, z].

Member Data Documentation

float AL::Math::Position3D::x

Definition at line 25 of file alposition3d.h.

float AL::Math::Position3D::y

Definition at line 27 of file alposition3d.h.

float AL::Math::Position3D::z

Definition at line 29 of file alposition3d.h.


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