Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Attributes | List of all members
om::math::VectorND< T, dimension > Class Template Reference

A class that represents a vector of a fixed arbitrary number of components. More...

#include <omVectorND.h>

Public Member Functions

 VectorND ()
 Create a vector with all of its elements equal to zero. More...
 
 VectorND (T value)
 Create a new vector with all elements equal to a single value. More...
 
 VectorND (const T array[dimension])
 Create a vector with elements from the specified array. More...
 
getMagnitude () const
 Get the magnitude of the vector. More...
 
getMagnitudeSquared () const
 Get the squared magnitude of the vector. More...
 
VectorND normalize () const
 Return a a normalized version of this vector. More...
 
VectorND projectOn (const VectorND &v) const
 Project this vector onto another vector. More...
 
getDistanceTo (const VectorND &v) const
 Get the distance between the this vector and another. More...
 
getDistanceToSquared (const VectorND &v) const
 Get the squared distance between the this vector and another. More...
 
const T * toArray () const
 Return an array representation of this vector. More...
 
T & get (Index i)
 Return a reference to the element at the specified index in the vector. More...
 
const T & get (Index i) const
 Return a const reference to the element at the specified index in the vector. More...
 
T & operator() (Index i)
 Return a reference to the element at the specified index in the vector. More...
 
const T & operator() (Index i) const
 Return const a reference to the element at the specified index in the vector. More...
 
T & operator[] (Index i)
 Return a reference to the element at the specified index in the vector. More...
 
const T & operator[] (Index i) const
 Return a const reference to the element at the specified index in the vector. More...
 
Size getSize () const
 Return the dimension of this vector (number of components it has). More...
 
Size getDimension () const
 Return the dimension of this vector (number of components it has). More...
 
void set (Index i, T newX)
 Set the element at the specified index in the vector. More...
 
VectorND operator- () const
 Negate every component of this vector and return the result. More...
 
VectorND operator+ () const
 'Positivate' every component of this vector, effectively returning a copy. More...
 
VectorND operator+ (const VectorND &vector) const
 Add a vector to this vector and return the resulting vector. More...
 
VectorND operator+ (T value) const
 Add a scalar value to each component of this vector and return the resulting vector. More...
 
VectorND operator- (const VectorND &vector) const
 Subtract a vector from this vector and return the resulting vector. More...
 
VectorND operator- (T value) const
 Subtract a scalar value from each component of this vector and return the resulting vector. More...
 
VectorND operator* (const VectorND &vector) const
 Return the result of a component-wise vector multiplication with this vector. More...
 
VectorND operator* (T value) const
 Multiply a scalar value by each component of this vector and return the resulting vector. More...
 
VectorND operator/ (T value) const
 Divide each component of this vector by a scalar value and return the resulting vector. More...
 
VectorNDoperator+= (const VectorND &v2)
 
VectorNDoperator-= (const VectorND &v2)
 
VectorNDoperator+= (const T value)
 
VectorNDoperator-= (const T value)
 
VectorNDoperator*= (const T value)
 
VectorNDoperator/= (const T value)
 
data::String toString () const
 Convert this vector into a human-readable string representation. More...
 
 operator data::String () const
 Convert this vector into a human-readable string representation. More...
 

Static Public Attributes

static const VectorND ZERO
 A constant vector with every component equal to zero. More...
 

Detailed Description

template<typename T, Size dimension>
class om::math::VectorND< T, dimension >

A class that represents a vector of a fixed arbitrary number of components.

Constructor & Destructor Documentation

template<typename T, Size dimension>
om::math::VectorND< T, dimension >::VectorND ( )
inline

Create a vector with all of its elements equal to zero.

template<typename T, Size dimension>
om::math::VectorND< T, dimension >::VectorND ( value)
inline

Create a new vector with all elements equal to a single value.

template<typename T, Size dimension>
om::math::VectorND< T, dimension >::VectorND ( const T  array[dimension])
inline

Create a vector with elements from the specified array.

The array must be of length greater than or equal to the dimension of the vector.

Member Function Documentation

template<typename T, Size dimension>
T om::math::VectorND< T, dimension >::getMagnitude ( ) const
inline

Get the magnitude of the vector.

template<typename T, Size dimension>
T om::math::VectorND< T, dimension >::getMagnitudeSquared ( ) const
inline

Get the squared magnitude of the vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::normalize ( ) const
inline

Return a a normalized version of this vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::projectOn ( const VectorND< T, dimension > &  v) const
inline

Project this vector onto another vector.

template<typename T, Size dimension>
T om::math::VectorND< T, dimension >::getDistanceTo ( const VectorND< T, dimension > &  v) const
inline

Get the distance between the this vector and another.

template<typename T, Size dimension>
T om::math::VectorND< T, dimension >::getDistanceToSquared ( const VectorND< T, dimension > &  v) const
inline

Get the squared distance between the this vector and another.

template<typename T, Size dimension>
const T* om::math::VectorND< T, dimension >::toArray ( ) const
inline

Return an array representation of this vector.

template<typename T, Size dimension>
T& om::math::VectorND< T, dimension >::get ( Index  i)
inline

Return a reference to the element at the specified index in the vector.

template<typename T, Size dimension>
const T& om::math::VectorND< T, dimension >::get ( Index  i) const
inline

Return a const reference to the element at the specified index in the vector.

template<typename T, Size dimension>
T& om::math::VectorND< T, dimension >::operator() ( Index  i)
inline

Return a reference to the element at the specified index in the vector.

template<typename T, Size dimension>
const T& om::math::VectorND< T, dimension >::operator() ( Index  i) const
inline

Return const a reference to the element at the specified index in the vector.

template<typename T, Size dimension>
T& om::math::VectorND< T, dimension >::operator[] ( Index  i)
inline

Return a reference to the element at the specified index in the vector.

template<typename T, Size dimension>
const T& om::math::VectorND< T, dimension >::operator[] ( Index  i) const
inline

Return a const reference to the element at the specified index in the vector.

template<typename T, Size dimension>
Size om::math::VectorND< T, dimension >::getSize ( ) const
inline

Return the dimension of this vector (number of components it has).

template<typename T, Size dimension>
Size om::math::VectorND< T, dimension >::getDimension ( ) const
inline

Return the dimension of this vector (number of components it has).

template<typename T, Size dimension>
void om::math::VectorND< T, dimension >::set ( Index  i,
newX 
)
inline

Set the element at the specified index in the vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator- ( ) const
inline

Negate every component of this vector and return the result.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator+ ( ) const
inline

'Positivate' every component of this vector, effectively returning a copy.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator+ ( const VectorND< T, dimension > &  vector) const
inline

Add a vector to this vector and return the resulting vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator+ ( value) const
inline

Add a scalar value to each component of this vector and return the resulting vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator- ( const VectorND< T, dimension > &  vector) const
inline

Subtract a vector from this vector and return the resulting vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator- ( value) const
inline

Subtract a scalar value from each component of this vector and return the resulting vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator* ( const VectorND< T, dimension > &  vector) const
inline

Return the result of a component-wise vector multiplication with this vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator* ( value) const
inline

Multiply a scalar value by each component of this vector and return the resulting vector.

template<typename T, Size dimension>
VectorND om::math::VectorND< T, dimension >::operator/ ( value) const
inline

Divide each component of this vector by a scalar value and return the resulting vector.

template<typename T, Size dimension>
VectorND& om::math::VectorND< T, dimension >::operator+= ( const VectorND< T, dimension > &  v2)
inline
template<typename T, Size dimension>
VectorND& om::math::VectorND< T, dimension >::operator-= ( const VectorND< T, dimension > &  v2)
inline
template<typename T, Size dimension>
VectorND& om::math::VectorND< T, dimension >::operator+= ( const T  value)
inline
template<typename T, Size dimension>
VectorND& om::math::VectorND< T, dimension >::operator-= ( const T  value)
inline
template<typename T, Size dimension>
VectorND& om::math::VectorND< T, dimension >::operator*= ( const T  value)
inline
template<typename T, Size dimension>
VectorND& om::math::VectorND< T, dimension >::operator/= ( const T  value)
inline
template<typename T, Size dimension>
data::String om::math::VectorND< T, dimension >::toString ( ) const
inline

Convert this vector into a human-readable string representation.

template<typename T, Size dimension>
om::math::VectorND< T, dimension >::operator data::String ( ) const
inline

Convert this vector into a human-readable string representation.

Member Data Documentation

template<typename T, Size dimension>
const VectorND< T, dimension > om::math::VectorND< T, dimension >::ZERO
static

A constant vector with every component equal to zero.


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