|
Fawkes API
Fawkes Development Version
|
A simple column vector. More...
#include <>>
Public Member Functions | |
| Vector (unsigned int size=3, float *elems=0, bool manage_memory=true) | |
| Constructor. | |
| Vector (const Vector &v) | |
| Copy constructor. | |
| virtual | ~Vector () |
| Destructor. | |
| unsigned int | size () const |
| Get the number of elements. | |
| void | set_size (unsigned int size) |
| Set a new size. | |
| float * | data_ptr () |
| Get pointer to the internal data container. | |
| const float * | data_ptr () const |
| Get pointer to the internal data container. | |
| float | get (unsigned int d) const |
| Get a certain element. | |
| float & | get (unsigned int d) |
| Get a reference to a certain element. | |
| void | set (unsigned int d, float v) |
| Set a certain element. | |
| float | x () const |
| Convenience getter to obtain the first element. | |
| float & | x () |
| Convenience getter to obtain a reference to the first element. | |
| void | x (float x) |
| Convenience setter to set the first element. | |
| float | y () const |
| Convenience getter to obtain the second element. | |
| float & | y () |
| Convenience getter to obtain a reference to the second element. | |
| void | y (float y) |
| Convenience setter to set the second element. | |
| float | z () const |
| Convenience getter to obtain the third element. | |
| float & | z () |
| Convenience getter to obtain a reference to the third element. | |
| void | z (float z) |
| Convenience setter to set the third element. | |
| float | operator[] (unsigned int d) const |
| Access operator. | |
| float & | operator[] (unsigned int d) |
| Access operator. | |
| Vector | operator* (const float &f) const |
| Multiply the vector with a scalar. | |
| Vector & | operator*= (const float &f) |
| In-place scalar multiplication. | |
| Vector | operator/ (const float &f) const |
| Divide every element of the vector by a scalar. | |
| Vector & | operator/= (const float &f) |
| In-place scalar division. | |
| float | operator* (const Vector &v) const |
| Calculates the dot product of two vectors. | |
| Vector | operator+ (const Vector &v) const |
| Adds two vectors. | |
| Vector & | operator+= (const Vector &v) |
| In-place vector addition. | |
| Vector | operator- (const Vector &v) const |
| Substract two vectors. | |
| Vector & | operator-= (const Vector &v) |
| In-place vector substraction. | |
| Vector & | operator= (const Vector &v) |
| Assignment operator. | |
| bool | operator== (const Vector &v) |
| Comparison operator. | |
| void | print_info (const char *name=0) const |
| Prints the vector data to standard out. | |
Friends | |
| std::ostream & | operator<< (std::ostream &stream, const Vector &v) |
| Appends the components of the Vector to the ostream. | |
| fawkes::Vector::Vector | ( | unsigned int | size = 3, |
| float * | data = 0, |
||
| bool | manage_memory = true |
||
| ) |
Constructor.
| size | the dimension of the vector |
| data | pointer to a float array |
| manage_memory | if true, the Vector will manage its memory on its own, else it will not allocate new memory but works with the provided array |
Definition at line 60 of file vector.cpp.
References size().
| fawkes::Vector::Vector | ( | const Vector & | v | ) |
|
virtual |
Destructor.
Definition at line 99 of file vector.cpp.
|
inline |
Get pointer to the internal data container.
Definition at line 41 of file vector.h.
Referenced by fawkes::Matrix::operator*().
|
inline |
| float fawkes::Vector::get | ( | unsigned int | d | ) | const |
Get a certain element.
| d | index of the requested element |
Definition at line 146 of file vector.cpp.
Referenced by operator*(), fawkes::operator<<(), fawkes::HomCoord::w(), fawkes::HomCoord::x(), fawkes::HomCoord::y(), and fawkes::HomCoord::z().
| float & fawkes::Vector::get | ( | unsigned int | d | ) |
Get a reference to a certain element.
| d | index of the requested element |
Definition at line 159 of file vector.cpp.
| Vector fawkes::Vector::operator* | ( | const float & | f | ) | const |
Multiply the vector with a scalar.
| f | the scalar |
Definition at line 307 of file vector.cpp.
| float fawkes::Vector::operator* | ( | const Vector & | v | ) | const |
Calculates the dot product of two vectors.
| v | the rhs Vector |
Definition at line 497 of file vector.cpp.
References get().
| Vector & fawkes::Vector::operator*= | ( | const float & | f | ) |
In-place scalar multiplication.
| f | the scalar |
Definition at line 322 of file vector.cpp.
Adds two vectors.
| cv | the vector to be added |
Definition at line 363 of file vector.cpp.
References size().
In-place vector addition.
| cv | the vector to be added |
Definition at line 382 of file vector.cpp.
References size().
Substract two vectors.
| cv | the vector to be substracted |
Definition at line 399 of file vector.cpp.
References size().
In-place vector substraction.
| cv | the vector to be substracted |
Definition at line 418 of file vector.cpp.
References size().
| Vector fawkes::Vector::operator/ | ( | const float & | f | ) | const |
Divide every element of the vector by a scalar.
| f | the scalar |
Definition at line 335 of file vector.cpp.
| Vector & fawkes::Vector::operator/= | ( | const float & | f | ) |
In-place scalar division.
| f | the scalar |
Definition at line 350 of file vector.cpp.
Assignment operator.
| v | the rhs vector |
Definition at line 435 of file vector.cpp.
| bool fawkes::Vector::operator== | ( | const Vector & | v | ) |
Comparison operator.
| v | the other vector |
Definition at line 459 of file vector.cpp.
| float fawkes::Vector::operator[] | ( | unsigned int | d | ) | const |
Access operator.
| d | index of the requested element |
Definition at line 277 of file vector.cpp.
| float & fawkes::Vector::operator[] | ( | unsigned int | d | ) |
Access operator.
| d | index of the requested element |
Definition at line 290 of file vector.cpp.
| void fawkes::Vector::print_info | ( | const char * | name = 0 | ) | const |
Prints the vector data to standard out.
| name | a string that is printed prior to the vector data |
Definition at line 478 of file vector.cpp.
| void fawkes::Vector::set | ( | unsigned int | d, |
| float | f | ||
| ) |
Set a certain element.
| d | index of the element |
| f | the new value |
Definition at line 176 of file vector.cpp.
Referenced by firevision::ProjectiveCam::get_GPA_image_coord(), fawkes::HomCoord::HomCoord(), fawkes::HomCoord::w(), fawkes::HomCoord::x(), fawkes::HomCoord::y(), and fawkes::HomCoord::z().
| void fawkes::Vector::set_size | ( | unsigned int | size | ) |
Set a new size.
| size | the new size |
Definition at line 120 of file vector.cpp.
References size().
| unsigned int fawkes::Vector::size | ( | ) | const |
Get the number of elements.
Definition at line 111 of file vector.cpp.
Referenced by fawkes::Matrix::operator*(), operator+(), operator+=(), operator-(), operator-=(), set_size(), and Vector().
| float fawkes::Vector::x | ( | ) | const |
Convenience getter to obtain the first element.
Definition at line 192 of file vector.cpp.
Referenced by firevision::ProjectiveCam::get_GPA_image_coord(), firevision::ProjectiveCam::get_GPA_world_coord(), fawkes::OpenRaveEnvironment::rotate_object(), and x().
| float & fawkes::Vector::x | ( | ) |
Convenience getter to obtain a reference to the first element.
Definition at line 201 of file vector.cpp.
| void fawkes::Vector::x | ( | float | x | ) |
Convenience setter to set the first element.
| x | the new value of the first element |
Definition at line 211 of file vector.cpp.
References x().
| float fawkes::Vector::y | ( | ) | const |
Convenience getter to obtain the second element.
Definition at line 220 of file vector.cpp.
Referenced by firevision::ProjectiveCam::get_GPA_image_coord(), firevision::ProjectiveCam::get_GPA_world_coord(), fawkes::OpenRaveEnvironment::rotate_object(), and y().
| float & fawkes::Vector::y | ( | ) |
Convenience getter to obtain a reference to the second element.
Definition at line 229 of file vector.cpp.
| void fawkes::Vector::y | ( | float | y | ) |
Convenience setter to set the second element.
| y | the new value of the second element |
Definition at line 239 of file vector.cpp.
References y().
| float fawkes::Vector::z | ( | ) | const |
Convenience getter to obtain the third element.
Definition at line 248 of file vector.cpp.
Referenced by firevision::ProjectiveCam::get_GPA_image_coord(), firevision::ProjectiveCam::get_GPA_world_coord(), fawkes::OpenRaveEnvironment::rotate_object(), and z().
| float & fawkes::Vector::z | ( | ) |
Convenience getter to obtain a reference to the third element.
Definition at line 257 of file vector.cpp.
| void fawkes::Vector::z | ( | float | z | ) |
Convenience setter to set the third element.
| z | the new value of the third element |
Definition at line 267 of file vector.cpp.
References z().
|
friend |
Appends the components of the Vector to the ostream.
| stream | the input stream |
| v | the vector to be appended |
| stream | the input stream |
| v | the vector to be appended |
Definition at line 513 of file vector.cpp.