HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Vector3.h File Reference
#include "UT_API.h"
#include "UT_Assert.h"
#include "UT_FixedVector.h"
#include "UT_VectorTypes.h"
#include "UT_Vector2.h"
#include <SYS/SYS_Deprecated.h>
#include <SYS/SYS_Inline.h>
#include <SYS/SYS_Math.h>
#include <iosfwd>
#include <limits>
#include <vector>
#include "UT_Matrix3.h"
#include "UT_Matrix4.h"
#include "UT_Vector4.h"
+ Include dependency graph for UT_Vector3.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  UT_Vector3T< T >
 3D Vector class. More...
 
struct  UT_FixedVectorTraits< UT_Vector3T< T > >
 

Macros

#define __UT_Vector3_h__
 

Functions

template<typename T , typename S >
UT_Vector3T< T > operator* (const UT_Vector3T< T > &v, const UT_Matrix3T< S > &m)
 
template<typename T , typename S >
UT_Vector3T< T > operator* (const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
 
template<typename T >
UT_Vector3T< T > operator+ (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 
template<typename T >
UT_Vector3T< T > operator- (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 
template<typename T , typename S >
UT_Vector3T< T > operator+ (const UT_Vector3T< T > &v, S scalar)
 
template<typename T , typename S >
UT_Vector3T< T > operator- (const UT_Vector3T< T > &v, S scalar)
 
template<typename T , typename S >
UT_Vector3T< T > operator* (const UT_Vector3T< T > &v, S scalar)
 
template<typename T , typename S >
UT_Vector3T< T > operator/ (const UT_Vector3T< T > &v, S scalar)
 
template<typename T , typename S >
UT_Vector3T< T > operator+ (S scalar, const UT_Vector3T< T > &v)
 
template<typename T , typename S >
UT_Vector3T< T > operator- (S scalar, const UT_Vector3T< T > &v)
 
template<typename T , typename S >
UT_Vector3T< T > operator* (S scalar, const UT_Vector3T< T > &v)
 
template<typename T , typename S >
UT_Vector3T< T > operator/ (S scalar, const UT_Vector3T< T > &v)
 
template<typename T >
UT_Vector3T< T > SYSmin (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 Componentwise min and maximum. More...
 
template<typename T >
UT_Vector3T< T > SYSmax (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 
template<typename T , typename S >
UT_Vector3T< T > SYSlerp (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2, S t)
 Componentwise linear interpolation. More...
 
template<typename T , typename S >
UT_Vector3T< T > SYSbilerp (const UT_Vector3T< T > &u0v0, const UT_Vector3T< T > &u1v0, const UT_Vector3T< T > &u0v1, const UT_Vector3T< T > &u1v1, S u, S v)
 
template<typename T >
SYStrihat (const UT_Vector3T< T > &v, const UT_Vector3T< T > &s)
 Trilinear hat function over kernel widths in s. More...
 
template<typename T >
UT_Vector3T< T > SYStrihatgrad (const UT_Vector3T< T > &v, const UT_Vector3T< T > &s)
 Gradient of trilinear hat function over kernel widths in s. More...
 
template<typename T >
UT_Vector3T< T > project (const UT_Vector3T< T > &u, const UT_Vector3T< T > &v)
 The orthogonal projection of a vector u onto a vector v. More...
 
template<typename T >
distance3d (const UT_Vector3T< T > &p1, const UT_Vector3T< T > &p2)
 Compute the distance between two points. More...
 
template<typename T >
distance2 (const UT_Vector3T< T > &p1, const UT_Vector3T< T > &p2)
 Compute the distance squared. More...
 
template<typename T >
segmentPointDist2 (const UT_Vector3T< T > &pos, const UT_Vector3T< T > &pt1, const UT_Vector3T< T > &pt2)
 
template<typename T >
UT_API double intersectLines (const UT_Vector3T< T > &p1, const UT_Vector3T< T > &v1, const UT_Vector3T< T > &p2, const UT_Vector3T< T > &v2, T &t1, T &t2)
 
template<typename T >
UT_API bool intersectSegments (const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b, T &t)
 
template<typename T >
UT_API UT_Vector2T< T > segmentClosestParallel (const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
 
template<typename T >
UT_API UT_Vector2T< T > segmentClosest (const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
 
template<typename T >
UT_APIsegmentClosest (const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a)
 
template<typename T >
segmentDistance2 (const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
 Returns the squared distance between two line segments: p0-p1 and a-b. More...
 
template<typename T >
segmentDistance (const UT_Vector3T< T > &p0, const UT_Vector3T< T > &p1, const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
 Returns the distance between two line segments: p0-p1 and a-b. More...
 
template<typename T >
UT_Vector3T< T > operator* (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 
template<typename T >
UT_Vector3T< T > operator/ (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 
template<typename T >
int UTinverseTrilerpFlat (const UT_Vector3T< T > &input, const UT_Vector3T< T > &p0, const UT_Vector3T< T > &du, const UT_Vector3T< T > &dv, const UT_Vector3T< T > &dw, UT_Vector3T< T > &output)
 
template<typename T >
size_t hash_value (const UT_Vector3T< T > &val)
 
template<typename T >
UT_API size_t format (char *buffer, size_t buffer_size, const UT_Vector3T< T > &v)
 
template<typename T >
dot (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 The dot and cross products between two vectors (see operator*() too) More...
 
template<typename T >
UT_Vector3T< T > cross (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 The dot and cross products between two vectors (see operator*() too) More...
 
template<typename T >
fpreal64 UTangleBetween (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 The angle between two vectors in radians. More...
 
template<typename T , typename S >
UT_Vector3T< T > rowVecMult (const UT_Vector3T< T > &v, const UT_Matrix3T< S > &m)
 
template<typename T , typename S >
UT_Vector3T< T > colVecMult (const UT_Matrix3T< S > &m, const UT_Vector3T< T > &v)
 
template<typename T , typename S >
UT_Vector3T< T > rowVecMult (const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
 
template<typename T , typename S >
UT_Vector3T< T > colVecMult (const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
 
template<typename T , typename S >
UT_Vector3T< T > rowVecMult3 (const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
 
template<typename T , typename S >
UT_Vector3T< T > colVecMult3 (const UT_Matrix4T< S > &m, const UT_Vector3T< T > &v)
 

Macro Definition Documentation

#define __UT_Vector3_h__

Definition at line 20 of file UT_Vector3.h.

Function Documentation

template<typename T , typename S >
UT_Vector3T< T > colVecMult ( const UT_Matrix3T< S > &  m,
const UT_Vector3T< T > &  v 
)
inline

Multiplication of a row or column vector by a matrix (ie. right vs. left multiplication respectively). The operator*() declared above is an alias for rowVecMult(). The functions that take a 4x4 matrix first extend the vector to 4D (with a trailing 1.0 element).

Definition at line 904 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > colVecMult ( const UT_Matrix4T< S > &  m,
const UT_Vector3T< T > &  v 
)
inline

Multiplication of a row or column vector by a matrix (ie. right vs. left multiplication respectively). The operator*() declared above is an alias for rowVecMult(). The functions that take a 4x4 matrix first extend the vector to 4D (with a trailing 1.0 element).

Definition at line 937 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > colVecMult3 ( const UT_Matrix4T< S > &  m,
const UT_Vector3T< T > &  v 
)
inline

Multiplication of a row or column vector by a matrix (ie. right vs. left multiplication respectively). The operator*() declared above is an alias for rowVecMult(). The functions that take a 4x4 matrix first extend the vector to 4D (with a trailing 1.0 element).

Definition at line 948 of file UT_Vector3.h.

template<typename T >
UT_Vector3T< T > cross ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

The dot and cross products between two vectors (see operator*() too)

Definition at line 814 of file UT_Vector3.h.

template<typename T >
T distance2 ( const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  p2 
)
inline

Compute the distance squared.

Definition at line 980 of file UT_Vector3.h.

template<typename T >
T distance3d ( const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  p2 
)
inline

Compute the distance between two points.

Examples:
RAY/RAY_DemoMountain.C.

Definition at line 974 of file UT_Vector3.h.

template<typename T >
T dot ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

The dot and cross products between two vectors (see operator*() too)

Definition at line 807 of file UT_Vector3.h.

template<typename T >
UT_API size_t format ( char *  buffer,
size_t  buffer_size,
const UT_Vector3T< T > &  v 
)
template<typename T >
size_t hash_value ( const UT_Vector3T< T > &  val)
inline

Definition at line 1068 of file UT_Vector3.h.

template<typename T >
UT_API double intersectLines ( const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  p2,
const UT_Vector3T< T > &  v2,
T &  t1,
T &  t2 
)

Intersect the lines p1 + v1 * t1 and p2 + v2 * t2. t1 and t2 are set so that the lines intersect when projected to the plane defined by the two lines. This function returns a value which indicates how close to being parallel the lines are. Closer to zero means more parallel. This is done so that the user of this function can decide what epsilon they want to use.

template<typename T >
UT_API bool intersectSegments ( const UT_Vector3T< T > &  p0,
const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b,
T &  t 
)

Returns true if the segments from p0 to p1 and from a to b intersect, and t will contain the parametric value of the intersection on the segment a-b. Otherwise returns false. Parallel segments will return false. T is guaranteed to be between 0.0 and 1.0 if this function returns true.

template<typename T , typename S >
UT_Vector3T< T > operator* ( const UT_Vector3T< T > &  v,
const UT_Matrix3T< S > &  m 
)
inline

Definition at line 960 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator* ( const UT_Vector3T< T > &  v,
const UT_Matrix4T< S > &  m 
)
inline

Definition at line 967 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator* ( const UT_Vector3T< T > &  v,
scalar 
)
inline

Definition at line 776 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator* ( scalar,
const UT_Vector3T< T > &  v 
)
inline

Definition at line 783 of file UT_Vector3.h.

template<typename T >
UT_Vector3T<T> operator* ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

Definition at line 741 of file UT_Vector3.h.

template<typename T >
UT_Vector3T< T > operator+ ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

Definition at line 720 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator+ ( const UT_Vector3T< T > &  v,
scalar 
)
inline

Definition at line 734 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator+ ( scalar,
const UT_Vector3T< T > &  v 
)
inline

Definition at line 755 of file UT_Vector3.h.

template<typename T >
UT_Vector3T< T > operator- ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

Definition at line 727 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator- ( const UT_Vector3T< T > &  v,
scalar 
)
inline

Definition at line 762 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator- ( scalar,
const UT_Vector3T< T > &  v 
)
inline

Definition at line 769 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator/ ( const UT_Vector3T< T > &  v,
scalar 
)
inline

Definition at line 790 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > operator/ ( scalar,
const UT_Vector3T< T > &  v 
)
inline

Definition at line 800 of file UT_Vector3.h.

template<typename T >
UT_Vector3T<T> operator/ ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

Definition at line 748 of file UT_Vector3.h.

template<typename T >
UT_Vector3T< T > project ( const UT_Vector3T< T > &  u,
const UT_Vector3T< T > &  v 
)
inline

The orthogonal projection of a vector u onto a vector v.

Definition at line 886 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > rowVecMult ( const UT_Vector3T< T > &  v,
const UT_Matrix3T< S > &  m 
)
inline

Multiplication of a row or column vector by a matrix (ie. right vs. left multiplication respectively). The operator*() declared above is an alias for rowVecMult(). The functions that take a 4x4 matrix first extend the vector to 4D (with a trailing 1.0 element).

Definition at line 893 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > rowVecMult ( const UT_Vector3T< T > &  v,
const UT_Matrix4T< S > &  m 
)
inline

Multiplication of a row or column vector by a matrix (ie. right vs. left multiplication respectively). The operator*() declared above is an alias for rowVecMult(). The functions that take a 4x4 matrix first extend the vector to 4D (with a trailing 1.0 element).

Definition at line 915 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > rowVecMult3 ( const UT_Vector3T< T > &  v,
const UT_Matrix4T< S > &  m 
)
inline

Multiplication of a row or column vector by a matrix (ie. right vs. left multiplication respectively). The operator*() declared above is an alias for rowVecMult(). The functions that take a 4x4 matrix first extend the vector to 4D (with a trailing 1.0 element).

Examples:
SOP/MSS_CustomBrushState.C.

Definition at line 926 of file UT_Vector3.h.

template<typename T >
UT_API UT_Vector2T<T> segmentClosest ( const UT_Vector3T< T > &  p0,
const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)

Returns the U coordinates of the closest points on each of the two line segments

template<typename T >
UT_API T segmentClosest ( const UT_Vector3T< T > &  p0,
const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  a 
)

Returns the U coordinate of the point on line segment p0->p1 that is closest to a.

template<typename T >
UT_API UT_Vector2T<T> segmentClosestParallel ( const UT_Vector3T< T > &  p0,
const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)

Returns the U coordinates of the closest points on each of the two parallel line segments

template<typename T >
T segmentDistance ( const UT_Vector3T< T > &  p0,
const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
inline

Returns the distance between two line segments: p0-p1 and a-b.

Definition at line 1034 of file UT_Vector3.h.

template<typename T >
T segmentDistance2 ( const UT_Vector3T< T > &  p0,
const UT_Vector3T< T > &  p1,
const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
inline

Returns the squared distance between two line segments: p0-p1 and a-b.

Definition at line 1023 of file UT_Vector3.h.

template<typename T >
T segmentPointDist2 ( const UT_Vector3T< T > &  pos,
const UT_Vector3T< T > &  pt1,
const UT_Vector3T< T > &  pt2 
)
inline

Definition at line 988 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T<T> SYSbilerp ( const UT_Vector3T< T > &  u0v0,
const UT_Vector3T< T > &  u1v0,
const UT_Vector3T< T > &  u0v1,
const UT_Vector3T< T > &  u1v1,
u,
v 
)
inline

Definition at line 95 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T< T > SYSlerp ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2,
t 
)
inline

Componentwise linear interpolation.

Definition at line 857 of file UT_Vector3.h.

template<typename T >
UT_Vector3T< T > SYSmax ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

Definition at line 846 of file UT_Vector3.h.

template<typename T >
UT_Vector3T< T > SYSmin ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

Componentwise min and maximum.

Definition at line 835 of file UT_Vector3.h.

template<typename T >
T SYStrihat ( const UT_Vector3T< T > &  v,
const UT_Vector3T< T > &  s 
)
inline

Trilinear hat function over kernel widths in s.

Definition at line 867 of file UT_Vector3.h.

template<typename T >
UT_Vector3T< T > SYStrihatgrad ( const UT_Vector3T< T > &  v,
const UT_Vector3T< T > &  s 
)
inline

Gradient of trilinear hat function over kernel widths in s.

Definition at line 874 of file UT_Vector3.h.

template<typename T >
fpreal64 UTangleBetween ( const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

The angle between two vectors in radians.

Definition at line 826 of file UT_Vector3.h.

template<typename T >
int UTinverseTrilerpFlat ( const UT_Vector3T< T > &  input,
const UT_Vector3T< T > &  p0,
const UT_Vector3T< T > &  du,
const UT_Vector3T< T > &  dv,
const UT_Vector3T< T > &  dw,
UT_Vector3T< T > &  output 
)

Given a 3D position, input, and a 3D parallelpiped with corner p0 and directions du, dv, and dw, finds the 0 or 1 locations in the parameter space of that parallelpiped that correspond with the input position. Only a parameter location approximately between 0 and 1 is accepted. The return value is the number of accepted parameter locations, i.e. 0 or 1.

Definition at line 1047 of file UT_Vector3.h.