RobWorkProject
23.9.11-
|
A 2D vector \( \mathbf{v}\in \mathbb{R}^2 \). More...
#include <Vector2D.hpp>
Public Types | |
typedef Eigen::Matrix< T, 2, 1 > | EigenVector2D |
Eigen based Vector2D. | |
typedef T | value_type |
Value type. | |
Public Member Functions | |
Vector2D () | |
Creates a 2D vector initialized with 0's. | |
Vector2D (T x, T y) | |
Creates a 2D vector. More... | |
template<class R > | |
Vector2D (const Eigen::MatrixBase< R > &r) | |
Creates a 2D vector from Eigen Vector. More... | |
Vector2D (const Vector2D< T > ©) | |
Copy Constructor. | |
EigenVector2D | e () const |
Returns Eigen vector equivalent to *this. | |
size_t | size () const |
The dimension of the vector (i.e. 2). More... | |
const T & | operator() (size_t i) const |
Returns reference to vector element. More... | |
T & | operator() (size_t i) |
Returns reference to vector element. More... | |
const T & | operator[] (size_t i) const |
Returns reference to vector element. More... | |
T & | operator[] (size_t i) |
Returns reference to vector element. More... | |
const Vector2D< T > | operator/ (T s) const |
Scalar division. | |
const Vector2D< T > | operator* (T s) const |
Scalar multiplication. | |
const Vector2D< T > | operator- (const Vector2D< T > &b) const |
Vector subtraction. | |
const Vector2D< T > | operator+ (const Vector2D< T > &b) const |
Vector addition. | |
Vector2D< T > & | operator*= (T s) |
Scalar multiplication. | |
Vector2D< T > & | operator/= (T s) |
Scalar division. | |
Vector2D< T > & | operator+= (const Vector2D< T > &v) |
Vector addition. | |
Vector2D< T > & | operator-= (const Vector2D< T > &v) |
Vector subtraction. | |
const Vector2D< T > | operator- () const |
Unary minus. | |
bool | operator== (const Vector2D< T > &b) const |
Compares a and b for equality. More... | |
bool | operator!= (const Vector2D< T > &b) const |
Compares a and b for inequality. More... | |
double | angle () const |
returns the counter clock-wise angle between this vector and the x-axis vector (1,0). The angle returned will be in the interval [-Pi,Pi] | |
T | norm2 () const |
Returns the Euclidean norm (2-norm) of the vector. More... | |
T | norm1 () const |
Returns the Manhatten norm (1-norm) of the vector. More... | |
T | normInf () const |
Returns the infinte norm ( \(\inf\)-norm) of the vector. More... | |
Friends | |
const Vector2D< T > | operator* (T s, const Vector2D< T > &v) |
Scalar multiplication. | |
std::ostream & | operator<< (std::ostream &out, const Vector2D< T > &v) |
Streaming operator. | |
Related Functions | |
(Note that these are not member functions.) | |
template<> | |
void | write (const rw::math::Vector2D< double > &sobject, rw::common::OutputArchive &oarchive, const std::string &id) |
template<> | |
void | write (const rw::math::Vector2D< float > &sobject, rw::common::OutputArchive &oarchive, const std::string &id) |
template<> | |
void | read (rw::math::Vector2D< double > &sobject, rw::common::InputArchive &iarchive, const std::string &id) |
template<> | |
void | read (rw::math::Vector2D< float > &sobject, rw::common::InputArchive &iarchive, const std::string &id) |
template<class Archive , class T > | |
void | serialize (Archive &archive, rw::math::Vector2D< T > &vector, const unsigned int version) |
Boost serialization. More... | |
A 2D vector \( \mathbf{v}\in \mathbb{R}^2 \).
\( \robabx{i}{j}{\mathbf{v}} = \left[ \begin{array}{c} v_x \\ v_y \end{array} \right] \)
In addition, Vector2D supports the cross product operator: v3 = cross(v1, v2)
Usage example:
|
inline |
Creates a 2D vector.
x | [in] \( x \) |
y | [in] \( y \) |
|
inline |
|
inline |
Returns the Manhatten norm (1-norm) of the vector.
|
inline |
Returns the Euclidean norm (2-norm) of the vector.
|
inline |
Returns the infinte norm ( \(\inf\)-norm) of the vector.
|
inline |
Compares a and b for inequality.
b | [in] |
|
inline |
Returns reference to vector element.
i | [in] index in the vector \(i\in \{0,1\} \) |
|
inline |
Returns reference to vector element.
i | [in] index in the vector \(i\in \{0,1\} \) |
|
inline |
Compares a and b for equality.
b | [in] |
|
inline |
Returns reference to vector element.
i | [in] index in the vector \(i\in \{0,1,2\} \) |
|
inline |
Returns reference to vector element.
i | [in] index in the vector \(i\in \{0,1,2\} \) |
|
inline |
The dimension of the vector (i.e. 2).
This method is provided to help support generic algorithms using size() and operator[].
|
related |
Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.
sobject | [out] the object in which the data should be streamed into |
iarchive | [in] the InputArchive from which to read data. |
id | [in] The id of the serialized sobject. |
|
related |
Enable read-serialization of class T by overloading this method. Data is read from iarchive and filled into sobject.
sobject | [out] the object in which the data should be streamed into |
iarchive | [in] the InputArchive from which to read data. |
id | [in] The id of the serialized sobject. |
|
related |
Boost serialization.
archive | [in] the boost archive to read from or write to. |
vector | [in/out] the vector to read/write. |
version | [in] class version (currently version 0). |
|
related |
Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.
sobject | [in] the object from which the data should be streamed. |
oarchive | [out] the OutputArchive in which data should be written. |
id | [in] The id of the serialized sobject. |
|
related |
Enable write-serialization of class T by overloading this method. Data is written to oarchive from the sobject.
sobject | [in] the object from which the data should be streamed. |
oarchive | [out] the OutputArchive in which data should be written. |
id | [in] The id of the serialized sobject. |