All Classes Files Functions Variables Typedefs Pages
Public Types | Public Member Functions | Static Public Attributes | List of all members
Vector< T, N > Struct Template Reference

Description

template<typename T, std::size_t N>
struct lumina::Vector< T, N >

Represents a vector with arbitrary dimension and type of elements.

Template Parameters
TType of the elements of the vector
NDimension of the vector

Inherits VectorImpl< T, N >.

Inherited by VectorIterator< T, N >.

Public Types

using iterator = VectorIterator< T, N >
 iterator type
 
using type = T
 type of the vector's elements
 

Public Member Functions

template<typename U >
 Vector (Vector< U, N > other)
 
T & operator[] (std::size_t index)
 subscript operator, throws on invalid subscript
 
operator[] (std::size_t index) const
 
template<typename OT >
Vector< T, N > & operator+= (const Vector< OT, N > &v)
 
template<typename OT >
Vector< T, N > & operator-= (const Vector< OT, N > &v)
 
template<typename S >
Vector< T, N > & operator*= (S scalar)
 
template<typename S >
Vector< T, N > & operator/= (S scalar)
 
Vector< T, N > operator+ () const
 
Vector< T, N > operator- () const
 
bool operator== (const Vector< T, N > &other) const
 
bool operator!= (const Vector< T, N > &other) const
 
bool operator< (const Vector< T, N > &other) const
 
bool operator> (const Vector< T, N > &other) const
 
bool operator<= (const Vector< T, N > &other) const
 
bool operator>= (const Vector< T, N > &other) const
 
lengthSquared () const
 
template<typename Tout = decltype(sqrt(T(0)))>
Tout length () const
 
auto phi () const -> decltype(atan2(T(0), T(0)))
 
auto theta () const -> decltype(acos(T(0)))
 
linearSize () const
 
Vector< T, N > & normalize ()
 
Vector< T, N > normalized () const
 
template<typename To >
Vector< T, N > & scale (const Vector< To, N > &o)
 
template<typename To >
Vector< T, N > scaled (const Vector< To, N > &o)
 
template<typename Ta >
Vector< T, N > & rotate (Ta phi, Ta theta)
 
template<typename Ta >
Vector< T, N > rotated (Ta phi, Ta theta) const
 
template<typename To >
Vector< T, N > & reflect (const Vector< To, N > &normal)
 
template<typename To >
auto reflected (const Vector< To, N > &normal) const -> Vector< decltype(T(0)-To(0)), N >
 
- Public Member Functions inherited from VectorImpl< T, N >
template<typename... Ts>
 VectorImpl (Ts...vals)
 

Static Public Attributes

static constexpr std::size_t size = N
 dimension of the vector
 

Additional Inherited Members

- Public Attributes inherited from VectorImpl< T, N >
union {
   T   data [N]
 
   struct {
      T   x
 
      T   y
 
      T   z
 
      T   w
 
   } 
 
};