HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 "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)
 Bilinear interpolation. More...
 
template<typename T , typename S >
UT_Vector3T< T > SYSbarycentric (const UT_Vector3T< T > &v0, const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2, S u, S v)
 Barycentric interpolation. More...
 
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 >
UT_Vector3T< T > SYSabs (const UT_Vector3T< T > &v)
 
template<typename T >
UT_Vector3T< T > SYSlerp (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2, const UT_Vector3T< T > &t)
 
template<typename T >
UT_Vector3T< T > SYSclamp (const UT_Vector3T< T > &v, const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
 
template<typename T >
bool SYSequalZero (const UT_Vector3T< T > &v)
 
template<typename T >
bool SYSisFinite (const UT_Vector3T< T > &v)
 
template<typename T >
UT_Vector3T< T > SYSrecip (const UT_Vector3T< T > &v)
 
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...
 

Macro Definition Documentation

#define __UT_Vector3_h__

Definition at line 20 of file UT_Vector3.h.

Function Documentation

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 748 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 885 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 879 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 741 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 973 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 1466 of file UT_Matrix3.h.

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

Definition at line 1812 of file UT_Matrix4.h.

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

Definition at line 706 of file UT_Vector3.h.

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

Definition at line 713 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 671 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 650 of file UT_Vector3.h.

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

Definition at line 664 of file UT_Vector3.h.

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

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

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

Definition at line 692 of file UT_Vector3.h.

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

Definition at line 699 of file UT_Vector3.h.

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

Definition at line 720 of file UT_Vector3.h.

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

Definition at line 734 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 678 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 872 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 939 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 928 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 893 of file UT_Vector3.h.

template<typename T >
UT_Vector3T<T> SYSabs ( const UT_Vector3T< T > &  v)
inline

Definition at line 769 of file UT_Vector3.h.

template<typename T , typename S >
UT_Vector3T<T> SYSbarycentric ( const UT_Vector3T< T > &  v0,
const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2,
u,
v 
)
inline

Barycentric interpolation.

Definition at line 103 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

Bilinear interpolation.

Definition at line 96 of file UT_Vector3.h.

template<typename T >
UT_Vector3T<T> SYSclamp ( const UT_Vector3T< T > &  v,
const UT_Vector3T< T > &  min,
const UT_Vector3T< T > &  max 
)
inline
template<typename T >
bool SYSequalZero ( const UT_Vector3T< T > &  v)
inline
template<typename T >
bool SYSisFinite ( const UT_Vector3T< T > &  v)
inline

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

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

Definition at line 808 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 787 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 776 of file UT_Vector3.h.

template<typename T >
UT_Vector3T<T> SYSrecip ( const UT_Vector3T< T > &  v)
inline

Definition at line 846 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 853 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 860 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 760 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 952 of file UT_Vector3.h.