KDL 1.5.1
Loading...
Searching...
No Matches
KDL::Vector Class Reference

A concrete implementation of a 3 dimensional vector class. More...

#include <src/frames.hpp>

Public Member Functions

 Vector ()
 Does not initialise the Vector to zero. use Vector::Zero() or SetToZero for that.
 
 Vector (double x, double y, double z)
 Constructs a vector out of the three values x, y and z.
 
 Vector (const Vector &arg)
 Assignment operator. The normal copy by value semantics.
 
Vectoroperator= (const Vector &arg)
 Assignment operator. The normal copy by value semantics.
 
double operator() (int index) const
 Access to elements, range checked when NDEBUG is not set, from 0..2.
 
double & operator() (int index)
 Access to elements, range checked when NDEBUG is not set, from 0..2.
 
double operator[] (int index) const
 Equivalent to double operator()(int index) const.
 
double & operator[] (int index)
 Equivalent to double& operator()(int index)
 
double x () const
 
double y () const
 
double z () const
 
void x (double)
 
void y (double)
 
void z (double)
 
void ReverseSign ()
 Reverses the sign of the Vector object itself.
 
Vectoroperator-= (const Vector &arg)
 subtracts a vector from the Vector object itself
 
Vectoroperator+= (const Vector &arg)
 Adds a vector from the Vector object itself.
 
double Normalize (double eps=epsilon)
 Normalizes this vector and returns it norm makes v a unitvector and returns the norm of v.
 
double Norm (double eps=epsilon) const
 
void Set2DXY (const Vector2 &v)
 a 3D vector where the 2D vector v is put in the XY plane
 
void Set2DYZ (const Vector2 &v)
 a 3D vector where the 2D vector v is put in the YZ plane
 
void Set2DZX (const Vector2 &v)
 a 3D vector where the 2D vector v is put in the ZX plane
 
void Set2DPlane (const Frame &F_someframe_XY, const Vector2 &v_XY)
 a 3D vector where the 2D vector v_XY is put in the XY plane of the frame F_someframe_XY.
 

Static Public Member Functions

static Vector Zero ()
 

Public Attributes

double data [3]
 

Friends

class Rotation
 
class Frame
 
Vector operator* (const Vector &lhs, double rhs)
 Scalar multiplication is defined.
 
Vector operator* (double lhs, const Vector &rhs)
 Scalar multiplication is defined.
 
Vector operator/ (const Vector &lhs, double rhs)
 Scalar division is defined.
 
Vector operator+ (const Vector &lhs, const Vector &rhs)
 
Vector operator- (const Vector &lhs, const Vector &rhs)
 
Vector operator* (const Vector &lhs, const Vector &rhs)
 
Vector operator- (const Vector &arg)
 
double dot (const Vector &lhs, const Vector &rhs)
 
void SetToZero (Vector &v)
 To have a uniform operator to put an element to zero, for scalar values and for objects.
 
bool Equal (const Vector &a, const Vector &b, double eps=epsilon)
 do not use operator == because the definition of Equal(.,.) is slightly different.
 
bool operator== (const Vector &a, const Vector &b)
 The literal equality operator==(), also identical.
 
bool operator!= (const Vector &a, const Vector &b)
 The literal inequality operator!=().
 

Detailed Description

A concrete implementation of a 3 dimensional vector class.

Constructor & Destructor Documentation

◆ Vector() [1/3]

KDL::Vector::Vector ( )
inline

Does not initialise the Vector to zero. use Vector::Zero() or SetToZero for that.

References data.

Referenced by Normalize().

◆ Vector() [2/3]

IMETHOD Vector::Vector ( double x,
double y,
double z )
inline

Constructs a vector out of the three values x, y and z.

◆ Vector() [3/3]

IMETHOD Vector::Vector ( const Vector & arg)
inline

Assignment operator. The normal copy by value semantics.

Member Function Documentation

◆ Norm()

double KDL::Vector::Norm ( double eps = epsilon) const
Returns
the norm of the vector

References data.

Referenced by KDL::Path_RoundedComposite::Add(), KDL::Rotation::GetRotAngle(), Normalize(), and KDL::Path_Line::Path_Line().

◆ Normalize()

double KDL::Vector::Normalize ( double eps = epsilon)

Normalizes this vector and returns it norm makes v a unitvector and returns the norm of v.

if v is smaller than eps, Vector(1,0,0) is returned with norm 0. if this is not good, check the return value of this method.

References Norm(), and Vector().

Referenced by KDL::Path_RoundedComposite::Add(), KDL::Rotation::GetRotAngle(), KDL::Path_Circle::Path_Circle(), KDL::Path_Line::Path_Line(), KDL::Path_Line::Path_Line(), and KDL::Rotation::Rot().

◆ operator()() [1/2]

double & Vector::operator() ( int index)
inline

Access to elements, range checked when NDEBUG is not set, from 0..2.

◆ operator()() [2/2]

double Vector::operator() ( int index) const
inline

Access to elements, range checked when NDEBUG is not set, from 0..2.

Referenced by operator[](), and operator[]().

◆ operator+=()

Vector & Vector::operator+= ( const Vector & arg)
inline

Adds a vector from the Vector object itself.

◆ operator-=()

Vector & Vector::operator-= ( const Vector & arg)
inline

subtracts a vector from the Vector object itself

◆ operator=()

IMETHOD Vector & Vector::operator= ( const Vector & arg)
inline

Assignment operator. The normal copy by value semantics.

◆ operator[]() [1/2]

double & KDL::Vector::operator[] ( int index)
inline

Equivalent to double& operator()(int index)

References operator()().

◆ operator[]() [2/2]

double KDL::Vector::operator[] ( int index) const
inline

Equivalent to double operator()(int index) const.

References operator()().

◆ ReverseSign()

void Vector::ReverseSign ( )
inline

Reverses the sign of the Vector object itself.

◆ Set2DPlane()

void Vector::Set2DPlane ( const Frame & F_someframe_XY,
const Vector2 & v_XY )
inline

a 3D vector where the 2D vector v_XY is put in the XY plane of the frame F_someframe_XY.

◆ Set2DXY()

void Vector::Set2DXY ( const Vector2 & v)
inline

a 3D vector where the 2D vector v is put in the XY plane

◆ Set2DYZ()

void Vector::Set2DYZ ( const Vector2 & v)
inline

a 3D vector where the 2D vector v is put in the YZ plane

◆ Set2DZX()

void Vector::Set2DZX ( const Vector2 & v)
inline

a 3D vector where the 2D vector v is put in the ZX plane

◆ x() [1/2]

IMETHOD double Vector::x ( ) const
inline

◆ x() [2/2]

IMETHOD void Vector::x ( double _x)
inline

◆ y() [1/2]

IMETHOD double Vector::y ( ) const
inline

◆ y() [2/2]

IMETHOD void Vector::y ( double _y)
inline

◆ z() [1/2]

IMETHOD double Vector::z ( ) const
inline

◆ z() [2/2]

IMETHOD void Vector::z ( double _z)
inline

◆ Zero()

Friends And Related Symbol Documentation

◆ dot

double dot ( const Vector & lhs,
const Vector & rhs )
friend

◆ Equal

bool Equal ( const Vector & a,
const Vector & b,
double eps = epsilon )
friend

do not use operator == because the definition of Equal(.,.) is slightly different.

It compares whether the 2 arguments are equal in an eps-interval

◆ Frame

friend class Frame
friend

◆ operator!=

bool operator!= ( const Vector & a,
const Vector & b )
friend

The literal inequality operator!=().

◆ operator* [1/3]

Vector operator* ( const Vector & lhs,
const Vector & rhs )
friend

◆ operator* [2/3]

Vector operator* ( const Vector & lhs,
double rhs )
friend

Scalar multiplication is defined.

◆ operator* [3/3]

Vector operator* ( double lhs,
const Vector & rhs )
friend

Scalar multiplication is defined.

◆ operator+

Vector operator+ ( const Vector & lhs,
const Vector & rhs )
friend

◆ operator- [1/2]

Vector operator- ( const Vector & arg)
friend

◆ operator- [2/2]

Vector operator- ( const Vector & lhs,
const Vector & rhs )
friend

◆ operator/

Vector operator/ ( const Vector & lhs,
double rhs )
friend

Scalar division is defined.

◆ operator==

bool operator== ( const Vector & a,
const Vector & b )
friend

The literal equality operator==(), also identical.

◆ Rotation

friend class Rotation
friend

◆ SetToZero

void SetToZero ( Vector & v)
friend

To have a uniform operator to put an element to zero, for scalar values and for objects.

Member Data Documentation

◆ data


The documentation for this class was generated from the following files: