SLIP
1.4
|
This is a Vector2d struct. It is a specialization of kvector. It implements some peculiar 2d operations. More...
#include <Vector2d.hpp>
Public Types | |
typedef Vector2d< T > | self |
typedef T | value_type |
typedef value_type * | pointer |
typedef const value_type * | const_pointer |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef ptrdiff_t | difference_type |
typedef std::size_t | size_type |
typedef pointer | iterator |
typedef const_pointer | const_iterator |
typedef const kvector< T, N > | const_self |
typedef slip::stride_iterator < pointer > | iterator_range |
typedef slip::stride_iterator < const_pointer > | const_iterator_range |
typedef std::reverse_iterator < iterator > | reverse_iterator |
typedef std::reverse_iterator < const_iterator > | const_reverse_iterator |
typedef std::reverse_iterator < iterator_range > | reverse_iterator_range |
typedef std::reverse_iterator < const_iterator_range > | const_reverse_iterator_range |
typedef slip::lin_alg_traits < value_type >::value_type | norm_type |
typedef iterator | default_iterator |
typedef const_iterator | const_default_iterator |
Public Member Functions | |
std::string | name () const |
Returns the name of the class. More... | |
size_type | size () const |
Returns the number of elements in the kvector. More... | |
size_type | max_size () const |
Returns the maximal size (number of elements) in the kvector. More... | |
bool | empty () const |
Returns true if the kvector is empty. (Thus size == 0) More... | |
void | swap (kvector &x) |
Swaps data with another kvector. More... | |
Constructors | |
Vector2d () | |
Default constructor init all the components to 0. More... | |
Vector2d (const T &val) | |
Constructor init all the components to val. More... | |
Vector2d (const T &x1, const T &x2) | |
Constructor init all the components to val. More... | |
Vector2d (const T *val) | |
Constructor init the Vector2d with the val array. More... | |
Vector2d (const Vector2d< T > &rhs) | |
Copy constructor init the Vector2d with another Vector2d. More... | |
Arithmetic operators | |
self | operator- () const |
Computes the oposite of a Vector2d. More... | |
Mathematical operators | |
T | angle () const |
Computes the angle with the cartesian axis. The result is between the range [-PI,PI]. More... | |
T | angle_degree () const |
Computes the angle with the cartesian axis. The result is between the range [-360,360]. More... | |
Accessors | |
const T & | get_x1 () const |
Accessor to the first dimension value of the Vector2d. More... | |
const T & | get_x () const |
Accessor to the first dimension value of the Vector2d. More... | |
const T & | u () const |
Accessor to the first dimension value of the Vector2d. More... | |
const T & | get_x2 () const |
Accessor to the second dimension value of the Vector2d. More... | |
const T & | get_y () const |
Accessor to the second dimension value of the Vector2d. More... | |
const T & | v () const |
Accessor to the second dimension value of the Vector2d. More... | |
void | set_x1 (const T &x1) |
Mutator of the first dimension value of the Vector2d. More... | |
void | set_x (const T &r) |
Mutator of the first dimension value of the Vector2d. More... | |
void | u (const T &u_) |
Mutator of the first dimension value of the Vector2d. More... | |
void | set_x2 (const T &x2) |
Mutator of the second dimension value of the Vector2d. More... | |
void | set_y (const T &g) |
Mutator of the second dimension value of the Vector2d. More... | |
void | v (const T &v_) |
Mutator of the second dimension value of the Vector2d. More... | |
void | set (const T &x1, const T &x2) |
Mutator of the three dimension values of the Vector2d. More... | |
iterators | |
iterator | begin () |
Returns a read/write iterator that points to the first element in the kvector. Iteration is done in ordinary element order. More... | |
const_iterator | begin () const |
Returns a read-only (constant) iterator that points to the first element in the kvector. Iteration is done in ordinary element order. More... | |
iterator_range | begin (const slip::Range< int > &range) |
Returns a read/write iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range. More... | |
const_iterator_range | begin (const slip::Range< int > &range) const |
Returns a read-only (constant) iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range. More... | |
iterator | end () |
Returns a read/write iterator that points one past the last element in the kvector. Iteration is done in ordinary element order. More... | |
const_iterator | end () const |
Returns a read-only (constant) iterator that points one past the last element in the kvector. Iteration is done in ordinary element order. More... | |
iterator_range | end (const slip::Range< int > &range) |
Returns a read/write iterator_range that points one past the last element in the kvector. Iteration is done in ordinary element order according to the Range. More... | |
const_iterator_range | end (const slip::Range< int > &range) const |
Returns a read-only (constant) iterator_range that points one past the last element in the kvector. Iteration is done in ordinary element order according to the Range. More... | |
reverse_iterator | rbegin () |
Returns a read/write reverse iterator that points to the last element in the kvector. Iteration is done in reverse element order. More... | |
const_reverse_iterator | rbegin () const |
Returns a read-only (constant) reverse iterator that points to the last element in the kvector. Iteration is done in reverse element order. More... | |
reverse_iterator_range | rbegin (const slip::Range< int > &range) |
Returns a read/write reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range. More... | |
const_reverse_iterator_range | rbegin (const slip::Range< int > &range) const |
Returns a read-only (constant) reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range. More... | |
reverse_iterator | rend () |
Returns a read/write reverse iterator that points to one before the first element in the kvector. Iteration is done in reverse element order. More... | |
const_reverse_iterator | rend () const |
Returns a read-only (constant) reverse iterator that points to one before the first element in the kvector. Iteration is done in reverse element order. More... | |
reverse_iterator_range | rend (const slip::Range< int > &range) |
Returns a read/write reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range. More... | |
const_reverse_iterator_range | rend (const slip::Range< int > &range) const |
Returns a read-only (constant) reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range. More... | |
Assignment methods | |
void | fill (const T &value) |
Fills the container range [begin(),begin()+N) with copies of value. More... | |
void | fill (const T *value) |
Fills the container range [begin(),begin()+N) with a copy of the value array. More... | |
void | fill (InputIterator first, InputIterator last) |
Fills the container range [begin(),begin()+N) with a copy of the range [first,last) More... | |
Element access operators | |
reference | operator[] (const size_type n) |
Subscript access to the data contained in the kvector. More... | |
const_reference | operator[] (const size_type n) const |
Subscript access to the data contained in the kvector. More... | |
reference | operator() (const size_type n) |
Subscript access to the data contained in the kvector. More... | |
const_reference | operator() (const size_type n) const |
Subscript access to the data contained in the kvector. More... | |
Arithmetic operators | |
self & | operator+= (const T &val) |
Add val to each element of the kvector. More... | |
self & | operator+= (const self &rhs) |
self & | operator-= (const T &val) |
self & | operator-= (const self &rhs) |
self & | operator*= (const T &val) |
self & | operator*= (const self &rhs) |
self & | operator/= (const T &val) |
self & | operator/= (const self &rhs) |
Mathematical operators | |
T & | min () |
Returns the min element of the kvector according to the operator <, if T is std::complex, it returns the element of minimum magnitude. More... | |
T & | max () |
Returns the max element of the kvector according to the operator >, if T is std::complex, it returns the element of maximum magnitude. More... | |
T | sum () const |
Returns the sum of the elements of the kvector. More... | |
norm_type | Euclidean_norm () const |
Returns the Euclidean norm ![]() | |
norm_type | L2_norm () const |
Returns the Euclidean norm ![]() | |
norm_type | L1_norm () const |
Returns the L1 norm ( ![]() | |
norm_type | L22_norm () const |
Returns the L22 norm ( ![]() | |
norm_type | infinite_norm () const |
Returns the infinite norm ( ![]() | |
Real | dot (const self &other) |
Computes the dot product with another kvector other. More... | |
kvector< T, N > & | apply (T(*fun)(T)) |
Applys the one-parameter C-function fun to each element of the kvector. More... | |
kvector< T, N > & | apply (T(*fun)(const T &)) |
Applys the one-parameter C-function fun to each element of the kvector. More... | |
Public Attributes | |
T | data [N] |
Data array storage of the kvector. More... | |
Static Public Attributes | |
static const std::size_t | SIZE |
static const std::size_t | DIM |
Friends | |
class | boost::serialization::access |
Comparison operators | |
bool | operator< (const Vector2d< T > &x, const Vector2d< T > &y) |
Less Compare operator. More... | |
bool | operator> (const Vector2d< T > &x, const Vector2d< T > &y) |
Greater Compare operator. More... | |
bool | operator<= (const Vector2d< T > &x, const Vector2d< T > &y) |
Less equal Compare operator. More... | |
bool | operator> (const Vector2d< T > &x, const Vector2d< T > &y) |
Greater equal Compare operator. More... | |
This is a Vector2d struct. It is a specialization of kvector. It implements some peculiar 2d operations.
T | Type of the Vector2d |
Definition at line 99 of file Vector2d.hpp.
|
inherited |
Definition at line 178 of file KVector.hpp.
typedef const_pointer slip::Vector2d< T >::const_iterator |
Definition at line 139 of file Vector2d.hpp.
|
inherited |
Definition at line 165 of file KVector.hpp.
typedef const value_type* slip::Vector2d< T >::const_pointer |
Definition at line 131 of file Vector2d.hpp.
typedef const value_type& slip::Vector2d< T >::const_reference |
Definition at line 133 of file Vector2d.hpp.
|
inherited |
Definition at line 168 of file KVector.hpp.
|
inherited |
Definition at line 171 of file KVector.hpp.
|
inherited |
Definition at line 152 of file KVector.hpp.
|
inherited |
Definition at line 177 of file KVector.hpp.
typedef ptrdiff_t slip::Vector2d< T >::difference_type |
Definition at line 135 of file Vector2d.hpp.
typedef pointer slip::Vector2d< T >::iterator |
Definition at line 138 of file Vector2d.hpp.
|
inherited |
Definition at line 164 of file KVector.hpp.
|
inherited |
Definition at line 173 of file KVector.hpp.
typedef value_type* slip::Vector2d< T >::pointer |
Definition at line 130 of file Vector2d.hpp.
typedef value_type& slip::Vector2d< T >::reference |
Definition at line 132 of file Vector2d.hpp.
|
inherited |
Definition at line 167 of file KVector.hpp.
|
inherited |
Definition at line 170 of file KVector.hpp.
typedef Vector2d<T> slip::Vector2d< T >::self |
Definition at line 128 of file Vector2d.hpp.
typedef std::size_t slip::Vector2d< T >::size_type |
Definition at line 136 of file Vector2d.hpp.
typedef T slip::Vector2d< T >::value_type |
Definition at line 129 of file Vector2d.hpp.
|
inline |
Default constructor init all the components to 0.
Definition at line 407 of file Vector2d.hpp.
|
inline |
Constructor init all the components to val.
val | initial value |
Definition at line 414 of file Vector2d.hpp.
|
inline |
Constructor init all the components to val.
x1 | initial value of the first vector2d dimension |
x2 | initial value of the second vector2d dimension |
Definition at line 421 of file Vector2d.hpp.
|
inline |
Constructor init the Vector2d with the val array.
val | initial value |
Definition at line 430 of file Vector2d.hpp.
|
inline |
Copy constructor init the Vector2d with another Vector2d.
rhs | The other Vector2d |
Definition at line 439 of file Vector2d.hpp.
|
inline |
Computes the angle with the cartesian axis. The result is between the range [-PI,PI].
Definition at line 456 of file Vector2d.hpp.
|
inline |
Computes the angle with the cartesian axis. The result is between the range [-360,360].
Definition at line 463 of file Vector2d.hpp.
|
inlineinherited |
Applys the one-parameter C-function fun to each element of the kvector.
fun | The one-parameter C function |
Definition at line 906 of file KVector.hpp.
|
inlineinherited |
Applys the one-parameter C-function fun to each element of the kvector.
fun | The one-const-parameter C function |
Definition at line 927 of file KVector.hpp.
|
inlineinherited |
Returns a read/write iterator that points to the first element in the kvector. Iteration is done in ordinary element order.
Definition at line 196 of file KVector.hpp.
|
inlineinherited |
Returns a read-only (constant) iterator that points to the first element in the kvector. Iteration is done in ordinary element order.
Definition at line 207 of file KVector.hpp.
|
inlineinherited |
Returns a read/write iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range.
range. | Range to iterate. |
Definition at line 248 of file KVector.hpp.
|
inlineinherited |
Returns a read-only (constant) iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range.
range. | Range to iterate. |
Definition at line 276 of file KVector.hpp.
|
inlineinherited |
Computes the dot product with another kvector other.
other. | Other Kvector. |
Definition at line 885 of file KVector.hpp.
|
inlineinherited |
Returns true if the kvector is empty. (Thus size == 0)
Definition at line 779 of file KVector.hpp.
|
inlineinherited |
Returns a read/write iterator that points one past the last element in the kvector. Iteration is done in ordinary element order.
Definition at line 217 of file KVector.hpp.
|
inlineinherited |
Returns a read-only (constant) iterator that points one past the last element in the kvector. Iteration is done in ordinary element order.
Definition at line 227 of file KVector.hpp.
|
inlineinherited |
Returns a read/write iterator_range that points one past the last element in the kvector. Iteration is done in ordinary element order according to the Range.
range. | Range to iterate. |
Definition at line 303 of file KVector.hpp.
|
inlineinherited |
Returns a read-only (constant) iterator_range that points one past the last element in the kvector. Iteration is done in ordinary element order according to the Range.
range. | Range to iterate. |
Definition at line 326 of file KVector.hpp.
|
inlineinherited |
Returns the Euclidean norm of the elements of the kvector.
Definition at line 832 of file KVector.hpp.
|
inlineinherited |
Fills the container range [begin(),begin()+N) with copies of value.
value | A reference-to-const of arbitrary type. |
Definition at line 521 of file KVector.hpp.
|
inlineinherited |
Fills the container range [begin(),begin()+N) with a copy of the value array.
value | A pointer of arbitrary type. |
Definition at line 531 of file KVector.hpp.
|
inlineinherited |
Fills the container range [begin(),begin()+N) with a copy of the range [first,last)
first | An input iterator. |
last | An input iterator. |
Definition at line 545 of file KVector.hpp.
|
inline |
Accessor to the first dimension value of the Vector2d.
Definition at line 514 of file Vector2d.hpp.
|
inline |
Accessor to the first dimension value of the Vector2d.
Definition at line 510 of file Vector2d.hpp.
|
inline |
Accessor to the second dimension value of the Vector2d.
Definition at line 523 of file Vector2d.hpp.
|
inline |
Accessor to the second dimension value of the Vector2d.
Definition at line 527 of file Vector2d.hpp.
|
inlineinherited |
Returns the infinite norm ( ) of the elements of the kvector.
Definition at line 873 of file KVector.hpp.
|
inlineinherited |
Returns the L1 norm ( ) of the elements of the kvector.
Definition at line 853 of file KVector.hpp.
|
inlineinherited |
Returns the L22 norm ( ) of the elements of the kvector.
Definition at line 863 of file KVector.hpp.
|
inlineinherited |
Returns the Euclidean norm of the elements of the kvector.
Definition at line 842 of file KVector.hpp.
|
inlineinherited |
Returns the max element of the kvector according to the operator >, if T is std::complex, it returns the element of maximum magnitude.
Definition at line 812 of file KVector.hpp.
|
inlineinherited |
Returns the maximal size (number of elements) in the kvector.
Definition at line 771 of file KVector.hpp.
|
inlineinherited |
Returns the min element of the kvector according to the operator <, if T is std::complex, it returns the element of minimum magnitude.
Definition at line 800 of file KVector.hpp.
|
inline |
Returns the name of the class.
Definition at line 750 of file Vector2d.hpp.
|
inlineinherited |
Subscript access to the data contained in the kvector.
n | The index of the element for which data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
Definition at line 659 of file KVector.hpp.
|
inlineinherited |
Subscript access to the data contained in the kvector.
n | The index of the element for which data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
Definition at line 673 of file KVector.hpp.
|
inlineinherited |
Definition at line 699 of file KVector.hpp.
|
inlineinherited |
Definition at line 739 of file KVector.hpp.
|
inlineinherited |
Add val to each element of the kvector.
val | value |
Definition at line 687 of file KVector.hpp.
|
inlineinherited |
Definition at line 725 of file KVector.hpp.
|
inline |
Computes the oposite of a Vector2d.
Definition at line 446 of file Vector2d.hpp.
|
inlineinherited |
Definition at line 693 of file KVector.hpp.
|
inlineinherited |
Definition at line 732 of file KVector.hpp.
|
inlineinherited |
Definition at line 705 of file KVector.hpp.
|
inlineinherited |
Definition at line 746 of file KVector.hpp.
|
inlineinherited |
Subscript access to the data contained in the kvector.
n | The index of the element for which data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
Definition at line 633 of file KVector.hpp.
|
inlineinherited |
Subscript access to the data contained in the kvector.
n | The index of the element for which data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
Definition at line 646 of file KVector.hpp.
|
inlineinherited |
Returns a read/write reverse iterator that points to the last element in the kvector. Iteration is done in reverse element order.
Definition at line 340 of file KVector.hpp.
|
inlineinherited |
Returns a read-only (constant) reverse iterator that points to the last element in the kvector. Iteration is done in reverse element order.
Definition at line 350 of file KVector.hpp.
|
inlineinherited |
Returns a read/write reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range.
range. | Range to iterate. |
Definition at line 392 of file KVector.hpp.
|
inlineinherited |
Returns a read-only (constant) reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range.
range. | Range to iterate. |
Definition at line 415 of file KVector.hpp.
|
inlineinherited |
Returns a read/write reverse iterator that points to one before the first element in the kvector. Iteration is done in reverse element order.
Definition at line 360 of file KVector.hpp.
|
inlineinherited |
Returns a read-only (constant) reverse iterator that points to one before the first element in the kvector. Iteration is done in reverse element order.
Definition at line 371 of file KVector.hpp.
|
inlineinherited |
Returns a read/write reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range.
range. | Range to iterate. |
Definition at line 438 of file KVector.hpp.
|
inlineinherited |
Returns a read-only (constant) reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range.
range. | Range to iterate. |
Definition at line 461 of file KVector.hpp.
|
inline |
Mutator of the three dimension values of the Vector2d.
Definition at line 561 of file Vector2d.hpp.
|
inline |
Mutator of the first dimension value of the Vector2d.
r | the first dimension value of the Vector2d |
Definition at line 540 of file Vector2d.hpp.
|
inline |
Mutator of the first dimension value of the Vector2d.
x1 | the first dimension value of the Vector2d |
Definition at line 536 of file Vector2d.hpp.
|
inline |
Mutator of the second dimension value of the Vector2d.
x2 | the second dimension value of the Vector2d |
Definition at line 549 of file Vector2d.hpp.
|
inline |
Mutator of the second dimension value of the Vector2d.
g | the second dimension value of the Vector2d |
Definition at line 553 of file Vector2d.hpp.
|
inlineinherited |
Returns the number of elements in the kvector.
Definition at line 766 of file KVector.hpp.
|
inlineinherited |
Returns the sum of the elements of the kvector.
Definition at line 822 of file KVector.hpp.
|
inlineinherited |
Swaps data with another kvector.
x | A kvector of the same element type |
Definition at line 785 of file KVector.hpp.
|
inline |
Accessor to the first dimension value of the Vector2d.
Definition at line 518 of file Vector2d.hpp.
|
inline |
Mutator of the first dimension value of the Vector2d.
u_ | the first dimension value of the Vector2d |
Definition at line 544 of file Vector2d.hpp.
|
inline |
Accessor to the second dimension value of the Vector2d.
Definition at line 531 of file Vector2d.hpp.
|
inline |
Mutator of the second dimension value of the Vector2d.
v_ | the second dimension value of the Vector2d |
Definition at line 557 of file Vector2d.hpp.
|
friend |
Definition at line 366 of file Vector2d.hpp.
Less Compare operator.
x | first Vector2d to compare |
y | second Vector2d to compare return true if ||x|| < ||y||, ||.|| is the Euclidean norm |
Definition at line 472 of file Vector2d.hpp.
Less equal Compare operator.
x | first Vector2d to compare |
y | second Vector2d to compare return true if ||x|| <= ||y||, ||.|| is the Euclidean norm |
Definition at line 493 of file Vector2d.hpp.
Greater Compare operator.
x | first Vector2d to compare |
y | second Vector2d to compare return true if ||x|| > ||y||, ||.|| is the Euclidean norm |
Definition at line 485 of file Vector2d.hpp.
Greater equal Compare operator.
x | first Vector2d to compare |
y | second Vector2d to compare return true if ||x|| >= ||y||, ||.|| is the Euclidean norm |
x | first Vector2d to compare |
y | second Vector2d to compare return true if ||x|| > ||y||, ||.|| is the Euclidean norm |
Definition at line 485 of file Vector2d.hpp.
|
inherited |
Data array storage of the kvector.
Definition at line 935 of file KVector.hpp.
|
staticinherited |
Definition at line 181 of file KVector.hpp.
|
staticinherited |
Definition at line 180 of file KVector.hpp.