HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VectorN< V, S, N > Class Template Reference

#include <Types.h>

+ Inheritance diagram for VectorN< V, S, N >:

Classes

class  Hash
 Function object for hashing vectors. More...
 

Public Types

using Iterator = typename std::array< S, N >::iterator
 
using ConstIterator = typename std::array< S, N >::const_iterator
 

Public Member Functions

 VectorN ()
 
 VectorN (Uninit)
 
 VectorN (S s)
 
 VectorN (const std::array< S, N > &arr)
 
 VectorN (const vector< S > &vec)
 
 VectorN (const S *begin, const S *end)
 
Comparison Operators
bool operator== (const V &rhs) const
 Return true if the given vector is identical to this one. More...
 
bool operator!= (const V &rhs) const
 Return true if the given vector differs from this one. More...
 
bool operator< (const V &rhs) const
 Compare two vectors lexicographically. More...
 
Indexing Operators
Soperator[] (size_t i)
 Return the scalar value at the given index. More...
 
const Soperator[] (size_t i) const
 Return the const scalar value at the given index. More...
 
Component-wise Operators
operator+ (const V &rhs) const
 Component-wise addition of two vectors. More...
 
VectorNoperator+= (const V &rhs)
 Component-wise addition of two vectors. More...
 
operator- (const V &rhs) const
 Component-wise subtraction of two vectors. More...
 
VectorNoperator-= (const V &rhs)
 Component-wise subtraction of two vectors. More...
 
operator* (const V &rhs) const
 Component-wise multiplication of two vectors. More...
 
VectorNoperator*= (const V &rhs)
 Component-wise multiplication of two vectors. More...
 
operator/ (const V &rhs) const
 Component-wise division of two vectors. More...
 
VectorNoperator/= (const V &rhs)
 Component-wise division of two vectors. More...
 
operator* (S s) const
 Component-wise multiplication of a vector by a scalar. More...
 
VectorNoperator*= (S s)
 Component-wise multiplication of a vector by a scalar. More...
 
operator/ (S s) const
 Component-wise division of a vector by a scalar. More...
 
VectorNoperator/= (S s)
 Component-wise division of a vector by a scalar. More...
 
operator- () const
 Unary negation of a vector. More...
 
Geometric Methods
S getMagnitude () const
 Return the magnitude of the vector. More...
 
getNormalized () const
 Return a normalized vector. More...
 
S dot (const V &rhs) const
 Return the dot product of two vectors. More...
 
Iterators
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
Utility
Sdata ()
 Return a pointer to the underlying data array. More...
 
const Sdata () const
 Return a const pointer to the underlying data array. More...
 

Static Public Member Functions

Static Methods
static constexpr size_t numElements ()
 Return the number of scalar elements for the vector. More...
 

Protected Attributes

std::array< S, N > _arr
 

Detailed Description

template<class V, class S, size_t N>
class VectorN< V, S, N >

The class template for vectors of scalar values. Inherited by Vector2, Vector3, Vector4, Color3, and Color4.

Template parameter V is the vector subclass, S is the scalar element type, and N is the number of scalar elements in the vector.

Definition at line 52 of file Types.h.

Member Typedef Documentation

template<class V, class S, size_t N>
using VectorN< V, S, N >::ConstIterator = typename std::array<S, N>::const_iterator

Definition at line 56 of file Types.h.

template<class V, class S, size_t N>
using VectorN< V, S, N >::Iterator = typename std::array<S, N>::iterator

Definition at line 55 of file Types.h.

Constructor & Destructor Documentation

template<class V, class S, size_t N>
VectorN< V, S, N >::VectorN ( )
inline

Definition at line 59 of file Types.h.

template<class V, class S, size_t N>
VectorN< V, S, N >::VectorN ( Uninit  )
inlineexplicit

Definition at line 60 of file Types.h.

template<class V, class S, size_t N>
VectorN< V, S, N >::VectorN ( S  s)
inlineexplicit

Definition at line 61 of file Types.h.

template<class V, class S, size_t N>
VectorN< V, S, N >::VectorN ( const std::array< S, N > &  arr)
inlineexplicit

Definition at line 62 of file Types.h.

template<class V, class S, size_t N>
VectorN< V, S, N >::VectorN ( const vector< S > &  vec)
inlineexplicit

Definition at line 63 of file Types.h.

template<class V, class S, size_t N>
VectorN< V, S, N >::VectorN ( const S begin,
const S end 
)
inlineexplicit

Definition at line 64 of file Types.h.

Member Function Documentation

template<class V, class S, size_t N>
Iterator VectorN< V, S, N >::begin ( void  )
inline

Definition at line 238 of file Types.h.

template<class V, class S, size_t N>
ConstIterator VectorN< V, S, N >::begin ( void  ) const
inline

Definition at line 239 of file Types.h.

template<class V, class S, size_t N>
S* VectorN< V, S, N >::data ( )
inline

Return a pointer to the underlying data array.

Definition at line 249 of file Types.h.

template<class V, class S, size_t N>
const S* VectorN< V, S, N >::data ( ) const
inline

Return a const pointer to the underlying data array.

Definition at line 252 of file Types.h.

template<class V, class S, size_t N>
S VectorN< V, S, N >::dot ( const V &  rhs) const
inline

Return the dot product of two vectors.

Definition at line 226 of file Types.h.

template<class V, class S, size_t N>
Iterator VectorN< V, S, N >::end ( void  )
inline

Definition at line 241 of file Types.h.

template<class V, class S, size_t N>
ConstIterator VectorN< V, S, N >::end ( void  ) const
inline

Definition at line 242 of file Types.h.

template<class V, class S, size_t N>
S VectorN< V, S, N >::getMagnitude ( ) const
inline

Return the magnitude of the vector.

Definition at line 211 of file Types.h.

template<class V, class S, size_t N>
V VectorN< V, S, N >::getNormalized ( ) const
inline

Return a normalized vector.

Definition at line 220 of file Types.h.

template<class V, class S, size_t N>
static constexpr size_t VectorN< V, S, N >::numElements ( )
inlinestatic

Return the number of scalar elements for the vector.

Definition at line 272 of file Types.h.

template<class V, class S, size_t N>
bool VectorN< V, S, N >::operator!= ( const V &  rhs) const
inline

Return true if the given vector differs from this one.

Definition at line 73 of file Types.h.

template<class V, class S, size_t N>
V VectorN< V, S, N >::operator* ( const V &  rhs) const
inline

Component-wise multiplication of two vectors.

Definition at line 130 of file Types.h.

template<class V, class S, size_t N>
V VectorN< V, S, N >::operator* ( S  s) const
inline

Component-wise multiplication of a vector by a scalar.

Definition at line 164 of file Types.h.

template<class V, class S, size_t N>
VectorN& VectorN< V, S, N >::operator*= ( const V &  rhs)
inline

Component-wise multiplication of two vectors.

Definition at line 139 of file Types.h.

template<class V, class S, size_t N>
VectorN& VectorN< V, S, N >::operator*= ( S  s)
inline

Component-wise multiplication of a vector by a scalar.

Definition at line 173 of file Types.h.

template<class V, class S, size_t N>
V VectorN< V, S, N >::operator+ ( const V &  rhs) const
inline

Component-wise addition of two vectors.

Definition at line 96 of file Types.h.

template<class V, class S, size_t N>
VectorN& VectorN< V, S, N >::operator+= ( const V &  rhs)
inline

Component-wise addition of two vectors.

Definition at line 105 of file Types.h.

template<class V, class S, size_t N>
V VectorN< V, S, N >::operator- ( const V &  rhs) const
inline

Component-wise subtraction of two vectors.

Definition at line 113 of file Types.h.

template<class V, class S, size_t N>
V VectorN< V, S, N >::operator- ( ) const
inline

Unary negation of a vector.

Definition at line 198 of file Types.h.

template<class V, class S, size_t N>
VectorN& VectorN< V, S, N >::operator-= ( const V &  rhs)
inline

Component-wise subtraction of two vectors.

Definition at line 122 of file Types.h.

template<class V, class S, size_t N>
V VectorN< V, S, N >::operator/ ( const V &  rhs) const
inline

Component-wise division of two vectors.

Definition at line 147 of file Types.h.

template<class V, class S, size_t N>
V VectorN< V, S, N >::operator/ ( S  s) const
inline

Component-wise division of a vector by a scalar.

Definition at line 181 of file Types.h.

template<class V, class S, size_t N>
VectorN& VectorN< V, S, N >::operator/= ( const V &  rhs)
inline

Component-wise division of two vectors.

Definition at line 156 of file Types.h.

template<class V, class S, size_t N>
VectorN& VectorN< V, S, N >::operator/= ( S  s)
inline

Component-wise division of a vector by a scalar.

Definition at line 190 of file Types.h.

template<class V, class S, size_t N>
bool VectorN< V, S, N >::operator< ( const V &  rhs) const
inline

Compare two vectors lexicographically.

Definition at line 76 of file Types.h.

template<class V, class S, size_t N>
bool VectorN< V, S, N >::operator== ( const V &  rhs) const
inline

Return true if the given vector is identical to this one.

Definition at line 70 of file Types.h.

template<class V, class S, size_t N>
S& VectorN< V, S, N >::operator[] ( size_t  i)
inline

Return the scalar value at the given index.

Definition at line 86 of file Types.h.

template<class V, class S, size_t N>
const S& VectorN< V, S, N >::operator[] ( size_t  i) const
inline

Return the const scalar value at the given index.

Definition at line 89 of file Types.h.

Member Data Documentation

template<class V, class S, size_t N>
std::array<S, N> VectorN< V, S, N >::_arr
protected

Definition at line 277 of file Types.h.


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