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_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_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 >
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 >
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 format (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 UT::FA::DotReturn_t
< T, 3 > 
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 957 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 1105 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 1099 of file UT_Vector3.h.

template<typename T >
constexpr UT::FA::DotReturn_t< T, 3 > 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 950 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 1193 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 , typename S >
UT_Vector3T<T> operator* ( const UT_Vector3T< T > &  v,
const UT_Matrix3T< S > &  m 
)
inline

Definition at line 1511 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 1877 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 915 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 922 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 880 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 859 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 873 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 894 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 866 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 901 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 908 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 929 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 944 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 887 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 1092 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 1159 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 1148 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 1113 of file UT_Vector3.h.

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

Definition at line 977 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 117 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 110 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 1028 of file UT_Vector3.h.

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

Definition at line 1059 of file UT_Vector3.h.

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

Componentwise integer test.

Definition at line 97 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 1006 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 1016 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 995 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 984 of file UT_Vector3.h.

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

Definition at line 1066 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 1073 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 1080 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 968 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 1172 of file UT_Vector3.h.

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

Definition at line 1245 of file UT_Vector3.h.