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

2D vector More...

#include <vec2.h>

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

Public Member Functions

 vec2 ()
 Default constructor. More...
 
 vec2 (T const in)
 Scalar constructor. More...
 
 vec2 (T const x, T const y)
 Explicit constructor. More...
 
template<typename U >
 vec2 (glm::tvec2< U, glm::defaultp > const &v)
 GLM constructor. More...
 
template<typename U >
 vec2 (vec2< U > const &vec)
 Generic vec2 constructor. 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 >
vec2< T > & operator= (vec2< 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 (vec2< 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 (vec2< T > const &other) const
 
T GetDistanceFrom (vec2< T > const &v) const
 
T const GetDistanceSqFrom (vec2< T > const &v) const
 
template<typename Real >
vec2< TGetInterpolated (vec2< T > const &v, Real const d) const
 
vec2< TGetNormalized () const
 
vec2< T > & Normalize ()
 Normalize this vector. More...
 
vec2< Toperator+ (vec2< T > const &v) const
 
vec2< Toperator- (vec2< T > const &v) const
 
vec2< Toperator* (vec2< T > const &v) const
 
vec2< Toperator/ (vec2< T > const &v) const
 
vec2< Toperator+ (T const s) const
 
vec2< Toperator- (T const s) const
 
vec2< Toperator* (T const s) const
 
vec2< Toperator/ (T const s) const
 
vec2< T > & operator+= (vec2< T > const &v)
 
vec2< T > & operator-= (vec2< T > const &v)
 
vec2< T > & operator*= (vec2< T > const &v)
 
vec2< T > & operator/= (vec2< T > const &v)
 
vec2< T > & operator+= (T const s)
 
vec2< T > & operator-= (T const s)
 
vec2< T > & operator*= (T const s)
 
vec2< T > & operator/= (T const s)
 
vec2< T > const operator- () const
 
bool operator< (vec2< T > const &v) const
 
bool operator== (vec2< T > const &v) const
 
bool operator!= (vec2< T > const &v) const
 
bool Equals (vec2< T > const &v, T const Epsilon=RoundingError< T >::Value()) const
 
glm::vec2 const ToGLM () const
 
vec2< TYX () const
 
vec2< TXX () const
 
vec2< TYY () const
 
vec2< TRotate (T const radians) const
 
T GetAngle () const
 
vec2< TRotate90CW () const
 
vec2< TRotate90CCW () const
 

Static Public Member Functions

static vec2< TFromGLM (glm::vec2 const &Vec)
 

Public Attributes

T X
 
T Y
 

Friends

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

Detailed Description

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

2D vector

Constructor & Destructor Documentation

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

Default constructor.

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

Scalar constructor.

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

Explicit constructor.

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

GLM constructor.

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

Generic vec2 constructor.

Member Function Documentation

template<typename T>
T ion::vec2< T >::Dot ( vec2< T > const &  other) const
inline
template<typename T>
bool ion::vec2< T >::Equals ( vec2< T > const &  v,
T const  Epsilon = RoundingError<T>::Value() 
) const
inline
template<typename T>
static vec2<T> ion::vec2< T >::FromGLM ( glm::vec2< T > const &  Vec)
inlinestatic
template<typename T>
T ion::vec2< T >::GetAngle ( ) const
inline
template<typename T>
T ion::vec2< T >::GetDistanceFrom ( vec2< T > const &  v) const
inline
template<typename T>
T const ion::vec2< T >::GetDistanceSqFrom ( vec2< T > const &  v) const
inline
template<typename T>
template<typename Real >
vec2<T> ion::vec2< T >::GetInterpolated ( vec2< T > const &  v,
Real const  d 
) const
inline
template<typename T>
vec2<T> ion::vec2< T >::GetNormalized ( ) const
inline
template<typename T>
T ion::vec2< T >::Length ( ) const
inline

Length of vector.

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

Squared-length of vector (computationally fast)

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

Normalize this vector.

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

Generic vector assignment operator.

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

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

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

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

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

Sets all values to 0.

template<typename T>
vec2<T> ion::vec2< T >::Rotate ( T const  radians) const
inline
template<typename T>
vec2<T> ion::vec2< T >::Rotate90CCW ( ) const
inline
template<typename T>
vec2<T> ion::vec2< T >::Rotate90CW ( ) const
inline
template<typename T>
void ion::vec2< T >::set ( T const  in)
inline

Sets all values to a single scalar.

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

Sets all values by an input C-style array.

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

Sets all values by an input vector.

template<typename T>
glm::vec2 const ion::vec2< T >::ToGLM ( ) const
inline
template<typename T>
vec2<T> ion::vec2< T >::XX ( ) const
inline
template<typename T>
vec2<T> ion::vec2< T >::YX ( ) const
inline
template<typename T>
vec2<T> ion::vec2< T >::YY ( ) const
inline

Friends And Related Function Documentation

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

Length of vector.

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

Squared-length of vector (computationally fast)

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

Member Data Documentation

template<typename T>
T ion::vec2< T >::X
template<typename T>
T ion::vec2< T >::Y

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