Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
cinder::Vec2< T > Class Template Reference

#include <Vector.h>

Public Types

typedef T TYPE
 
typedef T value_type
 
typedef VECTRAIT< T >::DIST DIST
 

Public Member Functions

 Vec2 ()
 
 Vec2 (T nx, T ny)
 
 Vec2 (const Vec2< T > &src)
 
 Vec2 (const T *d)
 
template<typename FromT >
 Vec2 (const Vec2< FromT > &src)
 
void set (T ax, T ay)
 
void set (const Vec2< T > &rhs)
 
template<typename FromT >
Vec2< T > & operator= (const Vec2< FromT > &rhs)
 
Vec2< T > & operator= (const Vec2< T > &rhs)
 
T & operator[] (int n)
 
const T & operator[] (int n) const
 
T * ptr () const
 
const Vec2< T > operator+ (const Vec2< T > &rhs) const
 
const Vec2< T > operator- (const Vec2< T > &rhs) const
 
const Vec2< T > operator* (const Vec2< T > &rhs) const
 
const Vec2< T > operator/ (const Vec2< T > &rhs) const
 
Vec2< T > & operator+= (const Vec2< T > &rhs)
 
Vec2< T > & operator-= (const Vec2< T > &rhs)
 
Vec2< T > & operator*= (const Vec2< T > &rhs)
 
Vec2< T > & operator/= (const Vec2< T > &rhs)
 
const Vec2< T > operator/ (T rhs) const
 
Vec2< T > & operator+= (T rhs)
 
Vec2< T > & operator-= (T rhs)
 
Vec2< T > & operator*= (T rhs)
 
Vec2< T > & operator/= (T rhs)
 
Vec2< T > operator- () const
 
bool operator== (const Vec2< T > &rhs) const
 
bool operator!= (const Vec2< T > &rhs) const
 
dot (const Vec2< T > &rhs) const
 
cross (const Vec2< T > &rhs) const
 Returns the z component of the cross if the two operands were Vec3's on the XY plane, the equivalent of Vec3(*this).cross( Vec3(rhs) ).z. More...
 
DIST distance (const Vec2< T > &rhs) const
 
distanceSquared (const Vec2< T > &rhs) const
 
DIST length () const
 
void normalize ()
 
Vec2< T > normalized () const
 
void safeNormalize ()
 
Vec2< T > safeNormalized () const
 
void rotate (DIST radians)
 
lengthSquared () const
 
void limit (DIST maxLength)
 Limits the length of a Vec2 to maxLength, scaling it proportionally if necessary. More...
 
Vec2< T > limited (T maxLength) const
 Returns a copy of the Vec2 with its length limited to maxLength, scaling it proportionally if necessary. More...
 
void invert ()
 
Vec2< T > inverse () const
 
Vec2< T > lerp (T fact, const Vec2< T > &r) const
 
void lerpEq (T fact, const Vec2< T > &rhs)
 
Vec2< T > xx () const
 
Vec2< T > xy () const
 
Vec2< T > yx () const
 
Vec2< T > yy () const
 
Vec3< T > xxx () const
 
Vec3< T > xxy () const
 
Vec3< T > xyx () const
 
Vec3< T > xyy () const
 
Vec3< T > yxx () const
 
Vec3< T > yxy () const
 
Vec3< T > yyx () const
 
Vec3< T > yyy () const
 

Static Public Member Functions

static Vec2< T > max ()
 
static Vec2< T > zero ()
 
static Vec2< T > one ()
 
static Vec2< T > xAxis ()
 
static Vec2< T > yAxis ()
 
static Vec2< T > NaN ()
 

Public Attributes

x
 
y
 

Static Public Attributes

static const int DIM = 2
 

Friends

std::ostream & operator<< (std::ostream &lhs, const Vec2< T > &rhs)
 

Member Typedef Documentation

template<typename T>
typedef T cinder::Vec2< T >::TYPE
template<typename T>
typedef T cinder::Vec2< T >::value_type
template<typename T>
typedef VECTRAIT<T>::DIST cinder::Vec2< T >::DIST

Constructor & Destructor Documentation

template<typename T>
cinder::Vec2< T >::Vec2 ( )
template<typename T>
cinder::Vec2< T >::Vec2 ( nx,
ny 
)
template<typename T>
cinder::Vec2< T >::Vec2 ( const Vec2< T > &  src)
template<typename T>
cinder::Vec2< T >::Vec2 ( const T *  d)
explicit
template<typename T>
template<typename FromT >
cinder::Vec2< T >::Vec2 ( const Vec2< FromT > &  src)

Member Function Documentation

template<typename T>
void cinder::Vec2< T >::set ( ax,
ay 
)
template<typename T>
void cinder::Vec2< T >::set ( const Vec2< T > &  rhs)
template<typename T>
template<typename FromT >
Vec2<T>& cinder::Vec2< T >::operator= ( const Vec2< FromT > &  rhs)
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator= ( const Vec2< T > &  rhs)
template<typename T>
T& cinder::Vec2< T >::operator[] ( int  n)
template<typename T>
const T& cinder::Vec2< T >::operator[] ( int  n) const
template<typename T>
T* cinder::Vec2< T >::ptr ( ) const
template<typename T>
const Vec2<T> cinder::Vec2< T >::operator+ ( const Vec2< T > &  rhs) const
template<typename T>
const Vec2<T> cinder::Vec2< T >::operator- ( const Vec2< T > &  rhs) const
template<typename T>
const Vec2<T> cinder::Vec2< T >::operator* ( const Vec2< T > &  rhs) const
template<typename T>
const Vec2<T> cinder::Vec2< T >::operator/ ( const Vec2< T > &  rhs) const
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator+= ( const Vec2< T > &  rhs)
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator-= ( const Vec2< T > &  rhs)
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator*= ( const Vec2< T > &  rhs)
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator/= ( const Vec2< T > &  rhs)
template<typename T>
const Vec2<T> cinder::Vec2< T >::operator/ ( rhs) const
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator+= ( rhs)
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator-= ( rhs)
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator*= ( rhs)
template<typename T>
Vec2<T>& cinder::Vec2< T >::operator/= ( rhs)
template<typename T>
Vec2<T> cinder::Vec2< T >::operator- ( ) const
template<typename T>
bool cinder::Vec2< T >::operator== ( const Vec2< T > &  rhs) const
template<typename T>
bool cinder::Vec2< T >::operator!= ( const Vec2< T > &  rhs) const
template<typename T>
T cinder::Vec2< T >::dot ( const Vec2< T > &  rhs) const
template<typename T>
T cinder::Vec2< T >::cross ( const Vec2< T > &  rhs) const

Returns the z component of the cross if the two operands were Vec3's on the XY plane, the equivalent of Vec3(*this).cross( Vec3(rhs) ).z.

template<typename T>
DIST cinder::Vec2< T >::distance ( const Vec2< T > &  rhs) const
template<typename T>
T cinder::Vec2< T >::distanceSquared ( const Vec2< T > &  rhs) const
template<typename T>
DIST cinder::Vec2< T >::length ( ) const
template<typename T>
void cinder::Vec2< T >::normalize ( )
template<typename T>
Vec2<T> cinder::Vec2< T >::normalized ( ) const
template<typename T>
void cinder::Vec2< T >::safeNormalize ( )
template<typename T>
Vec2<T> cinder::Vec2< T >::safeNormalized ( ) const
template<typename T>
void cinder::Vec2< T >::rotate ( DIST  radians)
template<typename T>
T cinder::Vec2< T >::lengthSquared ( ) const
template<typename T>
void cinder::Vec2< T >::limit ( DIST  maxLength)

Limits the length of a Vec2 to maxLength, scaling it proportionally if necessary.

template<typename T>
Vec2<T> cinder::Vec2< T >::limited ( maxLength) const

Returns a copy of the Vec2 with its length limited to maxLength, scaling it proportionally if necessary.

template<typename T>
void cinder::Vec2< T >::invert ( )
template<typename T>
Vec2<T> cinder::Vec2< T >::inverse ( ) const
template<typename T>
Vec2<T> cinder::Vec2< T >::lerp ( fact,
const Vec2< T > &  r 
) const
template<typename T>
void cinder::Vec2< T >::lerpEq ( fact,
const Vec2< T > &  rhs 
)
template<typename T>
Vec2<T> cinder::Vec2< T >::xx ( ) const
template<typename T>
Vec2<T> cinder::Vec2< T >::xy ( ) const
template<typename T>
Vec2<T> cinder::Vec2< T >::yx ( ) const
template<typename T>
Vec2<T> cinder::Vec2< T >::yy ( ) const
template<typename T>
Vec3<T> cinder::Vec2< T >::xxx ( ) const
template<typename T>
Vec3<T> cinder::Vec2< T >::xxy ( ) const
template<typename T>
Vec3<T> cinder::Vec2< T >::xyx ( ) const
template<typename T>
Vec3<T> cinder::Vec2< T >::xyy ( ) const
template<typename T>
Vec3<T> cinder::Vec2< T >::yxx ( ) const
template<typename T>
Vec3<T> cinder::Vec2< T >::yxy ( ) const
template<typename T>
Vec3<T> cinder::Vec2< T >::yyx ( ) const
template<typename T>
Vec3<T> cinder::Vec2< T >::yyy ( ) const
template<typename T>
static Vec2<T> cinder::Vec2< T >::max ( )
static
template<typename T>
static Vec2<T> cinder::Vec2< T >::zero ( )
static
template<typename T>
static Vec2<T> cinder::Vec2< T >::one ( )
static
template<typename T>
static Vec2<T> cinder::Vec2< T >::xAxis ( )
static
template<typename T>
static Vec2<T> cinder::Vec2< T >::yAxis ( )
static
template<typename T>
static Vec2<T> cinder::Vec2< T >::NaN ( )
static

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  lhs,
const Vec2< T > &  rhs 
)
friend

Member Data Documentation

template<typename T>
T cinder::Vec2< T >::x
template<typename T>
T cinder::Vec2< T >::y
template<typename T>
const int cinder::Vec2< T >::DIM = 2
static

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