UT_Vector3T< T > Class Template Reference

3D Vector class. More...

#include <UT_Vector3.h>

List of all members.

Public Member Functions

 UT_Vector3T (void)
 UT_Vector3T (T vx, T vy, T vz)
 UT_Vector3T (const fpreal32 v[3])
 UT_Vector3T (const fpreal64 v[3])
 UT_Vector3T (const UT_Vector4T< T > &v)
template<typename S >
 UT_Vector3T (const UT_Vector3T< S > &v)
template<typename S >
UT_Vector3T< T > & operator= (const UT_Vector3T< S > &v)
UT_Vector3T< T > & operator= (const UT_Vector4T< T > &v)
 Assignment operator that truncates a V4 to a V3.
UT_Vector3T< T > operator- () const
UT_Vector3T< T > & operator+= (const UT_Vector3T< T > &v)
UT_Vector3T< T > & operator-= (const UT_Vector3T< T > &v)
unsigned operator== (const UT_Vector3T< T > &v) const
unsigned operator!= (const UT_Vector3T< T > &v) const
int equalZero (T tol=0.00001f) const
int isEqual (const UT_Vector3T< T > &vect, T tol=0.00001f) const
bool isNan () const
void clampZero (T tol=0.00001f)
void negate ()
void multiplyComponents (const UT_Vector3T< T > &v)
UT_Vector3T< T > & operator= (T scalar)
UT_Vector3T< T > & operator+= (T scalar)
UT_Vector3T< T > & operator-= (T scalar)
UT_Vector3T< T > & operator*= (T scalar)
UT_Vector3T< T > & operator*= (const UT_Vector3T< T > &v)
UT_Vector3T< T > & operator/= (T scalar)
UT_Vector3T< T > & operator/= (const UT_Vector3T< T > &v)
void cross (const UT_Vector3T< T > &v)
dot (const UT_Vector3T< T > &v) const
normalize (void)
void normal (const UT_Vector3T< T > &va, const UT_Vector3T< T > &vb)
void normal (const UT_Vector4T< T > &va, const UT_Vector4T< T > &vb)
void arbitraryPerp (const UT_Vector3T< T > &v)
 Finds an arbitrary perpendicular to v, and sets this to it.
void makeOrthonormal (const UT_Vector3T< T > &v)
maxComponent () const
 Find the maximum component.
minComponent () const
avgComponent () const
void getFrameOfReference (UT_Vector3T< T > &X, UT_Vector3T< T > &Y) const
length (void) const
 The vector length (not to be confused with the vector dimension).
length2 (void) const
 The vector length squared.
UT_Vector3T< T > project (const UT_Vector3T< T > &u) const
 Calculates the orthogonal projection of a vector u on the *this vector.
template<typename S >
UT_Matrix3T< S > project (int norm=1)
UT_Vector3T< T > projection (const UT_Vector3T< T > &p, const UT_Vector3T< T > &v) const
UT_Vector3T< T > projectOnSegment (const UT_Vector3T< T > &va, const UT_Vector3T< T > &vb) const
UT_Vector3T< T > projectOnSegment (const UT_Vector3T< T > &va, const UT_Vector3T< T > &vb, T &t) const
UT_Matrix3 symmetry (int norm=1)
int lineIntersect (const UT_Vector3T< T > &p1, const UT_Vector3T< T > &v1, const UT_Vector3T< T > &p2, const UT_Vector3T< T > &v2)
int segLineIntersect (const UT_Vector3T< T > &pa, const UT_Vector3T< T > &pb, const UT_Vector3T< T > &p2, const UT_Vector3T< T > &v2)
bool areCollinear (const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, T *t=0, T tol=1e-5) const
UT_Vector3T< T > getBary (const UT_Vector3T< T > &t0, const UT_Vector3T< T > &t1, const UT_Vector3T< T > &t2, bool *degen=NULL) const
distance (const UT_Vector3T< T > &p1, const UT_Vector3T< T > &v1) const
 Compute the signed distance from us to a line.
distance (const UT_Vector3T< T > &p1, const UT_Vector3T< T > &v1, const UT_Vector3T< T > &p2, const UT_Vector3T< T > &v2) const
 Compute the signed distance between two lines.
unsigned hash () const
 Compute a hash.
void assign (T xx=0.0f, T yy=0.0f, T zz=0.0f)
 Set the values of the vector components.
void assign (const T *v)
 Set the values of the vector components.
void roundAngles (const UT_Vector3T< T > &base)
void roundAngles (const UT_Vector3T< T > &b, const UT_XformOrder &o)
template<typename S >
void getDual (UT_Matrix3T< S > &dual) const
void rowVecMult (const UT_Matrix3 &m)
void rowVecMult (const UT_Matrix4 &m)
void rowVecMult (const UT_DMatrix3 &m)
void rowVecMult (const UT_DMatrix4 &m)
void colVecMult (const UT_Matrix3 &m)
void colVecMult (const UT_Matrix4 &m)
void colVecMult (const UT_DMatrix3 &m)
void colVecMult (const UT_DMatrix4 &m)
void rowVecMult3 (const UT_Matrix4 &m)
void rowVecMult3 (const UT_DMatrix4 &m)
void colVecMult3 (const UT_Matrix4 &m)
void colVecMult3 (const UT_DMatrix4 &m)
template<typename S >
UT_Vector3T< T > & operator*= (const UT_Matrix3T< S > &m)
template<typename S >
UT_Vector3T< T > & operator*= (const UT_Matrix4T< S > &m)
template<typename S >
void multiply3 (const UT_Matrix4T< S > &mat)
template<typename S >
void multiplyT (const UT_Matrix3T< S > &mat)
template<typename S >
void multiply3T (const UT_Matrix4T< S > &mat)
template<typename S >
void multiply3 (UT_Vector3T< T > &dest, const UT_Matrix4T< S > &mat) const
template<typename S >
void multiplyT (UT_Vector3T< T > &dest, const UT_Matrix3T< S > &mat) const
template<typename S >
void multiply3T (UT_Vector3T< T > &dest, const UT_Matrix4T< S > &mat) const
template<typename S >
void multiply (UT_Vector3T< T > &dest, const UT_Matrix4T< S > &mat) const
template<typename S >
void multiply (UT_Vector3T< T > &dest, const UT_Matrix3T< 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 & r (void)
r (void) const
T & g (void)
g (void) const
T & b (void)
b (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.
void degToRad ()
 conversion between degrees and radians
void radToDeg ()
 conversion between degrees and radians
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 [3]
 The data.

Friends

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


Detailed Description

template<typename T>
class UT_Vector3T< T >

3D Vector class.
Examples:

SOP/SOP_IKSample.C, and SOP/SOP_IKSample.h.

Definition at line 174 of file UT_Vector3.h.


Constructor & Destructor Documentation

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

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

Definition at line 178 of file UT_Vector3.h.

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

Definition at line 181 of file UT_Vector3.h.

template<typename T>
UT_Vector3T< T >::UT_Vector3T ( const fpreal32  v[3]  )  [inline]

Definition at line 185 of file UT_Vector3.h.

template<typename T>
UT_Vector3T< T >::UT_Vector3T ( const fpreal64  v[3]  )  [inline]

Definition at line 189 of file UT_Vector3.h.

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

Definition at line 754 of file UT_Vector3.h.

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

Definition at line 197 of file UT_Vector3.h.


Member Function Documentation

template<typename T>
void UT_Vector3T< T >::arbitraryPerp ( const UT_Vector3T< T > &  v  ) 

Finds an arbitrary perpendicular to v, and sets this to it.

template<typename T>
bool UT_Vector3T< T >::areCollinear ( const UT_Vector3T< T > &  p0,
const UT_Vector3T< T > &  p1,
T *  t = 0,
tol = 1e-5 
) const

Determines whether or not the points p0, p1 and "this" are collinear. If they are t contains the parametric value of where "this" is found on the segment from p0 to p1 and returns true. Otherwise returns false. If p0 and p1 are equal, t is set to FLT_MAX and true is returned.

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

Set the values of the vector components.

Definition at line 665 of file UT_Vector3.h.

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

Set the values of the vector components.

Definition at line 660 of file UT_Vector3.h.

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

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

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

Definition at line 494 of file UT_Vector3.h.

template<typename T>
T UT_Vector3T< T >::b ( void   )  const [inline]

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

Definition at line 630 of file UT_Vector3.h.

template<typename T>
T& UT_Vector3T< T >::b ( void   )  [inline]

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

Definition at line 629 of file UT_Vector3.h.

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

Definition at line 258 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::colVecMult ( const UT_DMatrix4 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. The methods that take a 4x4 matrix first extend this vector to 4D by adding an element equal to 1.0.

Definition at line 310 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::colVecMult ( const UT_DMatrix3 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. The methods that take a 4x4 matrix first extend this vector to 4D by adding an element equal to 1.0.

Definition at line 306 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::colVecMult ( const UT_Matrix4 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. The methods that take a 4x4 matrix first extend this vector to 4D by adding an element equal to 1.0.

Definition at line 302 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::colVecMult ( const UT_Matrix3 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. The methods that take a 4x4 matrix first extend this vector to 4D by adding an element equal to 1.0.

Definition at line 298 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::colVecMult3 ( const UT_DMatrix4 m  )  [inline]

This multiply will not extend the vector by adding a fourth element. Instead, it converts the Matrix4 to a Matrix3. This means that the translate component of the matrix is not applied to the vector

Definition at line 333 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::colVecMult3 ( const UT_Matrix4 m  )  [inline]

This multiply will not extend the vector by adding a fourth element. Instead, it converts the Matrix4 to a Matrix3. This means that the translate component of the matrix is not applied to the vector

Definition at line 329 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::cross ( const UT_Vector3T< T > &  v  )  [inline]

Definition at line 448 of file UT_Vector3.h.

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

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

Definition at line 618 of file UT_Vector3.h.

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

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

Examples:
SOP/SOP_IKSample.C, and SOP/SOP_IKSample.h.

Definition at line 617 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::degToRad (  ) 

conversion between degrees and radians

Examples:
SOP/SOP_IKSample.C.

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

Express the point in homogeneous coordinates or vice-versa.

Definition at line 677 of file UT_Vector3.h.

template<typename T>
T UT_Vector3T< T >::distance ( const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  p2,
const UT_Vector3T< T > &  v2 
) const

Compute the signed distance between two lines.

template<typename T>
T UT_Vector3T< T >::distance ( const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  v1 
) const

Compute the signed distance from us to a line.

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

Definition at line 453 of file UT_Vector3.h.

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

Returns the vector size.

Definition at line 730 of file UT_Vector3.h.

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

Definition at line 238 of file UT_Vector3.h.

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

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

Definition at line 509 of file UT_Vector3.h.

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

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

Definition at line 501 of file UT_Vector3.h.

template<typename T>
T UT_Vector3T< T >::g ( void   )  const [inline]

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

Definition at line 628 of file UT_Vector3.h.

template<typename T>
T& UT_Vector3T< T >::g ( void   )  [inline]

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

Definition at line 627 of file UT_Vector3.h.

template<typename T>
UT_Vector3T<T> UT_Vector3T< T >::getBary ( const UT_Vector3T< T > &  t0,
const UT_Vector3T< T > &  t1,
const UT_Vector3T< 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>
template<typename S >
void UT_Vector3T< T >::getDual ( UT_Matrix3T< S > &  dual  )  const [inline]

Return the dual of the vector The dual is a matrix which acts like the cross product when multiplied by other vectors. The following are equivalent: a.getDual(A); c = colVecMult(A, b) c = cross(a, b)

template<typename T>
void UT_Vector3T< T >::getFrameOfReference ( UT_Vector3T< T > &  X,
UT_Vector3T< T > &  Y 
) const [inline]

Given this vector as the z-axis, get a frame of reference such that the X and Y vectors are orthonormal to the vector. This vector should be normalized.

Definition at line 522 of file UT_Vector3.h.

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

Compute a hash.

Definition at line 655 of file UT_Vector3.h.

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

Express the point in homogeneous coordinates or vice-versa.

Definition at line 672 of file UT_Vector3.h.

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

Definition at line 245 of file UT_Vector3.h.

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

Definition at line 255 of file UT_Vector3.h.

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

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

Examples:
SOP/SOP_IKSample.C.

Definition at line 534 of file UT_Vector3.h.

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

The vector length squared.

Definition at line 537 of file UT_Vector3.h.

template<typename T>
int UT_Vector3T< T >::lineIntersect ( const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  p2,
const UT_Vector3T< T > &  v2 
)

This method stores in (*this) the intersection between two 3D lines, p1+t*v1 and p2+u*v2. If the two lines do not actually intersect, we shift the 2nd line along the perpendicular on both lines (along the line of min distance) and return the shifted intersection point; this point thus lies on the 1st line. If we find an intersection point (shifted or not) we return 0; if the two lines are parallel we return -1; and if they intersect behind our back we return -2. When we return -2 there still is a valid intersection point in (*this).

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

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

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

Protected I/O methods.

template<typename T>
void UT_Vector3T< T >::makeOrthonormal ( const UT_Vector3T< T > &  v  ) 

Makes this orthogonal to the given vector. If they are colinear, does an arbitrary perp

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

Find the maximum component.

Definition at line 486 of file UT_Vector3.h.

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

Definition at line 490 of file UT_Vector3.h.

template<typename T>
template<typename S >
void UT_Vector3T< T >::multiply ( UT_Vector3T< T > &  dest,
const UT_Matrix3T< S > &  mat 
) const [inline]

The following methods implement multiplies (row) vector by a matrix, however, the resulting vector is specified by the dest parameter These operations are safe even if "dest" is the same as "this".

Definition at line 396 of file UT_Vector3.h.

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

The following methods implement multiplies (row) vector by a matrix, however, the resulting vector is specified by the dest parameter These operations are safe even if "dest" is the same as "this".

Definition at line 391 of file UT_Vector3.h.

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

The following methods implement multiplies (row) vector by a matrix, however, the resulting vector is specified by the dest parameter These operations are safe even if "dest" is the same as "this".

Definition at line 376 of file UT_Vector3.h.

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

The *=, multiply, multiply3 and multiplyT routines are provided for legacy reasons. They all assume that *this is a row vector. Generally, the rowVecMult and colVecMult methods are preferred, since they're more explicit about the row vector assumption.

Definition at line 354 of file UT_Vector3.h.

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

The following methods implement multiplies (row) vector by a matrix, however, the resulting vector is specified by the dest parameter These operations are safe even if "dest" is the same as "this".

Definition at line 386 of file UT_Vector3.h.

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

This multiply will multiply the (row) vector by the transpose of the matrix instead of the matrix itself. This is faster than transposing the matrix, then multiplying (as well there's potentially less storage requirements).

Definition at line 367 of file UT_Vector3.h.

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

Definition at line 269 of file UT_Vector3.h.

template<typename T>
template<typename S >
void UT_Vector3T< T >::multiplyT ( UT_Vector3T< T > &  dest,
const UT_Matrix3T< S > &  mat 
) const [inline]

The following methods implement multiplies (row) vector by a matrix, however, the resulting vector is specified by the dest parameter These operations are safe even if "dest" is the same as "this".

Definition at line 381 of file UT_Vector3.h.

template<typename T>
template<typename S >
void UT_Vector3T< T >::multiplyT ( const UT_Matrix3T< S > &  mat  )  [inline]

This multiply will multiply the (row) vector by the transpose of the matrix instead of the matrix itself. This is faster than transposing the matrix, then multiplying (as well there's potentially less storage requirements).

Definition at line 364 of file UT_Vector3.h.

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

Definition at line 266 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::normal ( const UT_Vector4T< T > &  va,
const UT_Vector4T< T > &  vb 
)

template<typename T>
void UT_Vector3T< T >::normal ( const UT_Vector3T< T > &  va,
const UT_Vector3T< T > &  vb 
) [inline]

Definition at line 470 of file UT_Vector3.h.

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

Examples:
SOP/SOP_IKSample.C.

Definition at line 457 of file UT_Vector3.h.

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

Definition at line 236 of file UT_Vector3.h.

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

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

Definition at line 636 of file UT_Vector3.h.

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

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

Definition at line 631 of file UT_Vector3.h.

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

Definition at line 427 of file UT_Vector3.h.

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

Definition at line 419 of file UT_Vector3.h.

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

The *=, multiply, multiply3 and multiplyT routines are provided for legacy reasons. They all assume that *this is a row vector. Generally, the rowVecMult and colVecMult methods are preferred, since they're more explicit about the row vector assumption.

Definition at line 350 of file UT_Vector3.h.

template<typename T>
template<typename S >
UT_Vector3T<T>& UT_Vector3T< T >::operator*= ( const UT_Matrix3T< S > &  m  )  [inline]

The *=, multiply, multiply3 and multiplyT routines are provided for legacy reasons. They all assume that *this is a row vector. Generally, the rowVecMult and colVecMult methods are preferred, since they're more explicit about the row vector assumption.

Definition at line 347 of file UT_Vector3.h.

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

Definition at line 407 of file UT_Vector3.h.

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

Definition at line 215 of file UT_Vector3.h.

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

Definition at line 210 of file UT_Vector3.h.

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

Definition at line 414 of file UT_Vector3.h.

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

Definition at line 223 of file UT_Vector3.h.

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

Definition at line 440 of file UT_Vector3.h.

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

Definition at line 435 of file UT_Vector3.h.

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

Definition at line 402 of file UT_Vector3.h.

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

Assignment operator that truncates a V4 to a V3.

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

Definition at line 202 of file UT_Vector3.h.

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

Definition at line 230 of file UT_Vector3.h.

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

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

Definition at line 646 of file UT_Vector3.h.

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

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

Definition at line 641 of file UT_Vector3.h.

template<typename T>
template<typename S >
UT_Matrix3T<S> UT_Vector3T< T >::project ( int  norm = 1  )  [inline]

Create a matrix of projection onto this vector: the matrix transforms a vector v into its projection on the direction of (*this) vector, ie. dot(*this, v) * this->normalize(); If we need to be normalized, set norm to a non-zero value.

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

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

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

Vector p (representing a point in 3-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>
UT_Vector3T<T> UT_Vector3T< T >::projectOnSegment ( const UT_Vector3T< T > &  va,
const UT_Vector3T< T > &  vb,
T &  t 
) const

Projects this onto the line segment [a, b]. The fpreal t is set to the parametric position of intersection, a being 0 and b being 1.

template<typename T>
UT_Vector3T<T> UT_Vector3T< T >::projectOnSegment ( const UT_Vector3T< T > &  va,
const UT_Vector3T< T > &  vb 
) const

Projects this onto the line segement [a,b]. The returned point will lie between a and b.

template<typename T>
T UT_Vector3T< T >::r ( void   )  const [inline]

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

Definition at line 626 of file UT_Vector3.h.

template<typename T>
T& UT_Vector3T< T >::r ( void   )  [inline]

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

Definition at line 625 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::radToDeg (  ) 

conversion between degrees and radians

Examples:
SOP/SOP_IKSample.C.

template<typename T>
void UT_Vector3T< T >::roundAngles ( const UT_Vector3T< T > &  b,
const UT_XformOrder o 
)

It seems that given any rotation matrix and transform order, there are two distinct triples of rotations that will result in the same overall rotation. This method will find the closest of the two after finding the closest using the above method.

template<typename T>
void UT_Vector3T< T >::roundAngles ( const UT_Vector3T< T > &  base  ) 

assuming that "this" is a rotation (in radians, of course), the equivalent set of rotations which are closest to the "base" rotation are found. The equivalent rotations are the same as the original rotations +2*n*PI

template<typename T>
void UT_Vector3T< T >::rowVecMult ( const UT_DMatrix4 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. The methods that take a 4x4 matrix first extend this vector to 4D by adding an element equal to 1.0.

Definition at line 294 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::rowVecMult ( const UT_DMatrix3 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. The methods that take a 4x4 matrix first extend this vector to 4D by adding an element equal to 1.0.

Definition at line 290 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::rowVecMult ( const UT_Matrix4 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. The methods that take a 4x4 matrix first extend this vector to 4D by adding an element equal to 1.0.

Definition at line 286 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::rowVecMult ( const UT_Matrix3 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. The methods that take a 4x4 matrix first extend this vector to 4D by adding an element equal to 1.0.

Definition at line 282 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::rowVecMult3 ( const UT_DMatrix4 m  )  [inline]

This multiply will not extend the vector by adding a fourth element. Instead, it converts the Matrix4 to a Matrix3. This means that the translate component of the matrix is not applied to the vector

Definition at line 325 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::rowVecMult3 ( const UT_Matrix4 m  )  [inline]

This multiply will not extend the vector by adding a fourth element. Instead, it converts the Matrix4 to a Matrix3. This means that the translate component of the matrix is not applied to the vector

Definition at line 321 of file UT_Vector3.h.

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

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

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

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

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

Protected I/O methods.

template<typename T>
int UT_Vector3T< T >::segLineIntersect ( const UT_Vector3T< T > &  pa,
const UT_Vector3T< T > &  pb,
const UT_Vector3T< T > &  p2,
const UT_Vector3T< T > &  v2 
)

Compute the intersection of vector p2+t*v2 and the line segment between points pa and pb. If the two lines do not intersect we shift the (p2, v2) line along the line of min distance and return the point where it intersects the segment. If we find an intersection point along the stretch between pa and pb, we return 0. If the lines are parallel we return -1. If they intersect before pa we return -2, and if after pb, we return -3. The intersection point is valid with return codes 0,-2,-3.

template<typename T>
UT_Matrix3 UT_Vector3T< T >::symmetry ( int  norm = 1  ) 

Create a matrix of symmetry around this vector: the matrix transforms a vector v into its symmetry around (*this), ie. two times the projection of v onto (*this) minus v. If we need to be normalized, set norm to a non-zero value.

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

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

Definition at line 620 of file UT_Vector3.h.

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

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

Examples:
SOP/SOP_IKSample.C.

Definition at line 619 of file UT_Vector3.h.

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

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

Definition at line 622 of file UT_Vector3.h.

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

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

Examples:
SOP/SOP_IKSample.C.

Definition at line 621 of file UT_Vector3.h.

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

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

Definition at line 624 of file UT_Vector3.h.

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

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

Examples:
SOP/SOP_IKSample.C.

Definition at line 623 of file UT_Vector3.h.


Friends And Related Function Documentation

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

I/O friends.

Definition at line 738 of file UT_Vector3.h.


Member Data Documentation

template<typename T>
T UT_Vector3T< T >::vec[3]

The data.

Definition at line 733 of file UT_Vector3.h.


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

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