2D geometric vector More...
Public Member Functions | |
geom_vector () | |
Constructor initializing each element to the value 0. | |
geom_vector (element_type const &v_x, element_type const &v_y) | |
element_type & | x () |
Returns x coordinate's value. More... | |
element_type & | y () |
Returns y coordinate's value. More... | |
element_type | x () const |
Returns a copy of the x coordinate's value. More... | |
element_type | y () const |
Returns a copy of the y coordinate's value. More... | |
template<int N> | |
element_type | get () const |
Returns the Nth coordinate's value with tuple interface. More... | |
template<int N> | |
void | set (element_type const &value) |
Set the Nth coordinate's value with tuple interface. More... | |
bool | operator== (geom_vector const &coords) const |
Coordinate-wise comparison of 2 geometric vectors. More... | |
geom_vector & | operator= (geom_vector const &coords) |
Assign coordinates with those of another vector coords . More... | |
geom_vector & | operator= (element_type const &val) |
Assign coordinates with a value val . More... | |
geom_vector & | operator+= (geom_vector const &coords) |
Add to coordinates those of another vector coords . More... | |
geom_vector & | operator-= (geom_vector const &coords) |
Subtract from the coordinates those of another vector coords . More... | |
geom_vector & | operator*= (element_type const &a) |
Multiply coordinates with a value a . More... | |
geom_vector & | operator/= (element_type const &a) |
Divide coordinates with a value a . More... | |
bool | operator< (geom_vector const &other) const |
'Less than' comparison with another vector. This comparator lexicographically compares the coordinates of the vectors. More... | |
element_type | dot (geom_vector const &other) const |
Perform a dot product with another vector other . More... | |
void | normalize (element_type const &n=1.0) |
Normalize vector to a value n . More... | |
Public Types | |
typedef ELEMENT | element_type |
2D geometric vector
ELEMENT | type of elements stored in vector. |
Template specialization for 2D.
stapl::geom_vector< 2, ELEMENT >::geom_vector | ( | element_type const & | v_x, |
element_type const & | v_y | ||
) |
v_x | x coordinate's value. |
v_y | y coordinate's value. |
element_type& stapl::geom_vector< 2, ELEMENT >::x | ( | ) |
Returns x coordinate's value.
element_type& stapl::geom_vector< 2, ELEMENT >::y | ( | ) |
Returns y coordinate's value.
element_type stapl::geom_vector< 2, ELEMENT >::x | ( | ) | const |
Returns a copy of the x coordinate's value.
element_type stapl::geom_vector< 2, ELEMENT >::y | ( | ) | const |
Returns a copy of the y coordinate's value.
element_type stapl::geom_vector< 2, ELEMENT >::get | ( | ) | const |
Returns the Nth coordinate's value with tuple interface.
void stapl::geom_vector< 2, ELEMENT >::set | ( | element_type const & | value | ) |
Set the Nth coordinate's value with tuple interface.
Nth | coordinate's value. |
bool stapl::geom_vector< 2, ELEMENT >::operator== | ( | geom_vector< 2, ELEMENT > const & | coords | ) | const |
Coordinate-wise comparison of 2 geometric vectors.
coords | vector tested for equality. |
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator= | ( | geom_vector< 2, ELEMENT > const & | coords | ) |
Assign coordinates with those of another vector coords
.
coords | vector whose elements are used in assigment. |
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator= | ( | element_type const & | val | ) |
Assign coordinates with a value val
.
val | value. |
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator+= | ( | geom_vector< 2, ELEMENT > const & | coords | ) |
Add to coordinates those of another vector coords
.
coords | vector whose elements are used in the addition. |
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator-= | ( | geom_vector< 2, ELEMENT > const & | coords | ) |
Subtract from the coordinates those of another vector coords
.
coords | vector whose elements are used in the subtraction. |
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator*= | ( | element_type const & | a | ) |
Multiply coordinates with a value a
.
a | value. |
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator/= | ( | element_type const & | a | ) |
Divide coordinates with a value a
.
a | value. |
bool stapl::geom_vector< 2, ELEMENT >::operator< | ( | geom_vector< 2, ELEMENT > const & | other | ) | const |
'Less than' comparison with another vector. This comparator lexicographically compares the coordinates of the vectors.
other | the vector provided for comparison. |
element_type stapl::geom_vector< 2, ELEMENT >::dot | ( | geom_vector< 2, ELEMENT > const & | other | ) | const |
Perform a dot product with another vector other
.
other | the vector provided for the dot product. |
void stapl::geom_vector< 2, ELEMENT >::normalize | ( | element_type const & | n = 1.0 | ) |
Normalize vector to a value n
.
n | value. |