Vector2i Class Reference

Generic integer x, y vector. More...

#include <math/gzmath.hh>

Public Member Functions

 Vector2i ()
 Constructor. More...
 
 Vector2i (const int &_x, const int &_y)
 Constructor. More...
 
 Vector2i (const Vector2i &_pt)
 Copy constructor. More...
 
 Vector2i (const ignition::math::Vector2i &_pt)
 Copy constructor for ignition math. More...
 
virtual ~Vector2i ()
 Destructor. More...
 
Vector2i Cross (const Vector2i &_pt) const
 Return the cross product of this vector and _pt. More...
 
int Distance (const Vector2i &_pt) const
 Calc distance to the given point. More...
 
ignition::math::Vector2i Ign () const
 Convert this vector to ignition::math::Vector2i. 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 Vector2i &_v) const
 Equality operators. More...
 
const Vector2i operator* (const Vector2i &_v) const
 Multiplication operator. More...
 
const Vector2i operator* (int _v) const
 Multiplication operator. More...
 
const Vector2ioperator*= (const Vector2i &_v)
 Multiplication operators. More...
 
const Vector2ioperator*= (int _v)
 Multiplication operator. More...
 
Vector2i operator+ (const Vector2i &_v) const
 Addition operator. More...
 
const Vector2ioperator+= (const Vector2i &_v)
 Addition assignment operator. More...
 
Vector2i operator- (const Vector2i &_v) const
 Subtraction operator. More...
 
const Vector2ioperator-= (const Vector2i &_v)
 Subtraction operators. More...
 
const Vector2i operator/ (const Vector2i &_v) const
 Division operator. More...
 
const Vector2i operator/ (int _v) const
 Division operator. More...
 
const Vector2ioperator/= (const Vector2i &_v)
 Division operator. More...
 
const Vector2ioperator/= (int _v)
 Division operator. More...
 
Vector2ioperator= (const Vector2i &_v)
 Assignment operator. More...
 
Vector2ioperator= (const ignition::math::Vector2i &_v)
 Assignment operator for ignition math. More...
 
const Vector2ioperator= (int _value)
 Assignment operator. More...
 
bool operator== (const Vector2i &_v) const
 Equality operator. More...
 
int operator[] (unsigned int _index) const
 Array subscript operator. More...
 
void Set (int _x, int _y)
 Set the contents of the vector. More...
 

Public Attributes

int x
 x data More...
 
int y
 y data More...
 

Friends

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

Detailed Description

Generic integer x, y vector.

Constructor & Destructor Documentation

Vector2i ( )

Constructor.

Vector2i ( const int &  _x,
const int &  _y 
)

Constructor.

Parameters
[in]_xvalue along x
[in]_yvalue along y
Vector2i ( const Vector2i _pt)

Copy constructor.

Parameters
[in]_pta point
Vector2i ( const ignition::math::Vector2i &  _pt)

Copy constructor for ignition math.

Parameters
[in]_pta point
virtual ~Vector2i ( )
virtual

Destructor.

Member Function Documentation

Vector2i Cross ( const Vector2i _pt) const

Return the cross product of this vector and _pt.

Parameters
[in]_ptthe other vector
Returns
the product
int Distance ( const Vector2i _pt) const

Calc distance to the given point.

Parameters
[in]_pta point
Returns
the distance
ignition::math::Vector2i Ign ( ) const

Convert this vector to ignition::math::Vector2i.

Returns
Return an ignition::math::Vector2i representation of this vector.
bool IsFinite ( ) const

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

Returns
the result
void Normalize ( )

Normalize the vector length.

bool operator!= ( const Vector2i _v) const

Equality operators.

Parameters
_vthe vector to compare with
Returns
true if component have different values, false otherwise
const Vector2i operator* ( const Vector2i _v) const

Multiplication operator.

Remarks
this is an element wise multiplication
Parameters
[in]_vthe vector
Returns
the result
const Vector2i operator* ( int  _v) const

Multiplication operator.

Parameters
[in]_vthe scaling factor
Returns
the result
const Vector2i& operator*= ( const Vector2i _v)

Multiplication operators.

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

Multiplication operator.

Parameters
[in]_vscaling factor
Returns
this
Vector2i operator+ ( const Vector2i _v) const

Addition operator.

Parameters
[in]_vthe vector to add
Returns
the sum vector
const Vector2i& operator+= ( const Vector2i _v)

Addition assignment operator.

Parameters
[in]_vthe vector to add
Returns
this
Vector2i operator- ( const Vector2i _v) const

Subtraction operator.

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

Subtraction operators.

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

Division operator.

Remarks
this is an element wise division.
Parameters
[in]_vthe vector to divide
Returns
the result
const Vector2i operator/ ( int  _v) const

Division operator.

Remarks
this is an element wise division.
Parameters
[in]_vthe vector to divide
Returns
the result
const Vector2i& operator/= ( const Vector2i _v)

Division operator.

Remarks
this is an element wise division.
Parameters
[in]_vthe vector to divide
Returns
this
const Vector2i& operator/= ( int  _v)

Division operator.

Remarks
this is an element wise division.
Parameters
[in]_vthe vector to divide
Returns
this
Vector2i& operator= ( const Vector2i _v)

Assignment operator.

Parameters
[in]_vthe value
Returns
this
Vector2i& operator= ( const ignition::math::Vector2i &  _v)

Assignment operator for ignition math.

Parameters
[in]_vthe value
Returns
this
const Vector2i& operator= ( int  _value)

Assignment operator.

Parameters
[in]_valuethe value for x and y
Returns
this
bool operator== ( const Vector2i _v) const

Equality operator.

Parameters
_vthe vector to compare with
Returns
true if component have the same values, false otherwise
int operator[] ( unsigned int  _index) const

Array subscript operator.

Parameters
[in]_indexthe array index
void Set ( int  _x,
int  _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::Vector2i _pt 
)
friend

Stream insertion operator.

Parameters
[in]_outoutput stream
[in]ptVector2i to output
Returns
the stream
std::istream& operator>> ( std::istream &  _in,
gazebo::math::Vector2i _pt 
)
friend

Stream extraction operator.

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

Member Data Documentation

int x

x data

int y

y data


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