geolib2
Public Member Functions | Public Attributes | Friends | List of all members
geo::Vec2T< T > Class Template Reference

#include <math_types.h>

Public Member Functions

cross (const Vec2T &v) const
 returns cross product More...
 
dot (const Vec2T &v) const
 returns dot product More...
 
length () const
 Returns the length of the vector. More...
 
length2 () const
 Returns the squared length of the vector. More...
 
void normalize ()
 Normalizes the vector. More...
 
Vec2T normalized () const
 Returns the normalized version of the vector. More...
 
bool operator!= (const Vec2T &v) const
 
Vec2T operator* (T s) const
 multiplies vector with a scalar More...
 
Vec2Toperator*= (const Vec2T &v)
 
Vec2Toperator*= (T s)
 
Vec2T operator+ (const Vec2T &v) const
 returns addition of this and v More...
 
Vec2Toperator+= (const Vec2T &v)
 
Vec2T operator- (const Vec2T &v) const
 returns this minus v More...
 
Vec2Toperator-= (const Vec2T &v)
 
Vec2T operator/ (T s) const
 divides vector by scalar More...
 
Vec2Toperator/= (const Vec2T &v)
 
Vec2Toperator/= (T s)
 
Vec2Toperator= (const Vec2T &v)
 
bool operator== (const Vec2T &v) const
 
T & operator[] (const uint i)
 
const T & operator[] (const uint i) const
 
Vec3T< T > projectTo3d () const
 Expand vector with a zero 3rd coordinate. More...
 
 Vec2T ()
 
 Vec2T (const T *values)
 
 Vec2T (const Vec2T &v)=default
 
 Vec2T (T value)
 
 Vec2T (T x_, T y_)
 
 ~Vec2T ()
 

Public Attributes

union {
   struct {
      T   x
 
      T   y
 
   } 
 
   T   m [2]
 
}; 
 

Friends

Vec2T operator* (T s, const Vec2T &v)
 multiplies vector with a scalar More...
 
Vec2T operator- (const Vec2T &v)
 
std::ostreamoperator<< (std::ostream &out, const Vec2T &v)
 

Detailed Description

template<typename T>
class geo::Vec2T< T >

Definition at line 24 of file math_types.h.

Constructor & Destructor Documentation

◆ Vec2T() [1/5]

template<typename T >
geo::Vec2T< T >::Vec2T ( )
inline

Definition at line 28 of file math_types.h.

◆ Vec2T() [2/5]

template<typename T >
geo::Vec2T< T >::Vec2T ( const Vec2T< T > &  v)
default

◆ Vec2T() [3/5]

template<typename T >
geo::Vec2T< T >::Vec2T ( x_,
y_ 
)
inline

Definition at line 30 of file math_types.h.

◆ Vec2T() [4/5]

template<typename T >
geo::Vec2T< T >::Vec2T ( value)
inline

Definition at line 31 of file math_types.h.

◆ Vec2T() [5/5]

template<typename T >
geo::Vec2T< T >::Vec2T ( const T *  values)
inline

Definition at line 32 of file math_types.h.

◆ ~Vec2T()

template<typename T >
geo::Vec2T< T >::~Vec2T ( )
inline

Definition at line 42 of file math_types.h.

Member Function Documentation

◆ cross()

template<typename T >
T geo::Vec2T< T >::cross ( const Vec2T< T > &  v) const
inline

returns cross product

Definition at line 60 of file math_types.h.

◆ dot()

template<typename T >
T geo::Vec2T< T >::dot ( const Vec2T< T > &  v) const
inline

returns dot product

Definition at line 57 of file math_types.h.

◆ length()

template<typename T >
T geo::Vec2T< T >::length ( ) const
inline

Returns the length of the vector.

Definition at line 78 of file math_types.h.

◆ length2()

template<typename T >
T geo::Vec2T< T >::length2 ( ) const
inline

Returns the squared length of the vector.

Definition at line 81 of file math_types.h.

◆ normalize()

template<typename T >
void geo::Vec2T< T >::normalize ( )
inline

Normalizes the vector.

Definition at line 87 of file math_types.h.

◆ normalized()

template<typename T >
Vec2T geo::Vec2T< T >::normalized ( ) const
inline

Returns the normalized version of the vector.

Definition at line 84 of file math_types.h.

◆ operator!=()

template<typename T >
bool geo::Vec2T< T >::operator!= ( const Vec2T< T > &  v) const
inline

Definition at line 52 of file math_types.h.

◆ operator*()

template<typename T >
Vec2T geo::Vec2T< T >::operator* ( s) const
inline

multiplies vector with a scalar

Definition at line 69 of file math_types.h.

◆ operator*=() [1/2]

template<typename T >
Vec2T& geo::Vec2T< T >::operator*= ( const Vec2T< T > &  v)
inline

Definition at line 93 of file math_types.h.

◆ operator*=() [2/2]

template<typename T >
Vec2T& geo::Vec2T< T >::operator*= ( s)
inline

Definition at line 96 of file math_types.h.

◆ operator+()

template<typename T >
Vec2T geo::Vec2T< T >::operator+ ( const Vec2T< T > &  v) const
inline

returns addition of this and v

Definition at line 63 of file math_types.h.

◆ operator+=()

template<typename T >
Vec2T& geo::Vec2T< T >::operator+= ( const Vec2T< T > &  v)
inline

Definition at line 91 of file math_types.h.

◆ operator-()

template<typename T >
Vec2T geo::Vec2T< T >::operator- ( const Vec2T< T > &  v) const
inline

returns this minus v

Definition at line 66 of file math_types.h.

◆ operator-=()

template<typename T >
Vec2T& geo::Vec2T< T >::operator-= ( const Vec2T< T > &  v)
inline

Definition at line 92 of file math_types.h.

◆ operator/()

template<typename T >
Vec2T geo::Vec2T< T >::operator/ ( s) const
inline

divides vector by scalar

Definition at line 72 of file math_types.h.

◆ operator/=() [1/2]

template<typename T >
Vec2T& geo::Vec2T< T >::operator/= ( const Vec2T< T > &  v)
inline

Definition at line 94 of file math_types.h.

◆ operator/=() [2/2]

template<typename T >
Vec2T& geo::Vec2T< T >::operator/= ( s)
inline

Definition at line 97 of file math_types.h.

◆ operator=()

template<typename T >
Vec2T& geo::Vec2T< T >::operator= ( const Vec2T< T > &  v)
inline

Definition at line 34 of file math_types.h.

◆ operator==()

template<typename T >
bool geo::Vec2T< T >::operator== ( const Vec2T< T > &  v) const
inline

Definition at line 48 of file math_types.h.

◆ operator[]() [1/2]

template<typename T >
T& geo::Vec2T< T >::operator[] ( const uint  i)
inline

Definition at line 44 of file math_types.h.

◆ operator[]() [2/2]

template<typename T >
const T& geo::Vec2T< T >::operator[] ( const uint  i) const
inline

Definition at line 46 of file math_types.h.

◆ projectTo3d()

template<typename T >
Vec3T<T> geo::Vec2T< T >::projectTo3d ( ) const
inline

Expand vector with a zero 3rd coordinate.

Returns
Vector in 3D

Definition at line 103 of file math_types.h.

Friends And Related Function Documentation

◆ operator*

template<typename T >
Vec2T operator* ( s,
const Vec2T< T > &  v 
)
friend

multiplies vector with a scalar

Definition at line 75 of file math_types.h.

◆ operator-

template<typename T >
Vec2T operator- ( const Vec2T< T > &  v)
friend

Definition at line 89 of file math_types.h.

◆ operator<<

template<typename T >
std::ostream& operator<< ( std::ostream out,
const Vec2T< T > &  v 
)
friend

Definition at line 108 of file math_types.h.

Member Data Documentation

◆ @1

union { ... }

◆ m

template<typename T >
T geo::Vec2T< T >::m[2]

Definition at line 115 of file math_types.h.

◆ x

template<typename T >
T geo::Vec2T< T >::x

Definition at line 114 of file math_types.h.

◆ y

template<typename T >
T geo::Vec2T< T >::y

Definition at line 114 of file math_types.h.


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