Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
ion::vec3< T > Struct Template Reference

3D vector More...

#include <vec3.h>

Inheritance diagram for ion::vec3< T >:
Inheritance graph
[legend]
Collaboration diagram for ion::vec3< T >:
Collaboration graph
[legend]

Public Member Functions

 vec3 ()
 Default constructor. More...
 
 vec3 (T const in)
 Scalar constructor. More...
 
 vec3 (T const x, T const y, T const z)
 Explicit constructor. More...
 
template<typename U >
 vec3 (glm::tvec3< U, glm::defaultp > const &v)
 GLM constructor. More...
 
template<typename U >
 vec3 (vec3< U > const &vec)
 Generic constructor. More...
 
 vec3 (vec2< T > const &vec, T const z=0)
 vec2 constructor (vec2, z) More...
 
 vec3 (T const x, vec2< T > const &vecYZ)
 vec2 constructor (x, vec2) More...
 
T operator[] (int i) const
 Note: Out-of-bounds access returns a dummy value without error. More...
 
Toperator[] (int i)
 Note: Out-of-bounds access returns a dummy value without error. More...
 
template<typename U >
vec3< T > & operator= (vec3< U > const &vec)
 Generic vector assignment operator. More...
 
void reset ()
 Sets all values to 0. More...
 
void set (T const in)
 Sets all values to a single scalar. More...
 
void set (T const in[])
 Sets all values by an input C-style array. More...
 
template<typename U >
void set (vec3< U > const &other)
 Sets all values by an input vector. More...
 
T Length () const
 Length of vector. More...
 
T LengthSq () const
 Squared-length of vector (computationally fast) More...
 
T Dot (vec3< T > const &other) const
 
T GetDistanceFrom (vec3< T > const &v) const
 
T const GetDistanceSqFrom (vec3< T > const &v) const
 
template<typename Real >
vec3< TGetInterpolated (vec3< T > const &v, Real const d) const
 
vec3< TGetNormalized () const
 
vec3< T > & Normalize ()
 Normalize this vector. More...
 
vec3< Toperator+ (vec3< T > const &v) const
 
vec3< Toperator- (vec3< T > const &v) const
 
vec3< Toperator* (vec3< T > const &v) const
 
vec3< Toperator/ (vec3< T > const &v) const
 
vec3< Toperator+ (T const s) const
 
vec3< Toperator- (T const s) const
 
vec3< Toperator* (T const s) const
 
vec3< Toperator/ (T const s) const
 
vec3< T > & operator+= (vec3< T > const &v)
 
vec3< T > & operator-= (vec3< T > const &v)
 
vec3< T > & operator*= (vec3< T > const &v)
 
vec3< T > & operator/= (vec3< T > const &v)
 
vec3< T > & operator+= (T const s)
 
vec3< T > & operator-= (T const s)
 
vec3< T > & operator*= (T const s)
 
vec3< T > & operator/= (T const s)
 
vec3< T > const operator- () const
 
bool operator< (vec3< T > const &v) const
 
bool operator== (vec3< T > const &v) const
 
bool operator!= (vec3< T > const &v) const
 
bool Equals (vec3< T > const &v, T const Epsilon=RoundingError< T >::Value()) const
 
vec3< TCrossProduct (vec3< T > const &v) const
 Vector cross product. More...
 
vec3< TCross (vec3< T > const &v) const
 Vector cross product. More...
 
glm::vec3 const ToGLM () const
 
void Transform (glm::mat4 const &mat, float const TranslateComponent=1)
 
vec3< TGetTransformed (glm::mat4 const &mat, float const TranslateComponent=1) const
 
vec3< TRotateAround (vec3< T > const &other, float const radians) const
 
vec2< TXY () const
 
vec2< TYZ () const
 
vec2< TXZ () const
 

Static Public Member Functions

static vec3< TFromGLM (glm::vec3 const &Vec)
 
static vec3< TFromGLM (glm::vec4 const &Vec)
 

Public Attributes

T X
 
T Y
 
T Z
 

Friends

T Length (vec3< T > const &vec)
 Length of vector. More...
 
T LengthSq (vec3< T > const &vec)
 Squared-length of vector (computationally fast) More...
 
T Dot (vec3< T > const &lhs, vec3< T > const &rhs)
 
T Distance (vec3< T > const &lhs, vec3< T > const &rhs)
 
T DistanceSq (vec3< T > const &lhs, vec3< T > const &rhs)
 
template<typename Real >
vec3< TInterpolate (vec3< T > const &lhs, vec3< T > const &rhs, Real const d)
 
vec3< TNormalize (vec3< T > const &v)
 
vec3< Toperator+ (T const lhs, vec3< T > const &rhs)
 
vec3< Toperator- (T const lhs, vec3< T > const &rhs)
 
vec3< Toperator* (T const lhs, vec3< T > const &rhs)
 
vec3< Toperator/ (T const lhs, vec3< T > const &rhs)
 
vec3< TComponentMinimum (vec3< T > const &lhs, vec3< T > const &rhs)
 
vec3< TComponentMaximum (vec3< T > const &lhs, vec3< T > const &rhs)
 
vec3< TCross (vec3< T > const &lhs, vec3< T > const &rhs)
 Vector cross product. More...
 
std::ostream & operator<< (std::ostream &stream, vec3< T > const &vec)
 

Detailed Description

template<typename T>
struct ion::vec3< T >

3D vector

Constructor & Destructor Documentation

template<typename T>
ion::vec3< T >::vec3 ( )
inline

Default constructor.

template<typename T>
ion::vec3< T >::vec3 ( T const  in)
inline

Scalar constructor.

template<typename T>
ion::vec3< T >::vec3 ( T const  x,
T const  y,
T const  z 
)
inline

Explicit constructor.

template<typename T>
template<typename U >
ion::vec3< T >::vec3 ( glm::tvec3< U, glm::defaultp > const &  v)
inline

GLM constructor.

template<typename T>
template<typename U >
ion::vec3< T >::vec3 ( vec3< U > const &  vec)
inline

Generic constructor.

template<typename T>
ion::vec3< T >::vec3 ( vec2< T > const &  vec,
T const  z = 0 
)
inline

vec2 constructor (vec2, z)

template<typename T>
ion::vec3< T >::vec3 ( T const  x,
vec2< T > const &  vecYZ 
)
inline

vec2 constructor (x, vec2)

Member Function Documentation

template<typename T>
vec3<T> ion::vec3< T >::Cross ( vec3< T > const &  v) const
inline

Vector cross product.

template<typename T>
vec3<T> ion::vec3< T >::CrossProduct ( vec3< T > const &  v) const
inline

Vector cross product.

template<typename T>
T ion::vec3< T >::Dot ( vec3< T > const &  other) const
inline
template<typename T>
bool ion::vec3< T >::Equals ( vec3< T > const &  v,
T const  Epsilon = RoundingError<T>::Value() 
) const
inline
template<typename T>
static vec3<T> ion::vec3< T >::FromGLM ( glm::vec3< T > const &  Vec)
inlinestatic
template<typename T>
static vec3<T> ion::vec3< T >::FromGLM ( glm::vec4 const &  Vec)
inlinestatic
template<typename T>
T ion::vec3< T >::GetDistanceFrom ( vec3< T > const &  v) const
inline
template<typename T>
T const ion::vec3< T >::GetDistanceSqFrom ( vec3< T > const &  v) const
inline
template<typename T>
template<typename Real >
vec3<T> ion::vec3< T >::GetInterpolated ( vec3< T > const &  v,
Real const  d 
) const
inline
template<typename T>
vec3<T> ion::vec3< T >::GetNormalized ( ) const
inline
template<typename T>
vec3<T> ion::vec3< T >::GetTransformed ( glm::mat4 const &  mat,
float const  TranslateComponent = 1 
) const
inline
template<typename T>
T ion::vec3< T >::Length ( ) const
inline

Length of vector.

template<typename T>
T ion::vec3< T >::LengthSq ( ) const
inline

Squared-length of vector (computationally fast)

template<typename T>
vec3<T>& ion::vec3< T >::Normalize ( )
inline

Normalize this vector.

template<typename T>
bool ion::vec3< T >::operator!= ( vec3< T > const &  v) const
inline
template<typename T>
vec3<T> ion::vec3< T >::operator* ( vec3< T > const &  v) const
inline
template<typename T>
vec3<T> ion::vec3< T >::operator* ( T const  s) const
inline
template<typename T>
vec3<T>& ion::vec3< T >::operator*= ( vec3< T > const &  v)
inline
template<typename T>
vec3<T>& ion::vec3< T >::operator*= ( T const  s)
inline
template<typename T>
vec3<T> ion::vec3< T >::operator+ ( vec3< T > const &  v) const
inline
template<typename T>
vec3<T> ion::vec3< T >::operator+ ( T const  s) const
inline
template<typename T>
vec3<T>& ion::vec3< T >::operator+= ( vec3< T > const &  v)
inline
template<typename T>
vec3<T>& ion::vec3< T >::operator+= ( T const  s)
inline
template<typename T>
vec3<T> ion::vec3< T >::operator- ( vec3< T > const &  v) const
inline
template<typename T>
vec3<T> ion::vec3< T >::operator- ( T const  s) const
inline
template<typename T>
vec3<T> const ion::vec3< T >::operator- ( ) const
inline
template<typename T>
vec3<T>& ion::vec3< T >::operator-= ( vec3< T > const &  v)
inline
template<typename T>
vec3<T>& ion::vec3< T >::operator-= ( T const  s)
inline
template<typename T>
vec3<T> ion::vec3< T >::operator/ ( vec3< T > const &  v) const
inline
template<typename T>
vec3<T> ion::vec3< T >::operator/ ( T const  s) const
inline
template<typename T>
vec3<T>& ion::vec3< T >::operator/= ( vec3< T > const &  v)
inline
template<typename T>
vec3<T>& ion::vec3< T >::operator/= ( T const  s)
inline
template<typename T>
bool ion::vec3< T >::operator< ( vec3< T > const &  v) const
inline
template<typename T>
template<typename U >
vec3<T>& ion::vec3< T >::operator= ( vec3< U > const &  vec)
inline

Generic vector assignment operator.

template<typename T>
bool ion::vec3< T >::operator== ( vec3< T > const &  v) const
inline
template<typename T>
T ion::vec3< T >::operator[] ( int  i) const
inline

Note: Out-of-bounds access returns a dummy value without error.

template<typename T>
T& ion::vec3< T >::operator[] ( int  i)
inline

Note: Out-of-bounds access returns a dummy value without error.

template<typename T>
void ion::vec3< T >::reset ( )
inline

Sets all values to 0.

template<typename T>
vec3<T> ion::vec3< T >::RotateAround ( vec3< T > const &  other,
float const  radians 
) const
inline
template<typename T>
void ion::vec3< T >::set ( T const  in)
inline

Sets all values to a single scalar.

template<typename T>
void ion::vec3< T >::set ( T const  in[])
inline

Sets all values by an input C-style array.

template<typename T>
template<typename U >
void ion::vec3< T >::set ( vec3< U > const &  other)
inline

Sets all values by an input vector.

template<typename T>
glm::vec3 const ion::vec3< T >::ToGLM ( ) const
inline
template<typename T>
void ion::vec3< T >::Transform ( glm::mat4 const &  mat,
float const  TranslateComponent = 1 
)
inline
template<typename T>
vec2<T> ion::vec3< T >::XY ( ) const
inline
template<typename T>
vec2<T> ion::vec3< T >::XZ ( ) const
inline
template<typename T>
vec2<T> ion::vec3< T >::YZ ( ) const
inline

Friends And Related Function Documentation

template<typename T>
vec3<T> ComponentMaximum ( vec3< T > const &  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
vec3<T> ComponentMinimum ( vec3< T > const &  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
vec3<T> Cross ( vec3< T > const &  lhs,
vec3< T > const &  rhs 
)
friend

Vector cross product.

template<typename T>
T Distance ( vec3< T > const &  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
T DistanceSq ( vec3< T > const &  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
T Dot ( vec3< T > const &  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
template<typename Real >
vec3<T> Interpolate ( vec3< T > const &  lhs,
vec3< T > const &  rhs,
Real const  d 
)
friend
template<typename T>
T Length ( vec3< T > const &  vec)
friend

Length of vector.

template<typename T>
T LengthSq ( vec3< T > const &  vec)
friend

Squared-length of vector (computationally fast)

template<typename T>
vec3<T> Normalize ( vec3< T > const &  v)
friend
template<typename T>
vec3<T> operator* ( T const  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
vec3<T> operator+ ( T const  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
vec3<T> operator- ( T const  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
vec3<T> operator/ ( T const  lhs,
vec3< T > const &  rhs 
)
friend
template<typename T>
std::ostream& operator<< ( std::ostream &  stream,
vec3< T > const &  vec 
)
friend

Member Data Documentation

template<typename T>
T ion::vec3< T >::X
template<typename T>
T ion::vec3< T >::Y
template<typename T>
T ion::vec3< T >::Z

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