- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# OpenMesh::VectorT< Scalar, N > Class Template Reference

A vector is an array of `N` values of type `Scalar`. More...

`#include <OpenMesh/Core/Math/VectorT.hh>`

Inheritance diagram for OpenMesh::VectorT< Scalar, N >:

List of all members.

## Public Types
typedef Scalar | value_type
| the type of the scalar used in this template
typedef VectorT< Scalar, N > | vector_type
| type of this vector
## Public Member Functions
| VectorT ()
| default constructor creates uninitialized values.
| VectorT (const Scalar &v)
| special constructor for 1D vectors
| VectorT (const Scalar &v0, const Scalar &v1)
| special constructor for 2D vectors
| VectorT (const Scalar &v0, const Scalar &v1, const Scalar &v2)
| special constructor for 3D vectors
| VectorT (const Scalar &v0, const Scalar &v1, const Scalar &v2, const Scalar &v3)
| special constructor for 4D vectors
| VectorT (const Scalar &v0, const Scalar &v1, const Scalar &v2, const Scalar &v3, const Scalar &v4)
| special constructor for 5D vectors
| VectorT (const Scalar &v0, const Scalar &v1, const Scalar &v2, const Scalar &v3, const Scalar &v4, const Scalar &v5)
| special constructor for 6D vectors
| VectorT (const Scalar _values[N])
| construct from a value array (explicit)
template<typename otherScalarType>
| VectorT (const VectorT< otherScalarType, N > &_rhs)
| copy & cast constructor (explicit)
template<typename otherScalarType>
vector_type & | operator= (const VectorT< otherScalarType, N > &_rhs)
| cast from vector with a different scalar type
Scalar * | data ()
| access to Scalar array
const Scalar * | data () const
| access to const Scalar array
Scalar & | operator[] (size_t _i)
| get i'th element read-write
const Scalar & | operator[] (size_t _i) const
| get i'th element read-only
bool | operator== (const vector_type &_rhs) const
| component-wise comparison
bool | operator!= (const vector_type &_rhs) const
| component-wise comparison
vector_type & | operator *= (const Scalar &_s)
| component-wise self-multiplication with scalar
vector_type & | operator/= (const Scalar &_s)
| component-wise self-division by scalar
vector_type | operator * (const Scalar &_s) const
| component-wise multiplication with scalar
vector_type | operator/ (const Scalar &_s) const
| component-wise division by with scalar
vector_type & | operator *= (const vector_type &_rhs)
| component-wise self-multiplication
vector_type & | operator/= (const vector_type &_rhs)
| component-wise self-division
vector_type & | operator-= (const vector_type &_rhs)
| vector difference from this
vector_type & | operator+= (const vector_type &_rhs)
| vector self-addition
vector_type | operator * (const vector_type &_v) const
| component-wise vector multiplication
vector_type | operator/ (const vector_type &_v) const
| component-wise vector division
vector_type | operator+ (const vector_type &_v) const
| component-wise vector addition
vector_type | operator- (const vector_type &_v) const
| component-wise vector difference
vector_type | operator- (void) const
| unary minus
VectorT< Scalar, 3 > | operator% (const VectorT< Scalar, 3 > &_rhs) const
| cross product: only defined for Vec3* as specialization
Scalar | operator| (const vector_type &_rhs) const
| compute scalar product
vector_type & | normalize ()
| normalize vector, return normalized vector
Scalar | max () const
| return the maximal component
Scalar | min () const
| return the minimal component
Scalar | mean () const
| return arithmetic mean
vector_type & | minimize (const vector_type &_rhs)
| minimize values: same as *this = min(*this, _rhs), but faster
vector_type & | maximize (const vector_type &_rhs)
| maximize values: same as *this = max(*this, _rhs), but faster
vector_type | min (const vector_type &_rhs)
| component-wise min
vector_type | max (const vector_type &_rhs)
| component-wise max
template<typename Functor>
vector_type | apply (const Functor &_func) const
| component-wise apply function object with Scalar operator()(Scalar).
vector_type & | vectorize (const Scalar &_s)
| store the same value in each component (e.g. to clear all entries)
bool | operator< (const vector_type &_rhs) const
| lexicographical comparison
Euclidean norm calculations
Scalar | norm () const
| compute euclidean norm
Scalar | length () const
| compute euclidean norm
Scalar | sqrnorm () const
| compute squared euclidean norm
## Static Public Member Functions
static int | dim ()
| returns dimension of the vector (deprecated)
static size_t | size ()
| returns dimension of the vector
static vector_type | vectorized (const Scalar &_s)
| store the same value in each component
## Related Functions
(Note that these are not member functions.)
VectorT< Scalar, N > | operator * (Scalar _s, const VectorT< Scalar, N > &_v)
| scalar * vector
Scalar | dot (const VectorT< Scalar, N > &_v1, const VectorT< Scalar, N > &_v2)
| symmetric version of the dot product
VectorT< Scalar, N > | cross (const VectorT< Scalar, N > &_v1, const VectorT< Scalar, N > &_v2)
| symmetric version of the cross product

## Detailed Description

### template<typename Scalar, int N>
class OpenMesh::VectorT< Scalar, N >

A vector is an array of `N` values of type `Scalar`.

The actual data is stored in an VectorDataT, this class just adds the necessary operators.

## Member Function Documentation

template<typename Scalar, int N>

vector_type& OpenMesh::VectorT< Scalar, N >::operator/= | ( | const Scalar & | _s | ) | `[inline]`

component-wise self-division by scalar

Attention:
  v *= (1/_s) is much faster than this

template<typename Scalar, int N>

VectorT<Scalar,3> OpenMesh::VectorT< Scalar, N >::operator% | ( | const VectorT< Scalar, 3 > & | _rhs | ) | const`[inline]`

cross product: only defined for Vec3* as specialization

See also:
  OpenMesh::cross

template<typename Scalar, int N>

Scalar OpenMesh::VectorT< Scalar, N >::operator| | ( | const vector_type & | _rhs | ) | const`[inline]`

compute scalar product

See also:
  OpenMesh::dot

template<typename Scalar, int N>

vector_type& OpenMesh::VectorT< Scalar, N >::normalize | ( |  | ) | `[inline]`

normalize vector, return normalized vector

Attention:
  avoids div by zero only in debug mode

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

- Core/Math/VectorT.hh