HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Vector3T< T > Class Template Reference

3D Vector class. More...

#include <TIL_DeepRasterReader.h>

Public Types

typedef T value_type
 

Public Member Functions

SYS_FORCE_INLINE UT_Vector3T ()=default
 
constexpr SYS_FORCE_INLINE UT_Vector3T (const UT_Vector3T< T > &that)=default
 
constexpr SYS_FORCE_INLINE UT_Vector3T (UT_Vector3T< T > &&that)=default
 
constexpr SYS_FORCE_INLINE UT_Vector3T (const T vx, const T vy, const T vz) noexcept
 
constexpr SYS_FORCE_INLINE UT_Vector3T (const T v) noexcept
 
constexpr SYS_FORCE_INLINE UT_Vector3T (const fpreal16 v[tuple_size]) noexcept
 
constexpr SYS_FORCE_INLINE UT_Vector3T (const fpreal32 v[tuple_size]) noexcept
 
constexpr SYS_FORCE_INLINE UT_Vector3T (const fpreal64 v[tuple_size]) noexcept
 
constexpr SYS_FORCE_INLINE UT_Vector3T (const int32 v[tuple_size]) noexcept
 
constexpr SYS_FORCE_INLINE UT_Vector3T (const int64 v[tuple_size]) noexcept
 
SYS_FORCE_INLINE UT_Vector3T (const UT_Vector2T< T > &v)
 
SYS_FORCE_INLINE UT_Vector3T (const UT_Vector4T< T > &v)
 
template<typename S >
constexpr SYS_FORCE_INLINE UT_Vector3T (const UT_Vector3T< S > &v) noexcept
 Our own type of any given value_type. More...
 
constexpr SYS_FORCE_INLINE
UT_Vector3T< T > & 
operator= (const UT_Vector3T< T > &that)=default
 
constexpr SYS_FORCE_INLINE
UT_Vector3T< T > & 
operator= (UT_Vector3T< T > &&that)=default
 
template<typename S >
SYS_FORCE_INLINE UT_Vector3T< T > & operator= (const UT_Vector3T< S > &v)
 
constexpr SYS_FORCE_INLINE
const T
operator[] (exint i) const noexcept
 
constexpr SYS_FORCE_INLINE Toperator[] (exint i) noexcept
 
constexpr SYS_FORCE_INLINE
const T
data () const noexcept
 
constexpr SYS_FORCE_INLINE Tdata () noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator+= (const UT_Vector3T &a) noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator-= (const UT_Vector3T &a) noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator+= (const T &a) noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator-= (const T &a) noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator*= (const T &a) noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator/= (const T &a) noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator*= (const UT_Vector3T &a) noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator/= (const UT_Vector3T &a) noexcept
 
constexpr SYS_FORCE_INLINE void negate () noexcept
 
constexpr SYS_FORCE_INLINE T length2 () const noexcept
 
constexpr SYS_FORCE_INLINE T length () const noexcept
 
constexpr SYS_FORCE_INLINE T distance2 (const UT_Vector3T &b) const noexcept
 
constexpr SYS_FORCE_INLINE T distance (const UT_Vector3T &b) const noexcept
 
SYS_FORCE_INLINE
UT_StorageMathFloat_t< T
normalize () noexcept
 
constexpr SYS_FORCE_INLINE bool isNan () const noexcept
 
constexpr SYS_FORCE_INLINE bool isFinite () const noexcept
 
constexpr SYS_FORCE_INLINE bool isZero () const noexcept
 
constexpr SYS_FORCE_INLINE bool equalZero (const T tolerance=SYS_FTOLERANCE) const noexcept
 
constexpr SYS_FORCE_INLINE bool isEqual (const UT_Vector3T &b, const T tolerance=SYS_FTOLERANCE) const noexcept
 
constexpr SYS_FORCE_INLINE T maxComponent () const noexcept
 
constexpr SYS_FORCE_INLINE T minComponent () const noexcept
 
constexpr SYS_FORCE_INLINE T avgComponent () const noexcept
 
UT_Vector3T< T > & operator= (const UT_Vector4T< T > &v)
 
constexpr SYS_FORCE_INLINE
UT_Vector3T
operator= (const T a) noexcept
 
constexpr SYS_FORCE_INLINE
UT_Vector3T< T
operator- () const noexcept
 
void clampZero (T tol=T(0.00001f))
 
SYS_FORCE_INLINE void multiplyComponents (const UT_Vector3T< T > &v)
 
constexpr SYS_FORCE_INLINE T dot (const UT_Vector3T &b) const noexcept
 
constexpr SYS_FORCE_INLINE void cross (const UT_Vector3T< T > &v) noexcept
 
SYS_FORCE_INLINE void normal (const UT_Vector3T< T > &va, const UT_Vector3T< T > &vb)
 
void arbitraryPerp (const UT_Vector3T< T > &v)
 Finds an arbitrary perpendicular to v, and sets this to it. More...
 
void makeOrthonormal (const UT_Vector3T< T > &v)
 
void getFrameOfReference (UT_Vector3T< T > &X, UT_Vector3T< T > &Y) const
 
UT_Vector3T< Tproject (const UT_Vector3T< T > &u) const
 Calculates the orthogonal projection of a vector u on the *this vector. More...
 
template<typename S >
UT_Matrix3T< Sproject (bool norm=true)
 
UT_Vector3T< Tprojection (const UT_Vector3T< T > &p, const UT_Vector3T< T > &v) const
 
UT_Vector3T< TprojectOnSegment (const UT_Vector3T< T > &va, const UT_Vector3T< T > &vb) const
 
UT_Vector3T< TprojectOnSegment (const UT_Vector3T< T > &va, const UT_Vector3T< T > &vb, T &t) const
 
UT_Matrix3 symmetry (bool norm=true)
 
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< TgetBary (const UT_Vector3T< T > &t0, const UT_Vector3T< T > &t1, const UT_Vector3T< T > &t2, bool *degen=NULL) const
 
T distance (const UT_Vector3T< T > &p1, const UT_Vector3T< T > &v1) const
 Compute the signed distance from us to a line. More...
 
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. More...
 
unsigned hash () const
 Compute a hash. More...
 
void assign (T xx=0.0f, T yy=0.0f, T zz=0.0f)
 Set the values of the vector components. More...
 
void assign (const T *v)
 Set the values of the vector components. More...
 
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
 
SYS_FORCE_INLINE void rowVecMult (const UT_Matrix3F &m)
 
SYS_FORCE_INLINE void rowVecMult (const UT_Matrix4F &m)
 
SYS_FORCE_INLINE void rowVecMult (const UT_Matrix3D &m)
 
SYS_FORCE_INLINE void rowVecMult (const UT_Matrix4D &m)
 
SYS_FORCE_INLINE void colVecMult (const UT_Matrix3F &m)
 
SYS_FORCE_INLINE void colVecMult (const UT_Matrix4F &m)
 
SYS_FORCE_INLINE void colVecMult (const UT_Matrix3D &m)
 
SYS_FORCE_INLINE void colVecMult (const UT_Matrix4D &m)
 
SYS_FORCE_INLINE void rowVecMult3 (const UT_Matrix4F &m)
 
SYS_FORCE_INLINE void rowVecMult3 (const UT_Matrix4D &m)
 
SYS_FORCE_INLINE void colVecMult3 (const UT_Matrix4F &m)
 
SYS_FORCE_INLINE void colVecMult3 (const UT_Matrix4D &m)
 
template<typename S >
SYS_FORCE_INLINE UT_Vector3T< T > & operator*= (const UT_Matrix3T< S > &m)
 
template<typename S >
SYS_FORCE_INLINE UT_Vector3T< T > & operator*= (const UT_Matrix4T< S > &m)
 
template<typename S >
SYS_FORCE_INLINE void multiply3 (const UT_Matrix4T< S > &mat)
 
template<typename S >
SYS_FORCE_INLINE void multiplyT (const UT_Matrix3T< S > &mat)
 
template<typename S >
SYS_FORCE_INLINE void multiply3T (const UT_Matrix4T< S > &mat)
 
template<typename S >
SYS_FORCE_INLINE void multiply3 (UT_Vector3T< T > &dest, const UT_Matrix4T< S > &mat) const
 
template<typename S >
SYS_FORCE_INLINE void multiplyT (UT_Vector3T< T > &dest, const UT_Matrix3T< S > &mat) const
 
template<typename S >
SYS_FORCE_INLINE void multiply3T (UT_Vector3T< T > &dest, const UT_Matrix4T< S > &mat) const
 
template<typename S >
SYS_FORCE_INLINE void multiply (UT_Vector3T< T > &dest, const UT_Matrix4T< S > &mat) const
 
template<typename S >
SYS_FORCE_INLINE 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. More...
 
int findMaxAbsAxis () const
 These allow you to find out what indices to use for different axes. More...
 
constexpr SYS_FORCE_INLINE Tx () noexcept
 
constexpr SYS_FORCE_INLINE T x () const noexcept
 
constexpr SYS_FORCE_INLINE Ty () noexcept
 
constexpr SYS_FORCE_INLINE T y () const noexcept
 
constexpr SYS_FORCE_INLINE Tz () noexcept
 
constexpr SYS_FORCE_INLINE T z () const noexcept
 
constexpr SYS_FORCE_INLINE Tr () noexcept
 
constexpr SYS_FORCE_INLINE T r () const noexcept
 
constexpr SYS_FORCE_INLINE Tg () noexcept
 
constexpr SYS_FORCE_INLINE T g () const noexcept
 
constexpr SYS_FORCE_INLINE Tb () noexcept
 
constexpr SYS_FORCE_INLINE T b () const noexcept
 
constexpr SYS_FORCE_INLINE Toperator() (unsigned i) noexcept
 
constexpr SYS_FORCE_INLINE T operator() (unsigned i) const noexcept
 
void homogenize ()
 Express the point in homogeneous coordinates or vice-versa. More...
 
void dehomogenize ()
 Express the point in homogeneous coordinates or vice-versa. More...
 
void degToRad ()
 conversion between degrees and radians More...
 
void radToDeg ()
 conversion between degrees and radians More...
 
void save (std::ostream &os, bool binary=false) const
 Protected I/O methods. More...
 
bool load (UT_IStream &is)
 Protected I/O methods. More...
 
bool save (UT_JSONWriter &w) const
 
bool save (UT_JSONValue &v) const
 
bool load (UT_JSONParser &p)
 
fpreal64 angleTo (const UT_Vector3T< T > &v) const
 

Static Public Member Functions

static int entries ()
 Returns the vector size. More...
 

Public Attributes

T vec [tuple_size]
 

Static Public Attributes

static constexpr int tuple_size = 3
 

Friends

constexpr bool isZero (const UT_Vector3T &a) noexcept
 
constexpr auto length2 (const UT_Vector3T &a) noexcept
 
constexpr auto distance2 (const UT_Vector3T &a, const UT_Vector3T &b) noexcept
 Compute the distance squared. More...
 
constexpr bool operator== (const UT_Vector3T &a, const UT_Vector3T &b) noexcept
 
constexpr bool operator!= (const UT_Vector3T &a, const UT_Vector3T &b) noexcept
 
constexpr bool operator< (const UT_Vector3T &a, const UT_Vector3T &b) noexcept
 
constexpr bool operator<= (const UT_Vector3T &a, const UT_Vector3T &b) noexcept
 
constexpr bool operator> (const UT_Vector3T &a, const UT_Vector3T &b) noexcept
 
constexpr bool operator>= (const UT_Vector3T &a, const UT_Vector3T &b) noexcept
 
std::ostream & operator<< (std::ostream &os, const UT_Vector3T< T > &v)
 I/O friends. More...
 

Detailed Description

template<typename T>
class UT_Vector3T< T >

3D Vector class.

Definition at line 24 of file TIL_DeepRasterReader.h.

Member Typedef Documentation

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

Definition at line 228 of file UT_Vector3.h.

Constructor & Destructor Documentation

template<typename T>
SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( )
default

Default constructor. No data is initialized! Use it for extra speed.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const UT_Vector3T< T > &  that)
default
template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( UT_Vector3T< T > &&  that)
default
template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const T  vx,
const T  vy,
const T  vz 
)
inlinenoexcept

Definition at line 238 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const T  v)
inlineexplicitnoexcept

Definition at line 242 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const fpreal16  v[tuple_size])
inlinenoexcept

Definition at line 246 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const fpreal32  v[tuple_size])
inlinenoexcept

Definition at line 249 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const fpreal64  v[tuple_size])
inlinenoexcept

Definition at line 252 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const int32  v[tuple_size])
inlinenoexcept

Definition at line 255 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const int64  v[tuple_size])
inlinenoexcept

Definition at line 258 of file UT_Vector3.h.

template<typename T>
SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const UT_Vector2T< T > &  v)
explicit

Definition at line 841 of file UT_Vector3.h.

template<typename T>
SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const UT_Vector4T< T > &  v)
explicit

Definition at line 848 of file UT_Vector3.h.

template<typename T>
template<typename S >
constexpr SYS_FORCE_INLINE UT_Vector3T< T >::UT_Vector3T ( const UT_Vector3T< S > &  v)
inlinenoexcept

Our own type of any given value_type.

Definition at line 267 of file UT_Vector3.h.

Member Function Documentation

template<typename T>
fpreal64 UT_Vector3T< T >::angleTo ( const UT_Vector3T< T > &  v) const
inline

Method to return the angle (in radians) between this and another vector

Definition at line 765 of file UT_Vector3.h.

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,
T  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 ( T  xx = 0.0f,
T  yy = 0.0f,
T  zz = 0.0f 
)
inline

Set the values of the vector components.

Definition at line 694 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::assign ( const T v)
inline

Set the values of the vector components.

Definition at line 699 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::avgComponent ( ) const
inlinenoexcept

Definition at line 418 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T& UT_Vector3T< T >::b ( )
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 673 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::b ( ) const
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 674 of file UT_Vector3.h.

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

Definition at line 436 of file UT_Vector3.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::colVecMult ( const UT_Matrix3F m)

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 1557 of file UT_Matrix3.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::colVecMult ( const UT_Matrix4F m)

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 2024 of file UT_Matrix4.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::colVecMult ( const UT_Matrix3D m)

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 1563 of file UT_Matrix3.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::colVecMult ( const UT_Matrix4D m)

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 2030 of file UT_Matrix4.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::colVecMult3 ( const UT_Matrix4F m)

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 2048 of file UT_Matrix4.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::colVecMult3 ( const UT_Matrix4D m)

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 2054 of file UT_Matrix4.h.

template<typename T>
constexpr SYS_FORCE_INLINE void UT_Vector3T< T >::cross ( const UT_Vector3T< T > &  v)
inlinenoexcept

Definition at line 534 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE const T* UT_Vector3T< T >::data ( ) const
inlinenoexcept

Definition at line 292 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T* UT_Vector3T< T >::data ( )
inlinenoexcept

Definition at line 297 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 ( )
inline

Express the point in homogeneous coordinates or vice-versa.

Definition at line 711 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::distance ( const UT_Vector3T< T > &  b) const
inlinenoexcept

Definition at line 371 of file UT_Vector3.h.

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 >::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>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::distance2 ( const UT_Vector3T< T > &  b) const
inlinenoexcept

Definition at line 366 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::dot ( const UT_Vector3T< T > &  b) const
inlinenoexcept

Definition at line 529 of file UT_Vector3.h.

template<typename T>
static int UT_Vector3T< T >::entries ( )
inlinestatic

Returns the vector size.

Definition at line 772 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE bool UT_Vector3T< T >::equalZero ( const T  tolerance = SYS_FTOLERANCE) const
inlinenoexcept

Definition at line 398 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 562 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 554 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T& UT_Vector3T< T >::g ( )
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 671 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::g ( ) const
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

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

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

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

Compute a hash.

Definition at line 689 of file UT_Vector3.h.

template<typename T>
void UT_Vector3T< T >::homogenize ( )
inline

Express the point in homogeneous coordinates or vice-versa.

Definition at line 706 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE bool UT_Vector3T< T >::isEqual ( const UT_Vector3T< T > &  b,
const T  tolerance = SYS_FTOLERANCE 
) const
inlinenoexcept

Definition at line 403 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE bool UT_Vector3T< T >::isFinite ( ) const
inlinenoexcept

Definition at line 388 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE bool UT_Vector3T< T >::isNan ( ) const
inlinenoexcept

Definition at line 383 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE bool UT_Vector3T< T >::isZero ( ) const
inlinenoexcept

Definition at line 393 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::length ( void  ) const
inlinenoexcept

Definition at line 361 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::length2 ( ) const
inlinenoexcept

Definition at line 356 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_IStream is)

Protected I/O methods.

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>
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>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::maxComponent ( ) const
inlinenoexcept

Definition at line 408 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::minComponent ( ) const
inlinenoexcept

Definition at line 413 of file UT_Vector3.h.

template<typename T>
template<typename S >
SYS_FORCE_INLINE void UT_Vector3T< T >::multiply ( UT_Vector3T< T > &  dest,
const UT_Matrix4T< S > &  mat 
) const

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 2097 of file UT_Matrix4.h.

template<typename T>
template<typename S >
SYS_FORCE_INLINE void UT_Vector3T< T >::multiply ( UT_Vector3T< T > &  dest,
const UT_Matrix3T< S > &  mat 
) const

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 1592 of file UT_Matrix3.h.

template<typename T >
template<typename S >
SYS_FORCE_INLINE void UT_Vector3T< T >::multiply3 ( const UT_Matrix4T< S > &  mat)

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 2069 of file UT_Matrix4.h.

template<typename T>
template<typename S >
SYS_FORCE_INLINE void UT_Vector3T< T >::multiply3 ( UT_Vector3T< T > &  dest,
const UT_Matrix4T< S > &  mat 
) const

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 2083 of file UT_Matrix4.h.

template<typename T >
template<typename S >
SYS_FORCE_INLINE void UT_Vector3T< T >::multiply3T ( const UT_Matrix4T< S > &  mat)

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 2076 of file UT_Matrix4.h.

template<typename T>
template<typename S >
SYS_FORCE_INLINE void UT_Vector3T< T >::multiply3T ( UT_Vector3T< T > &  dest,
const UT_Matrix4T< S > &  mat 
) const

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 2090 of file UT_Matrix4.h.

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

Definition at line 444 of file UT_Vector3.h.

template<typename T >
template<typename S >
SYS_FORCE_INLINE void UT_Vector3T< T >::multiplyT ( const UT_Matrix3T< S > &  mat)

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 1578 of file UT_Matrix3.h.

template<typename T>
template<typename S >
SYS_FORCE_INLINE void UT_Vector3T< T >::multiplyT ( UT_Vector3T< T > &  dest,
const UT_Matrix3T< S > &  mat 
) const

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 1585 of file UT_Matrix3.h.

template<typename T>
constexpr SYS_FORCE_INLINE void UT_Vector3T< T >::negate ( )
inlinenoexcept

Definition at line 351 of file UT_Vector3.h.

template<typename T>
SYS_FORCE_INLINE void UT_Vector3T< T >::normal ( const UT_Vector3T< T > &  va,
const UT_Vector3T< T > &  vb 
)
inline

Definition at line 539 of file UT_Vector3.h.

template<typename T>
SYS_FORCE_INLINE UT_StorageMathFloat_t< T > UT_Vector3T< T >::normalize ( )
inlinenoexcept

Definition at line 376 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T& UT_Vector3T< T >::operator() ( unsigned  i)
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 676 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::operator() ( unsigned  i) const
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 681 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T& UT_Vector3T< T >::operator*= ( const T a)
inlinenoexcept

Definition at line 326 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T& UT_Vector3T< T >::operator*= ( const UT_Vector3T< T > &  a)
inlinenoexcept

Definition at line 339 of file UT_Vector3.h.

template<typename T >
template<typename S >
SYS_FORCE_INLINE UT_Vector3T< T > & UT_Vector3T< T >::operator*= ( const UT_Matrix3T< S > &  m)

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 1570 of file UT_Matrix3.h.

template<typename T >
template<typename S >
SYS_FORCE_INLINE UT_Vector3T< T > & UT_Vector3T< T >::operator*= ( const UT_Matrix4T< S > &  m)

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 2061 of file UT_Matrix4.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T& UT_Vector3T< T >::operator+= ( const UT_Vector3T< T > &  a)
inlinenoexcept

Definition at line 302 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T& UT_Vector3T< T >::operator+= ( const T a)
inlinenoexcept

Definition at line 314 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T<T> UT_Vector3T< T >::operator- ( ) const
inlinenoexcept

Definition at line 431 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T& UT_Vector3T< T >::operator-= ( const UT_Vector3T< T > &  a)
inlinenoexcept

Definition at line 308 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T& UT_Vector3T< T >::operator-= ( const T a)
inlinenoexcept

Definition at line 320 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T& UT_Vector3T< T >::operator/= ( const T a)
inlinenoexcept

Definition at line 332 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T& UT_Vector3T< T >::operator/= ( const UT_Vector3T< T > &  a)
inlinenoexcept

Definition at line 345 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T<T>& UT_Vector3T< T >::operator= ( const UT_Vector3T< T > &  that)
default
template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T<T>& UT_Vector3T< T >::operator= ( UT_Vector3T< T > &&  that)
default
template<typename T>
template<typename S >
SYS_FORCE_INLINE UT_Vector3T<T>& UT_Vector3T< T >::operator= ( const UT_Vector3T< S > &  v)
inline

Definition at line 275 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. TODO: remove this. This should require an explicit UT_Vector3() construction, since it's unsafe.

template<typename T>
constexpr SYS_FORCE_INLINE UT_Vector3T< T > & UT_Vector3T< T >::operator= ( const T  a)
noexcept

Definition at line 856 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE const T& UT_Vector3T< T >::operator[] ( exint  i) const
inlinenoexcept

Definition at line 278 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T& UT_Vector3T< T >::operator[] ( exint  i)
inlinenoexcept

Definition at line 285 of file UT_Vector3.h.

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>
template<typename S >
UT_Matrix3T<S> UT_Vector3T< T >::project ( bool  norm = true)

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 non-false.

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 
) const

Projects this onto the line segement [a,b]. The returned point will lie between a and b.

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>
constexpr SYS_FORCE_INLINE T& UT_Vector3T< T >::r ( )
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 669 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::r ( ) const
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 670 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 > &  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 >::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 >
SYS_FORCE_INLINE void UT_Vector3T< T >::rowVecMult ( const UT_Matrix3F m)

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 1545 of file UT_Matrix3.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::rowVecMult ( const UT_Matrix4F m)

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 2012 of file UT_Matrix4.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::rowVecMult ( const UT_Matrix3D m)

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 1551 of file UT_Matrix3.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::rowVecMult ( const UT_Matrix4D m)

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 2018 of file UT_Matrix4.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::rowVecMult3 ( const UT_Matrix4F m)

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 2036 of file UT_Matrix4.h.

template<typename T >
SYS_FORCE_INLINE void UT_Vector3T< T >::rowVecMult3 ( const UT_Matrix4D m)

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 2042 of file UT_Matrix4.h.

template<typename T>
void UT_Vector3T< T >::save ( std::ostream &  os,
bool  binary = false 
) const

Protected I/O methods.

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>
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>
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 ( bool  norm = true)

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 non-false.

template<typename T>
constexpr SYS_FORCE_INLINE T& UT_Vector3T< T >::x ( )
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 663 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::x ( ) const
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 664 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T& UT_Vector3T< T >::y ( )
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 665 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::y ( ) const
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 666 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T& UT_Vector3T< T >::z ( )
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 667 of file UT_Vector3.h.

template<typename T>
constexpr SYS_FORCE_INLINE T UT_Vector3T< T >::z ( ) const
inlinenoexcept

Return the components of the vector. The () operator does NOT check for the boundary condition.

Definition at line 668 of file UT_Vector3.h.

Friends And Related Function Documentation

template<typename T>
constexpr auto distance2 ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
friend

Compute the distance squared.

Definition at line 788 of file UT_Vector3.h.

template<typename T>
constexpr bool isZero ( const UT_Vector3T< T > &  a)
friend

Definition at line 778 of file UT_Vector3.h.

template<typename T>
constexpr auto length2 ( const UT_Vector3T< T > &  a)
friend

Definition at line 783 of file UT_Vector3.h.

template<typename T>
constexpr bool operator!= ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
friend

Definition at line 798 of file UT_Vector3.h.

template<typename T>
constexpr bool operator< ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
friend

Lexicographic order comparison operators

Definition at line 805 of file UT_Vector3.h.

template<typename T>
std::ostream& operator<< ( std::ostream &  os,
const UT_Vector3T< T > &  v 
)
friend

I/O friends.

Definition at line 828 of file UT_Vector3.h.

template<typename T>
constexpr bool operator<= ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
friend

Lexicographic order comparison operators

Definition at line 810 of file UT_Vector3.h.

template<typename T>
constexpr bool operator== ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
friend

Definition at line 793 of file UT_Vector3.h.

template<typename T>
constexpr bool operator> ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
friend

Lexicographic order comparison operators

Definition at line 815 of file UT_Vector3.h.

template<typename T>
constexpr bool operator>= ( const UT_Vector3T< T > &  a,
const UT_Vector3T< T > &  b 
)
friend

Lexicographic order comparison operators

Definition at line 820 of file UT_Vector3.h.

Member Data Documentation

template<typename T>
constexpr int UT_Vector3T< T >::tuple_size = 3
static

Definition at line 229 of file UT_Vector3.h.

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

Definition at line 774 of file UT_Vector3.h.


The documentation for this class was generated from the following files: