STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types
stapl::geom_vector< 2, ELEMENT > Class Template Reference

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_vectoroperator= (geom_vector const &coords)
 Assign coordinates with those of another vector coords. More...
 
geom_vectoroperator= (element_type const &val)
 Assign coordinates with a value val. More...
 
geom_vectoroperator+= (geom_vector const &coords)
 Add to coordinates those of another vector coords. More...
 
geom_vectoroperator-= (geom_vector const &coords)
 Subtract from the coordinates those of another vector coords. More...
 
geom_vectoroperator*= (element_type const &a)
 Multiply coordinates with a value a. More...
 
geom_vectoroperator/= (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
 

Detailed Description

template<typename ELEMENT>
class stapl::geom_vector< 2, ELEMENT >

2D geometric vector

Template Parameters
ELEMENTtype of elements stored in vector.

Template specialization for 2D.

Constructor & Destructor Documentation

◆ geom_vector()

template<typename ELEMENT >
stapl::geom_vector< 2, ELEMENT >::geom_vector ( element_type const &  v_x,
element_type const &  v_y 
)
Parameters
v_xx coordinate's value.
v_yy coordinate's value.

Member Function Documentation

◆ x() [1/2]

template<typename ELEMENT >
element_type& stapl::geom_vector< 2, ELEMENT >::x ( )

Returns x coordinate's value.

Returns
x coordinate's value.

◆ y() [1/2]

template<typename ELEMENT >
element_type& stapl::geom_vector< 2, ELEMENT >::y ( )

Returns y coordinate's value.

Returns
y coordinate's value.

◆ x() [2/2]

template<typename ELEMENT >
element_type stapl::geom_vector< 2, ELEMENT >::x ( ) const

Returns a copy of the x coordinate's value.

Returns
copy of the x coordinate's value.

◆ y() [2/2]

template<typename ELEMENT >
element_type stapl::geom_vector< 2, ELEMENT >::y ( ) const

Returns a copy of the y coordinate's value.

Returns
copy of the y coordinate's value.

◆ get()

template<typename ELEMENT >
template<int N>
element_type stapl::geom_vector< 2, ELEMENT >::get ( ) const

Returns the Nth coordinate's value with tuple interface.

Returns
Nth coordinate's value.

◆ set()

template<typename ELEMENT >
template<int N>
void stapl::geom_vector< 2, ELEMENT >::set ( element_type const &  value)

Set the Nth coordinate's value with tuple interface.

Parameters
Nthcoordinate's value.

◆ operator==()

template<typename ELEMENT >
bool stapl::geom_vector< 2, ELEMENT >::operator== ( geom_vector< 2, ELEMENT > const &  coords) const

Coordinate-wise comparison of 2 geometric vectors.

Parameters
coordsvector tested for equality.
Returns
true if geometric vectors are equal.

◆ operator=() [1/2]

template<typename ELEMENT >
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator= ( geom_vector< 2, ELEMENT > const &  coords)

Assign coordinates with those of another vector coords.

Parameters
coordsvector whose elements are used in assigment.
Returns
this geometric vector.

◆ operator=() [2/2]

template<typename ELEMENT >
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator= ( element_type const &  val)

Assign coordinates with a value val.

Parameters
valvalue.
Returns
this geometric vector.

◆ operator+=()

template<typename ELEMENT >
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator+= ( geom_vector< 2, ELEMENT > const &  coords)

Add to coordinates those of another vector coords.

Parameters
coordsvector whose elements are used in the addition.
Returns
this geometric vector.

◆ operator-=()

template<typename ELEMENT >
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator-= ( geom_vector< 2, ELEMENT > const &  coords)

Subtract from the coordinates those of another vector coords.

Parameters
coordsvector whose elements are used in the subtraction.
Returns
this geometric vector.

◆ operator*=()

template<typename ELEMENT >
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator*= ( element_type const &  a)

Multiply coordinates with a value a.

Parameters
avalue.
Returns
this geometric vector.

◆ operator/=()

template<typename ELEMENT >
geom_vector& stapl::geom_vector< 2, ELEMENT >::operator/= ( element_type const &  a)

Divide coordinates with a value a.

Parameters
avalue.
Returns
this geometric vector.

◆ operator<()

template<typename ELEMENT >
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.

Parameters
otherthe vector provided for comparison.
Returns
true if this vector is less than the vector provided.

◆ dot()

template<typename ELEMENT >
element_type stapl::geom_vector< 2, ELEMENT >::dot ( geom_vector< 2, ELEMENT > const &  other) const

Perform a dot product with another vector other.

Parameters
otherthe vector provided for the dot product.
Returns
value of the dot product..

◆ normalize()

template<typename ELEMENT >
void stapl::geom_vector< 2, ELEMENT >::normalize ( element_type const &  n = 1.0)

Normalize vector to a value n.

Parameters
nvalue.

The documentation for this class was generated from the following file: