Public Member Functions | Public Attributes | Friends | List of all members
gazebo::math::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...
 
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...
 
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...
 
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

gazebo::math::Vector2d::Vector2d ( )

Constructor.

gazebo::math::Vector2d::Vector2d ( const double &  _x,
const double &  _y 
)

Constructor.

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

Copy constructor.

Parameters
[in]_vthe value
virtual gazebo::math::Vector2d::~Vector2d ( )
virtual

Destructor.

Member Function Documentation

double gazebo::math::Vector2d::Distance ( const Vector2d _pt) const

Calc distance to the given point.

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

Return the dot product of this vector and _v.

Parameters
[in]_vthe vector
Returns
the dot product
bool gazebo::math::Vector2d::IsFinite ( ) const

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

Returns
true if finite, false otherwise
void gazebo::math::Vector2d::Normalize ( )

Normalize the vector length.

bool gazebo::math::Vector2d::operator!= ( const Vector2d _v) const

Not equal to operator.

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

Multiplication operators.

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

Multiplication operators.

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

Multiplication assignment operator.

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

Multiplication assignment operator.

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

Addition operator.

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

Addition assignment operator.

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

Subtraction operator.

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

Subtraction assignment operator.

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

Division operator.

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

Division operator.

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

Division operator.

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

Division operator.

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

Assignment operator.

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

Assignment operator.

Parameters
[in]_vthe value for x and y element
Returns
this
bool gazebo::math::Vector2d::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 gazebo::math::Vector2d::operator[] ( unsigned int  _index) const

Array subscript operator.

Parameters
[in]_indexthe index
Returns
the value, or 0 if _index is out of bounds
void gazebo::math::Vector2d::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 gazebo::math::Vector2d::x

x data

double gazebo::math::Vector2d::y

y data


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