Vector2d Class Reference

Generic double x, y vector. More...

#include <Vector2d.hh>

Public Member Functions

 Vector2d ()
 Constructor. More...
 
 Vector2d (const double &_x, const double &_y)
 Constructor. More...
 
 Vector2d (const Vector2d &_v)
 Copy constructor. More...
 
 Vector2d (const ignition::math::Vector2d &_v)
 Copy constructor for ignition math. More...
 
virtual ~Vector2d ()
 Destructor. More...
 
double Distance (const Vector2d &_pt) const
 Calc distance to the given point. More...
 
double Dot (const Vector2d &_v) const
 Return the dot product of this vector and _v. More...
 
ignition::math::Vector2d Ign () const
 Convert this vector to an ignition::math::Vector2d. More...
 
bool IsFinite () const
 See if a point is finite (e.g., not nan) More...
 
void Normalize ()
 Normalize the vector length. More...
 
bool operator!= (const Vector2d &_v) const
 Not equal to operator. More...
 
const Vector2d operator* (const Vector2d &_v) const
 Multiplication operators. More...
 
const Vector2d operator* (double _v) const
 Multiplication operators. More...
 
const Vector2doperator*= (const Vector2d &_v)
 Multiplication assignment operator. More...
 
const Vector2doperator*= (double _v)
 Multiplication assignment operator. More...
 
Vector2d operator+ (const Vector2d &_v) const
 Addition operator. More...
 
const Vector2doperator+= (const Vector2d &_v)
 Addition assignment operator. More...
 
Vector2d operator- (const Vector2d &_v) const
 Subtraction operator. More...
 
const Vector2doperator-= (const Vector2d &_v)
 Subtraction assignment operator. More...
 
const Vector2d operator/ (const Vector2d &_v) const
 Division operator. More...
 
const Vector2d operator/ (double _v) const
 Division operator. More...
 
const Vector2doperator/= (const Vector2d &_v)
 Division operator. More...
 
const Vector2doperator/= (double _v)
 Division operator. More...
 
Vector2doperator= (const Vector2d &_v)
 Assignment operator. More...
 
Vector2doperator= (const ignition::math::Vector2d &_v)
 Assignment operator for ignition math. More...
 
const Vector2doperator= (double _v)
 Assignment operator. More...
 
bool operator== (const Vector2d &_v) const
 Equal to operator. More...
 
double operator[] (unsigned int _index) const
 Array subscript operator. More...
 
void Set (double _x, double _y)
 Set the contents of the vector. More...
 

Public Attributes

double x
 x data More...
 
double y
 y data More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const gazebo::math::Vector2d &_pt)
 Stream extraction operator. More...
 
std::istream & operator>> (std::istream &_in, gazebo::math::Vector2d &_pt)
 Stream extraction operator. More...
 

Detailed Description

Generic double x, y vector.

Constructor & Destructor Documentation

Vector2d ( )

Constructor.

Vector2d ( const double &  _x,
const double &  _y 
)

Constructor.

Parameters
[in]_xvalue along x
[in]_yvalue along y
Vector2d ( const Vector2d _v)

Copy constructor.

Parameters
[in]_vthe value
Vector2d ( const ignition::math::Vector2d &  _v)

Copy constructor for ignition math.

Parameters
[in]_vthe value
virtual ~Vector2d ( )
virtual

Destructor.

Member Function Documentation

double Distance ( const Vector2d _pt) const

Calc distance to the given point.

Parameters
[in]_ptThe point to measure to
Returns
the distance
double Dot ( const Vector2d _v) const

Return the dot product of this vector and _v.

Parameters
[in]_vthe vector
Returns
the dot product
ignition::math::Vector2d Ign ( ) const

Convert this vector to an ignition::math::Vector2d.

Returns
This vector as an ignition::math::Vector2d.
bool IsFinite ( ) const

See if a point is finite (e.g., not nan)

Returns
true if finite, false otherwise
void Normalize ( )

Normalize the vector length.

bool operator!= ( const Vector2d _v) const

Not equal to operator.

Returns
true if elements are of diffent values (tolerence 1e-6)
const Vector2d operator* ( const Vector2d _v) const

Multiplication operators.

Parameters
[in]_vthe vector
Returns
the result
const Vector2d operator* ( double  _v) const

Multiplication operators.

Parameters
[in]_vthe scaling factor
Returns
a scaled vector
const Vector2d& operator*= ( const Vector2d _v)

Multiplication assignment operator.

Remarks
this is an element wise multiplication
Parameters
[in]_vthe vector
Returns
this
const Vector2d& operator*= ( double  _v)

Multiplication assignment operator.

Parameters
[in]_vthe scaling factor
Returns
a scaled vector
Vector2d operator+ ( const Vector2d _v) const

Addition operator.

Parameters
[in]_vvector to add
Returns
sum vector
const Vector2d& operator+= ( const Vector2d _v)

Addition assignment operator.

Parameters
[in]_vthe vector to add
Vector2d operator- ( const Vector2d _v) const

Subtraction operator.

Parameters
[in]_vthe vector to substract
Returns
the subtracted vector
const Vector2d& operator-= ( const Vector2d _v)

Subtraction assignment operator.

Parameters
[in]_vthe vector to substract
Returns
this
const Vector2d operator/ ( const Vector2d _v) const

Division operator.

Remarks
this is an element wise division
Parameters
[in]_va vector
Returns
a result
const Vector2d operator/ ( double  _v) const

Division operator.

Parameters
[in]_vthe value
Returns
a vector
const Vector2d& operator/= ( const Vector2d _v)

Division operator.

Remarks
this is an element wise division
Parameters
[in]_va vector
Returns
this
const Vector2d& operator/= ( double  _v)

Division operator.

Parameters
[in]_vthe divisor
Returns
a vector
Vector2d& operator= ( const Vector2d _v)

Assignment operator.

Parameters
[in]_va value for x and y element
Returns
this
Vector2d& operator= ( const ignition::math::Vector2d &  _v)

Assignment operator for ignition math.

Parameters
[in]_va value for x and y element
Returns
this
const Vector2d& operator= ( double  _v)

Assignment operator.

Parameters
[in]_vthe value for x and y element
Returns
this
bool operator== ( const Vector2d _v) const

Equal to operator.

Parameters
[in]_vthe vector to compare to
Returns
true if the elements of the 2 vectors are equal within a tolerence (1e-6)
double operator[] ( unsigned int  _index) const

Array subscript operator.

Parameters
[in]_indexthe index
Returns
the value, or 0 if _index is out of bounds
void Set ( double  _x,
double  _y 
)

Set the contents of the vector.

Parameters
[in]_xvalue along x
[in]_yvalue along y

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  _out,
const gazebo::math::Vector2d _pt 
)
friend

Stream extraction operator.

Parameters
[in]_outoutput stream
[in]_ptVector2d to output
Returns
The stream
std::istream& operator>> ( std::istream &  _in,
gazebo::math::Vector2d _pt 
)
friend

Stream extraction operator.

Parameters
[in]_ininput stream
[in]_ptVector3 to read values into
Returns
The stream

Member Data Documentation

double x

x data

double y

y data


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