UT_Vector2T< T > Class Template Reference

2D Vector class. More...

#include <UT_Vector2.h>

List of all members.

Public Member Functions

 UT_Vector2T (void)
 UT_Vector2T (T vx, T vy)
 UT_Vector2T (const fpreal32 v[2])
 UT_Vector2T (const fpreal64 v[2])
 UT_Vector2T (const UT_Vector3T< T > &v)
 UT_Vector2T (const UT_Vector4T< T > &v)
template<typename S >
 UT_Vector2T (const UT_Vector2T< S > &v)
template<typename S >
UT_Vector2T< T > & operator= (const UT_Vector2T< S > &v)
UT_Vector2T< T > & operator= (const UT_Vector3T< T > &v)
 Assignment operator that truncates a V3 to a V2.
UT_Vector2T< T > & operator= (const UT_Vector4T< T > &v)
 Assignment operator that truncates a V4 to a V2.
UT_Vector2T< T > operator- () const
UT_Vector2T< T > & operator+= (const UT_Vector2T< T > &v)
UT_Vector2T< T > & operator-= (const UT_Vector2T< T > &v)
unsigned operator== (const UT_Vector2T< T > &v) const
unsigned operator!= (const UT_Vector2T< T > &v) const
int equalZero (T tol=0.00001f) const
int isEqual (const UT_Vector2T< T > &v, T tol=0.00001f) const
bool isNan () const
void negate ()
void multiplyComponents (const UT_Vector2T< T > &v)
whichSide (const UT_Vector2T< T > &e1, const UT_Vector2T< T > &e2) const
UT_Vector2T< T > & operator= (T scalar)
UT_Vector2T< T > & operator+= (T scalar)
UT_Vector2T< T > & operator-= (T scalar)
UT_Vector2T< T > & operator*= (T scalar)
UT_Vector2T< T > & operator*= (const UT_Vector2T< T > &v)
UT_Vector2T< T > & operator/= (T scalar)
UT_Vector2T< T > & operator/= (const UT_Vector2T< T > &v)
template<typename S >
UT_Vector2T< T > & operator*= (const UT_Matrix2T< S > &mat)
dot (const UT_Vector2T< T > &v) const
normalize (void)
length (void) const
 The vector length (not to be confused with the vector dimension).
length2 (void) const
 The vector length squared.
UT_Vector2T< T > project (const UT_Vector2T< T > &u)
 Calculates the orthogonal projection of a vector u on the *this vector.
UT_Vector2T< T > projection (const UT_Vector2T< T > &p, const UT_Vector2T< T > &v) const
UT_Vector3T< T > getBary (const UT_Vector2T< T > &t0, const UT_Vector2T< T > &t1, const UT_Vector2T< T > &t2, bool *degen=NULL) const
unsigned hash () const
 Compute a hash.
void assign (T xx=0.0f, T yy=0.0f)
 Set the values of the vector components.
void assign (const T *v)
 Set the values of the vector components.
int findMinAbsAxis () const
 These allow you to find out what indices to use for different axes.
int findMaxAbsAxis () const
 These allow you to find out what indices to use for different axes.
const T * data (void) const
T * data (void)
T & x (void)
x (void) const
T & y (void)
y (void) const
T & operator() (unsigned i)
operator() (unsigned i) const
T & operator[] (unsigned i)
operator[] (unsigned i) const
void homogenize (void)
 Express the point in homogeneous coordinates or vice-versa.
void dehomogenize (void)
 Express the point in homogeneous coordinates or vice-versa.
void save (ostream &os, int binary=0) const
 Protected I/O methods.
bool load (UT_IStream &is)
 Protected I/O methods.
bool save (UT_JSONWriter &w) const
bool save (UT_JSONValue &v) const
bool load (UT_JSONParser &p)

Static Public Member Functions

static int entries ()
 Returns the vector size.

Public Attributes

vec [2]
 The data.

Friends

ostream & operator<< (ostream &os, const UT_Vector2T< T > &v)
 I/O friends.


Detailed Description

template<typename T>
class UT_Vector2T< T >

2D Vector class.

Definition at line 117 of file UT_Vector2.h.


Constructor & Destructor Documentation

template<typename T>
UT_Vector2T< T >::UT_Vector2T ( void   )  [inline]

Default constructor. No data is initialized! Use it for extra speed.

Definition at line 121 of file UT_Vector2.h.

template<typename T>
UT_Vector2T< T >::UT_Vector2T ( vx,
vy 
) [inline]

Definition at line 124 of file UT_Vector2.h.

template<typename T>
UT_Vector2T< T >::UT_Vector2T ( const fpreal32  v[2]  )  [inline, explicit]

Definition at line 128 of file UT_Vector2.h.

template<typename T>
UT_Vector2T< T >::UT_Vector2T ( const fpreal64  v[2]  )  [inline, explicit]

Definition at line 130 of file UT_Vector2.h.

template<typename T>
UT_Vector2T< T >::UT_Vector2T ( const UT_Vector3T< T > &  v  )  [explicit]

template<typename T>
UT_Vector2T< T >::UT_Vector2T ( const UT_Vector4T< T > &  v  )  [explicit]

template<typename T>
template<typename S >
UT_Vector2T< T >::UT_Vector2T ( const UT_Vector2T< S > &  v  )  [inline]

Definition at line 135 of file UT_Vector2.h.


Member Function Documentation

template<typename T>
void UT_Vector2T< T >::assign ( const T *  v  )  [inline]

Set the values of the vector components.

Definition at line 345 of file UT_Vector2.h.

template<typename T>
void UT_Vector2T< T >::assign ( xx = 0.0f,
yy = 0.0f 
) [inline]

Set the values of the vector components.

Definition at line 340 of file UT_Vector2.h.

template<typename T>
T* UT_Vector2T< T >::data ( void   )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 307 of file UT_Vector2.h.

template<typename T>
const T* UT_Vector2T< T >::data ( void   )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 306 of file UT_Vector2.h.

template<typename T>
void UT_Vector2T< T >::dehomogenize ( void   )  [inline]

Express the point in homogeneous coordinates or vice-versa.

Definition at line 350 of file UT_Vector2.h.

template<typename T>
T UT_Vector2T< T >::dot ( const UT_Vector2T< T > &  v  )  const [inline]

Definition at line 248 of file UT_Vector2.h.

template<typename T>
static int UT_Vector2T< T >::entries ( void   )  [inline, static]

Returns the vector size.

Definition at line 368 of file UT_Vector2.h.

template<typename T>
int UT_Vector2T< T >::equalZero ( tol = 0.00001f  )  const [inline]

Definition at line 171 of file UT_Vector2.h.

template<typename T>
int UT_Vector2T< T >::findMaxAbsAxis (  )  const [inline]

These allow you to find out what indices to use for different axes.

Definition at line 273 of file UT_Vector2.h.

template<typename T>
int UT_Vector2T< T >::findMinAbsAxis (  )  const [inline]

These allow you to find out what indices to use for different axes.

Definition at line 266 of file UT_Vector2.h.

template<typename T>
UT_Vector3T<T> UT_Vector2T< T >::getBary ( const UT_Vector2T< T > &  t0,
const UT_Vector2T< T > &  t1,
const UT_Vector2T< T > &  t2,
bool *  degen = NULL 
) const

Compute (homogeneous) barycentric co-ordinates of this point relative to the triangle defined by t0, t1 and t2. (The point is projected into the triangle's plane.)

template<typename T>
unsigned UT_Vector2T< T >::hash (  )  const [inline]

Compute a hash.

Definition at line 335 of file UT_Vector2.h.

template<typename T>
void UT_Vector2T< T >::homogenize ( void   )  [inline]

Express the point in homogeneous coordinates or vice-versa.

Definition at line 349 of file UT_Vector2.h.

template<typename T>
int UT_Vector2T< T >::isEqual ( const UT_Vector2T< T > &  v,
tol = 0.00001f 
) const [inline]

Definition at line 176 of file UT_Vector2.h.

template<typename T>
bool UT_Vector2T< T >::isNan (  )  const [inline]

Definition at line 182 of file UT_Vector2.h.

template<typename T>
T UT_Vector2T< T >::length ( void   )  const [inline]

The vector length (not to be confused with the vector dimension).

Definition at line 283 of file UT_Vector2.h.

template<typename T>
T UT_Vector2T< T >::length2 ( void   )  const [inline]

The vector length squared.

Definition at line 285 of file UT_Vector2.h.

template<typename T>
bool UT_Vector2T< T >::load ( UT_JSONParser p  ) 

Methods to serialize to a JSON stream. The vector is stored as an array of 2 reals.

template<typename T>
bool UT_Vector2T< T >::load ( UT_IStream is  ) 

Protected I/O methods.

template<typename T>
void UT_Vector2T< T >::multiplyComponents ( const UT_Vector2T< T > &  v  )  [inline]

Definition at line 187 of file UT_Vector2.h.

template<typename T>
void UT_Vector2T< T >::negate ( void   )  [inline]

Definition at line 185 of file UT_Vector2.h.

template<typename T>
T UT_Vector2T< T >::normalize ( void   )  [inline]

Definition at line 252 of file UT_Vector2.h.

template<typename T>
unsigned UT_Vector2T< T >::operator!= ( const UT_Vector2T< T > &  v  )  const [inline]

Definition at line 170 of file UT_Vector2.h.

template<typename T>
T UT_Vector2T< T >::operator() ( unsigned  i  )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 317 of file UT_Vector2.h.

template<typename T>
T& UT_Vector2T< T >::operator() ( unsigned  i  )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 312 of file UT_Vector2.h.

template<typename T>
template<typename S >
UT_Vector2T<T>& UT_Vector2T< T >::operator*= ( const UT_Matrix2T< S > &  mat  )  [inline]

Definition at line 244 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator*= ( const UT_Vector2T< T > &  v  )  [inline]

Definition at line 226 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator*= ( scalar  )  [inline]

Definition at line 220 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator+= ( scalar  )  [inline]

Definition at line 210 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator+= ( const UT_Vector2T< T > &  v  )  [inline]

Definition at line 154 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T> UT_Vector2T< T >::operator- (  )  const [inline]

Definition at line 150 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator-= ( scalar  )  [inline]

Definition at line 216 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator-= ( const UT_Vector2T< T > &  v  )  [inline]

Definition at line 160 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator/= ( const UT_Vector2T< T > &  v  )  [inline]

Definition at line 236 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator/= ( scalar  )  [inline]

Definition at line 232 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator= ( scalar  )  [inline]

Definition at line 205 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator= ( const UT_Vector4T< T > &  v  ) 

Assignment operator that truncates a V4 to a V2.

template<typename T>
UT_Vector2T<T>& UT_Vector2T< T >::operator= ( const UT_Vector3T< T > &  v  ) 

Assignment operator that truncates a V3 to a V2.

template<typename T>
template<typename S >
UT_Vector2T<T>& UT_Vector2T< T >::operator= ( const UT_Vector2T< S > &  v  )  [inline]

Definition at line 140 of file UT_Vector2.h.

template<typename T>
unsigned UT_Vector2T< T >::operator== ( const UT_Vector2T< T > &  v  )  const [inline]

Definition at line 166 of file UT_Vector2.h.

template<typename T>
T UT_Vector2T< T >::operator[] ( unsigned  i  )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 327 of file UT_Vector2.h.

template<typename T>
T& UT_Vector2T< T >::operator[] ( unsigned  i  )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 322 of file UT_Vector2.h.

template<typename T>
UT_Vector2T<T> UT_Vector2T< T >::project ( const UT_Vector2T< T > &  u  ) 

Calculates the orthogonal projection of a vector u on the *this vector.

template<typename T>
UT_Vector2T<T> UT_Vector2T< T >::projection ( const UT_Vector2T< T > &  p,
const UT_Vector2T< T > &  v 
) const

Vector p (representing a point in 2-space) and vector v define a line. This member returns the projection of "this" onto the line (the point on the line that is closest to this point).

template<typename T>
bool UT_Vector2T< T >::save ( UT_JSONValue v  )  const

Methods to serialize to a JSON stream. The vector is stored as an array of 2 reals.

template<typename T>
bool UT_Vector2T< T >::save ( UT_JSONWriter w  )  const

Methods to serialize to a JSON stream. The vector is stored as an array of 2 reals.

template<typename T>
void UT_Vector2T< T >::save ( ostream &  os,
int  binary = 0 
) const

Protected I/O methods.

template<typename T>
T UT_Vector2T< T >::whichSide ( const UT_Vector2T< T > &  e1,
const UT_Vector2T< T > &  e2 
) const [inline]

Given an oriented line from e1 passing through e2, determine on which side of the line the point p lies. Alternatively, determine in which half plane, positive or negative, the point lies. If the segment degenerates to a point, then the point is always on it.

Definition at line 199 of file UT_Vector2.h.

template<typename T>
T UT_Vector2T< T >::x ( void   )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 309 of file UT_Vector2.h.

template<typename T>
T& UT_Vector2T< T >::x ( void   )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 308 of file UT_Vector2.h.

template<typename T>
T UT_Vector2T< T >::y ( void   )  const [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 311 of file UT_Vector2.h.

template<typename T>
T& UT_Vector2T< T >::y ( void   )  [inline]

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 310 of file UT_Vector2.h.


Friends And Related Function Documentation

template<typename T>
ostream& operator<< ( ostream &  os,
const UT_Vector2T< T > &  v 
) [friend]

I/O friends.

Definition at line 376 of file UT_Vector2.h.


Member Data Documentation

template<typename T>
T UT_Vector2T< T >::vec[2]

The data.

Definition at line 371 of file UT_Vector2.h.


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

Generated on Mon Jan 28 00:49:13 2013 for HDK by  doxygen 1.5.9