|
libpsynth 0.2.1
|
A bidimensional vector type that can hold any scalar type. More...
#include <vector_2d.hpp>

Public Member Functions | |
| vector_2d (T _x=0, T _y=0) | |
| Constructor which sets the components of the vector. | |
| void | set (T _x, T _y) |
| Sets the components of the vector. | |
| T & | operator[] (size_t index) |
| Accesses the components of the vector by index. | |
| const T & | operator[] (size_t index) const |
| Accesses the components of the vector by index. | |
| T | distance (const vector_2d &v) const |
| Returns the distance between this vector and another one. | |
| T | sqr_distance (const vector_2d &v) const |
| Returns the squared distance between this vector and another one. | |
| T | length () const |
| Returns the length of the vector. | |
| T | sqr_length () const |
| Returns the length of the vector. | |
Public Attributes | |
| T | x |
| X axis component of the vector. | |
| T | y |
| Y axis component of the vector. | |
A bidimensional vector type that can hold any scalar type.
| psynth::base::vector_2d< T >::vector_2d | ( | T | _x = 0, |
| T | _y = 0 |
||
| ) | [inline] |
Constructor which sets the components of the vector.
| _x | The X axis component of the vector. |
| _x | The Y axis component of the vector. |
| T psynth::base::vector_2d< T >::distance | ( | const vector_2d< T > & | v | ) | const [inline] |
Returns the distance between this vector and another one.
| v | The other vector. |
| T psynth::base::vector_2d< T >::length | ( | ) | const [inline] |
Returns the length of the vector.
| T& psynth::base::vector_2d< T >::operator[] | ( | size_t | index | ) | [inline] |
Accesses the components of the vector by index.
The X axis has index 0 and the the Y axis has index 1.
| const T& psynth::base::vector_2d< T >::operator[] | ( | size_t | index | ) | const [inline] |
Accesses the components of the vector by index.
The X axis has index 0 and the the Y axis has index 1. Const version.
| void psynth::base::vector_2d< T >::set | ( | T | _x, |
| T | _y | ||
| ) | [inline] |
Sets the components of the vector.
| _x | The X axis component of the vector. |
| _x | The Y axis component of the vector. |
| T psynth::base::vector_2d< T >::sqr_distance | ( | const vector_2d< T > & | v | ) | const [inline] |
Returns the squared distance between this vector and another one.
For better efficiency, use this version of the function if you want the distance only for comparison and do not mind about its real value.
| v | The other vector. |
| T psynth::base::vector_2d< T >::sqr_length | ( | ) | const [inline] |
Returns the length of the vector.
For better efficiency, use this version of the function if you want the length only for comparison and do not mind about its real value.
| T psynth::base::vector_2d< T >::x |
X axis component of the vector.
| T psynth::base::vector_2d< T >::y |
Y axis component of the vector.
1.7.4