UT_Vector4T< T > Class Template Reference

4D Vector class. More...

#include <UT_Vector4.h>

List of all members.

Public Types

typedef T value_type

Public Member Functions

 UT_Vector4T (void)
 UT_Vector4T (T vx, T vy, T vz, T vw=1.0f)
 UT_Vector4T (const fpreal32 v[tuple_size])
 UT_Vector4T (const fpreal64 v[tuple_size])
 UT_Vector4T (const UT_Vector3T< T > &v, T w=1.f)
template<typename S >
 UT_Vector4T (const UT_Vector4T< S > &v)
template<typename S >
UT_Vector4T< T > & operator= (const UT_Vector4T< S > &v)
UT_Vector4T< T > & operator= (const UT_Vector3T< T > &v)
UT_Vector4T< T > & operator+= (const UT_Vector4T< T > &v)
UT_Vector4T< T > & operator-= (const UT_Vector4T< T > &v)
unsigned operator== (const UT_Vector4T< T > &v) const
unsigned operator!= (const UT_Vector4T< T > &v) const
int equalZero (T tol=0.00001f) const
int equalZero3 (T tol=0.00001f) const
void clampZero (T tol=0.00001f)
void clampZero3 (T tol=0.00001f)
void negate3 ()
void negate ()
void multiplyComponents (const UT_Vector4T< T > &v)
int isEqual (const UT_Vector4T< T > &v, T tol=0.00001f) const
int isEqual (const UT_Vector3T< T > &vect, T tol=0.00001f) const
bool isNan () const
UT_Vector4T< T > & operator= (T scalar)
UT_Vector4T< T > & operator+= (T scalar)
UT_Vector4T< T > & operator-= (T scalar)
UT_Vector4T< T > & operator*= (T scalar)
UT_Vector4T< T > & operator*= (const UT_Vector4T< T > &v)
UT_Vector4T< T > & operator/= (T scalar)
UT_Vector4T< T > & operator/= (const UT_Vector4T< T > &v)
maxComponent () const
minComponent () const
avgComponent () const
dot (const UT_Vector4T< T > &v) const
void normalize (void)
length (void) const
 The vector length (not to be confused with the vector dimension).
length2 (void) const
 The vector length squared.
unsigned hash () const
 Compute a hash.
void assign (T xx=0.0f, T yy=0.0f, T zz=0.0f, T ww=1.0f)
 Set the values of the vector components.
void assign (const T *v, int size=tuple_size)
 Set the values of the vector components.
void save (ostream &os, int binary=0) const
bool load (UT_IStream &is)
template<typename S >
void rowVecMult (const UT_Matrix4T< S > &m)
template<typename S >
void colVecMult (const UT_Matrix4T< S > &m)
template<typename S >
void rowVecMult3 (const UT_Matrix4T< S > &m)
template<typename S >
UT_Vector4T< T > & operator*= (const UT_Matrix4T< S > &mat)
template<typename S >
void multiply3 (const UT_Matrix4T< S > &mat)
template<typename S >
void multiply3 (UT_Vector4T< T > &dest, const UT_Matrix4T< S > &mat) const
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 & z (void)
z (void) const
T & w (void)
w (void) const
T & operator() (unsigned i)
operator() (unsigned i) const
T & operator[] (unsigned i)
operator[] (unsigned i) const
std::vector< T > asStdVector () 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.
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.

Static Public Attributes

static const int tuple_size = 4

Friends

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


Detailed Description

template<typename T>
class UT_Vector4T< T >

4D Vector class.

Definition at line 141 of file UT_Vector4.h.


Member Typedef Documentation

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

Definition at line 145 of file UT_Vector4.h.


Constructor & Destructor Documentation

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

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

Definition at line 150 of file UT_Vector4.h.

template<typename T>
UT_Vector4T< T >::UT_Vector4T ( vx,
vy,
vz,
vw = 1.0f 
) [inline]

Definition at line 153 of file UT_Vector4.h.

template<typename T>
UT_Vector4T< T >::UT_Vector4T ( const fpreal32  v[tuple_size]  )  [inline]

Definition at line 157 of file UT_Vector4.h.

template<typename T>
UT_Vector4T< T >::UT_Vector4T ( const fpreal64  v[tuple_size]  )  [inline]

Definition at line 161 of file UT_Vector4.h.

template<typename T>
UT_Vector4T< T >::UT_Vector4T ( const UT_Vector3T< T > &  v,
w = 1.f 
) [inline, explicit]

Definition at line 563 of file UT_Vector4.h.

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

Definition at line 169 of file UT_Vector4.h.


Member Function Documentation

template<typename T>
void UT_Vector4T< T >::assign ( const T *  v,
int  size = tuple_size 
) [inline]

Set the values of the vector components.

Definition at line 504 of file UT_Vector4.h.

template<typename T>
void UT_Vector4T< T >::assign ( xx = 0.0f,
yy = 0.0f,
zz = 0.0f,
ww = 1.0f 
) [inline]

Set the values of the vector components.

Definition at line 498 of file UT_Vector4.h.

template<typename T>
std::vector<T> UT_Vector4T< T >::asStdVector (  )  const

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

template<typename T>
T UT_Vector4T< T >::avgComponent (  )  const [inline]

Definition at line 375 of file UT_Vector4.h.

template<typename T>
void UT_Vector4T< T >::clampZero ( tol = 0.00001f  )  [inline]

Definition at line 232 of file UT_Vector4.h.

template<typename T>
void UT_Vector4T< T >::clampZero3 ( tol = 0.00001f  )  [inline]

Definition at line 240 of file UT_Vector4.h.

template<typename T>
template<typename S >
void UT_Vector4T< T >::colVecMult ( const UT_Matrix4T< S > &  m  )  [inline]

If you need a multiplication operator that left multiplies the vector by a matrix (M * v), use the following colVecMult() functions. If you'd rather not use operator*=() for right-multiplications (v * M), use the following rowVecMult() functions.

Definition at line 281 of file UT_Vector4.h.

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

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

Definition at line 460 of file UT_Vector4.h.

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

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

Definition at line 459 of file UT_Vector4.h.

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

Express the point in homogeneous coordinates or vice-versa.

Definition at line 520 of file UT_Vector4.h.

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

Definition at line 435 of file UT_Vector4.h.

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

Returns the vector size.

Definition at line 544 of file UT_Vector4.h.

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

Definition at line 218 of file UT_Vector4.h.

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

Definition at line 225 of file UT_Vector4.h.

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

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

Definition at line 407 of file UT_Vector4.h.

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

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

Definition at line 382 of file UT_Vector4.h.

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

Compute a hash.

Definition at line 493 of file UT_Vector4.h.

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

Express the point in homogeneous coordinates or vice-versa.

Definition at line 514 of file UT_Vector4.h.

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

Definition at line 573 of file UT_Vector4.h.

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

Definition at line 260 of file UT_Vector4.h.

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

Definition at line 269 of file UT_Vector4.h.

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

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

Definition at line 449 of file UT_Vector4.h.

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

The vector length squared.

Definition at line 453 of file UT_Vector4.h.

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

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

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

template<typename T>
T UT_Vector4T< T >::maxComponent (  )  const [inline]

Definition at line 359 of file UT_Vector4.h.

template<typename T>
T UT_Vector4T< T >::minComponent (  )  const [inline]

Definition at line 367 of file UT_Vector4.h.

template<typename T>
template<typename S >
void UT_Vector4T< T >::multiply3 ( UT_Vector4T< T > &  dest,
const UT_Matrix4T< S > &  mat 
) const [inline]

Definition at line 309 of file UT_Vector4.h.

template<typename T>
template<typename S >
void UT_Vector4T< T >::multiply3 ( const UT_Matrix4T< S > &  mat  )  [inline]

Definition at line 306 of file UT_Vector4.h.

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

Definition at line 252 of file UT_Vector4.h.

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

Definition at line 249 of file UT_Vector4.h.

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

Definition at line 247 of file UT_Vector4.h.

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

Definition at line 439 of file UT_Vector4.h.

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

Definition at line 216 of file UT_Vector4.h.

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

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

Definition at line 474 of file UT_Vector4.h.

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

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

Definition at line 469 of file UT_Vector4.h.

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

Definition at line 336 of file UT_Vector4.h.

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

Definition at line 329 of file UT_Vector4.h.

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

Definition at line 302 of file UT_Vector4.h.

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

Definition at line 318 of file UT_Vector4.h.

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

Definition at line 193 of file UT_Vector4.h.

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

Definition at line 324 of file UT_Vector4.h.

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

Definition at line 202 of file UT_Vector4.h.

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

Definition at line 350 of file UT_Vector4.h.

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

Definition at line 345 of file UT_Vector4.h.

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

Definition at line 313 of file UT_Vector4.h.

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

Assignment operator that creates a V4 from a V3 by adding a '1' element.

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

Definition at line 174 of file UT_Vector4.h.

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

Definition at line 210 of file UT_Vector4.h.

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

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

Definition at line 484 of file UT_Vector4.h.

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

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

Definition at line 479 of file UT_Vector4.h.

template<typename T>
template<typename S >
void UT_Vector4T< T >::rowVecMult ( const UT_Matrix4T< S > &  m  )  [inline]

If you need a multiplication operator that left multiplies the vector by a matrix (M * v), use the following colVecMult() functions. If you'd rather not use operator*=() for right-multiplications (v * M), use the following rowVecMult() functions.

Definition at line 278 of file UT_Vector4.h.

template<typename T>
template<typename S >
void UT_Vector4T< T >::rowVecMult3 ( const UT_Matrix4T< S > &  m  )  [inline]

This multiply will ignore the 4th component both in the vector an in the matrix. This helps when you want to avoid affecting the 'w' component. This in turns annihilates the translation components (row 4) in mat, so be careful.

Definition at line 291 of file UT_Vector4.h.

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

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

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

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

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

template<typename T>
T UT_Vector4T< T >::w ( void   )  const [inline]

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

Definition at line 468 of file UT_Vector4.h.

template<typename T>
T& UT_Vector4T< T >::w ( void   )  [inline]

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

Definition at line 467 of file UT_Vector4.h.

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

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

Definition at line 462 of file UT_Vector4.h.

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

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

Definition at line 461 of file UT_Vector4.h.

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

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

Definition at line 464 of file UT_Vector4.h.

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

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

Definition at line 463 of file UT_Vector4.h.

template<typename T>
T UT_Vector4T< T >::z ( void   )  const [inline]

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

Definition at line 466 of file UT_Vector4.h.

template<typename T>
T& UT_Vector4T< T >::z ( void   )  [inline]

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

Definition at line 465 of file UT_Vector4.h.


Friends And Related Function Documentation

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

I/O friends.

Definition at line 549 of file UT_Vector4.h.


Member Data Documentation

template<typename T>
const int UT_Vector4T< T >::tuple_size = 4 [static]

Definition at line 146 of file UT_Vector4.h.


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

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