UT_Vector3T< T > Class Template Reference

3D Vector class. More...

#include <UT_Vector3.h>

List of all members.

Public Types

typedef T value_type

Public Member Functions

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

Static Public Attributes

static const int tuple_size = 3

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.

Definition at line 174 of file UT_Vector3.h.


Member Typedef Documentation

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

Definition at line 178 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 183 of file UT_Vector3.h.

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

Definition at line 186 of file UT_Vector3.h.

template<typename T>
UT_Vector3T< T >::UT_Vector3T ( const fpreal16  v[tuple_size]  )  [inline]

Definition at line 190 of file UT_Vector3.h.

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

Definition at line 194 of file UT_Vector3.h.

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

Definition at line 198 of file UT_Vector3.h.

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

Definition at line 763 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 206 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 std::numeric_limits<T>::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 674 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 669 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 503 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 639 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 638 of file UT_Vector3.h.

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

Definition at line 267 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 319 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 315 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 311 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 307 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 342 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 338 of file UT_Vector3.h.

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

Definition at line 457 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 627 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.

Definition at line 626 of file UT_Vector3.h.

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

conversion between degrees and radians

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

Express the point in homogeneous coordinates or vice-versa.

Definition at line 686 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 462 of file UT_Vector3.h.

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

Returns the vector size.

Definition at line 739 of file UT_Vector3.h.

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

Definition at line 247 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 518 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 510 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 637 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 636 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 531 of file UT_Vector3.h.

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

Compute a hash.

Definition at line 664 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 681 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 254 of file UT_Vector3.h.

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

Definition at line 264 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).

Definition at line 543 of file UT_Vector3.h.

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

The vector length squared.

Definition at line 546 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 495 of file UT_Vector3.h.

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

Definition at line 499 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 405 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 400 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 385 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 363 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 395 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 376 of file UT_Vector3.h.

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

Definition at line 278 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 390 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 373 of file UT_Vector3.h.

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

Definition at line 275 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 479 of file UT_Vector3.h.

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

Definition at line 466 of file UT_Vector3.h.

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

Definition at line 245 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 645 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 640 of file UT_Vector3.h.

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

Definition at line 436 of file UT_Vector3.h.

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

Definition at line 428 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 359 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 356 of file UT_Vector3.h.

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

Definition at line 416 of file UT_Vector3.h.

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

Definition at line 224 of file UT_Vector3.h.

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

Definition at line 219 of file UT_Vector3.h.

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

Definition at line 423 of file UT_Vector3.h.

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

Definition at line 232 of file UT_Vector3.h.

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

Definition at line 449 of file UT_Vector3.h.

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

Definition at line 444 of file UT_Vector3.h.

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

Definition at line 411 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 211 of file UT_Vector3.h.

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

Definition at line 239 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 655 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 650 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 635 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 634 of file UT_Vector3.h.

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

conversion between degrees and radians

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 303 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 299 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 295 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 291 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 334 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 330 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 629 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.

Definition at line 628 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 631 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.

Definition at line 630 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 633 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.

Definition at line 632 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 747 of file UT_Vector3.h.


Member Data Documentation

template<typename T>
const int UT_Vector3T< T >::tuple_size = 3 [static]

Definition at line 179 of file UT_Vector3.h.

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

The data.

Definition at line 742 of file UT_Vector3.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