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_FixedVectorTraits.h"
#include "UT_Storage.h"
#include "UT_FixedArrayMath.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 <SYS/SYS_TypeTraits.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...
 
class  UT_FixedVector< T, D >
 
struct  UT_FixedVectorTraits< UT_Vector3T< T > >
 
struct  SYS_IsFixedArrayNoCVRef< UT_Vector3T< T > >
 
struct  SYS_FixedArrayElementNoCVRef< UT_Vector3T< T > >
 
struct  SYS_FixedArraySizeNoCVRef< UT_Vector3T< T > >
 
struct  UT_Vector3TFromUnbounded< T >
 
struct  UT_FromUnbounded< V >
 UT_FromUnbounded creates a V from an unbounded array-like type. More...
 
struct  UT_FromUnbounded< UT_Vector3T< T > >
 
struct  UT_Vector3TFromFixed< T >
 
struct  UT_FromFixed< V >
 
struct  UT_FromFixed< 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 >
constexpr UT_Vector3T< T > operator+ (const UT_Vector3T< T > &a, const UT_Vector3T< T > &b) noexcept
 
template<typename T >
constexpr UT_Vector3T< T > operator- (const UT_Vector3T< T > &a, const UT_Vector3T< T > &b) noexcept
 
template<typename T , typename S >
constexpr UT_Vector3T< T > operator+ (const UT_Vector3T< T > &v, S scalar) noexcept
 
template<typename T , typename S >
constexpr UT_Vector3T< T > operator- (const UT_Vector3T< T > &v, S scalar) noexcept
 
template<typename T , typename S >
constexpr UT_Vector3T< T > operator* (const UT_Vector3T< T > &v, S scalar) noexcept
 
template<typename T , typename S >
constexpr UT_Vector3T< T > operator/ (const UT_Vector3T< T > &v, S scalar) noexcept
 
template<typename T , typename S >
constexpr UT_Vector3T< T > operator+ (S scalar, const UT_Vector3T< T > &v) noexcept
 
template<typename T , typename S >
constexpr UT_Vector3T< T > operator- (S scalar, const UT_Vector3T< T > &v) noexcept
 
template<typename T , typename S >
constexpr UT_Vector3T< T > operator* (S scalar, const UT_Vector3T< T > &v) noexcept
 
template<typename T , typename S >
constexpr UT_Vector3T< T > operator/ (S scalar, const UT_Vector3T< T > &v) noexcept
 
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 >
bool SYSisEqual (const UT_Vector3T< T > &a, const UT_Vector3T< T > &b, S tol)
 Componentwise equality. More...
 
template<typename T >
bool SYSisEqual (const UT_Vector3T< T > &a, const UT_Vector3T< T > &b)
 
template<typename T >
bool SYSisInteger (const UT_Vector3T< T > &v1)
 Componentwise integer test. More...
 
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 >
UT_Vector3T< T > SYSinvlerp (const UT_Vector3T< T > &a, const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2)
 Componentwise inverse 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 >
rayPointDist2 (const UT_Vector3T< T > &pos, const UT_Vector3T< T > &orig, const UT_Vector3T< T > &dir)
 
template<typename T >
linePointDist2 (const UT_Vector3T< T > &pos, const UT_Vector3T< T > &orig, const UT_Vector3T< T > &dir)
 
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 >
constexpr UT_Vector3T< T > operator* (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2) noexcept
 
template<typename T >
constexpr UT_Vector3T< T > operator/ (const UT_Vector3T< T > &v1, const UT_Vector3T< T > &v2) noexcept
 
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 UTformatBuffer (char *buffer, size_t buffer_size, const UT_Vector3T< T > &v)
 
template<typename TS >
constexpr UT_Vector3T
< SYS_FixedArrayElement_t< TS > > 
UTmakeVector3T (const TS &as) noexcept
 
template<typename T >
constexpr auto dot (const UT_Vector3T< T > &a, const UT_Vector3T< T > &b) noexcept
 The dot and cross products between two vectors (see operator*() too) More...
 
template<typename T >
constexpr UT_Vector3T< T > cross (const UT_Vector3T< T > &a, const UT_Vector3T< T > &b) noexcept
 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 >
constexpr UT_Vector3T< T > cross ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
noexcept

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

Definition at line 969 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 1124 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 1118 of file UT_Vector3.h.

template<typename T >
constexpr auto dot ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
noexcept

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

Definition at line 962 of file UT_Vector3.h.

template<typename T >
size_t hash_value ( const UT_Vector3T< T > &  val)
inline

Definition at line 1238 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 close to being between 0.0 and 1.0 if this function returns true. NOTE: Does not test the actual distance of the projected points on each segment, merely that they are parmetrically within the segment!

template<typename T >
T linePointDist2 ( const UT_Vector3T< T > &  pos,
const UT_Vector3T< T > &  orig,
const UT_Vector3T< T > &  dir 
)
inline

Computes the squared minimum distance between a point and an infinite line. Direction vector need not be normalized.

Definition at line 1178 of file UT_Vector3.h.

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

Definition at line 1527 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 1917 of file UT_Matrix4.h.

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

Definition at line 927 of file UT_Vector3.h.

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

Definition at line 934 of file UT_Vector3.h.

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

Definition at line 892 of file UT_Vector3.h.

template<typename T >
constexpr UT_Vector3T< T > operator+ ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
noexcept

Definition at line 871 of file UT_Vector3.h.

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

Definition at line 885 of file UT_Vector3.h.

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

Definition at line 906 of file UT_Vector3.h.

template<typename T >
constexpr UT_Vector3T< T > operator- ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
noexcept

Definition at line 878 of file UT_Vector3.h.

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

Definition at line 913 of file UT_Vector3.h.

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

Definition at line 920 of file UT_Vector3.h.

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

Definition at line 941 of file UT_Vector3.h.

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

Definition at line 956 of file UT_Vector3.h.

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

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

template<typename T >
T rayPointDist2 ( const UT_Vector3T< T > &  pos,
const UT_Vector3T< T > &  orig,
const UT_Vector3T< T > &  dir 
)
inline

Compute the squared minimum distance between a point and a semi-infinite ray. Direction vector need not be normalized.

Definition at line 1165 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 1204 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 1193 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 1132 of file UT_Vector3.h.

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

Definition at line 989 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 121 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 114 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 >
UT_Vector3T< T > SYSinvlerp ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  v1,
const UT_Vector3T< T > &  v2 
)
inline

Componentwise inverse linear interpolation.

Definition at line 1047 of file UT_Vector3.h.

template<typename T , typename S >
bool SYSisEqual ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b,
tol 
)
inline

Componentwise equality.

Definition at line 1018 of file UT_Vector3.h.

template<typename T >
bool SYSisEqual ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
inline

Definition at line 97 of file UT_Vector3.h.

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

Definition at line 1078 of file UT_Vector3.h.

template<typename T >
bool SYSisInteger ( const UT_Vector3T< T > &  v1)
inline

Componentwise integer test.

Definition at line 101 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 1025 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 1035 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 1007 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 996 of file UT_Vector3.h.

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

Definition at line 1085 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 1092 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 1099 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 980 of file UT_Vector3.h.

template<typename T >
UT_API size_t UTformatBuffer ( char *  buffer,
size_t  buffer_size,
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 
)

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 1217 of file UT_Vector3.h.

template<typename TS >
constexpr UT_Vector3T< SYS_FixedArrayElement_t< TS > > UTmakeVector3T ( const TS &  as)
noexcept

Definition at line 1316 of file UT_Vector3.h.