UT_Vector2T< T > Class Template Reference

2D Vector class. More...

#include <UT_Vector2.h>

List of all members.

Public Types

typedef T value_type

Public Member Functions

 UT_Vector2T (void)
 UT_Vector2T (T vx, T vy)
 UT_Vector2T (const fpreal16 v[tuple_size])
 UT_Vector2T (const fpreal32 v[tuple_size])
 UT_Vector2T (const fpreal64 v[tuple_size])
 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 [tuple_size]
 The data.

Static Public Attributes

static const int tuple_size = 2

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.
Examples:

euclid/EUC_Expression.h, euclid/EUC_Object.h, and euclid/GR_Euclid.C.

Definition at line 117 of file UT_Vector2.h.


Member Typedef Documentation

template<typename T>
typedef T UT_Vector2T< T >::value_type

Definition at line 121 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 126 of file UT_Vector2.h.

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

Definition at line 129 of file UT_Vector2.h.

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

Definition at line 133 of file UT_Vector2.h.

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

Definition at line 135 of file UT_Vector2.h.

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

Definition at line 137 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 142 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 352 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 347 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 314 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 313 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 357 of file UT_Vector2.h.

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

Definition at line 255 of file UT_Vector2.h.

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

Returns the vector size.

Definition at line 375 of file UT_Vector2.h.

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

Definition at line 178 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 280 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 273 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 342 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 356 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 183 of file UT_Vector2.h.

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

Definition at line 189 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 290 of file UT_Vector2.h.

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

The vector length squared.

Definition at line 292 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 194 of file UT_Vector2.h.

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

Definition at line 192 of file UT_Vector2.h.

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

Definition at line 259 of file UT_Vector2.h.

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

Definition at line 177 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 324 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 319 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 251 of file UT_Vector2.h.

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

Definition at line 233 of file UT_Vector2.h.

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

Definition at line 227 of file UT_Vector2.h.

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

Definition at line 217 of file UT_Vector2.h.

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

Definition at line 161 of file UT_Vector2.h.

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

Definition at line 157 of file UT_Vector2.h.

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

Definition at line 223 of file UT_Vector2.h.

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

Definition at line 167 of file UT_Vector2.h.

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

Definition at line 243 of file UT_Vector2.h.

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

Definition at line 239 of file UT_Vector2.h.

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

Definition at line 212 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 147 of file UT_Vector2.h.

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

Definition at line 173 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 334 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 329 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 206 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 316 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.

Examples:
euclid/GR_Euclid.C.

Definition at line 315 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 318 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.

Examples:
euclid/GR_Euclid.C.

Definition at line 317 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 383 of file UT_Vector2.h.


Member Data Documentation

template<typename T>
const int UT_Vector2T< T >::tuple_size = 2 [static]

Definition at line 122 of file UT_Vector2.h.

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

The data.

Definition at line 378 of file UT_Vector2.h.


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

Generated on Thu Jan 31 00:34:06 2013 for HDK by  doxygen 1.5.9