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

4D Vector class. More...

#include <UT_Vector4.h>

+ Inheritance diagram for UT_Vector4T< T >:

Public Types

typedef UT_FixedVector< T,
4, true > 
Base
 
typedef T value_type
 
- Public Types inherited from UT_FixedVector< T, 4, true >
typedef UT_FixedVector< T,
SIZE, INSTANTIATED > 
ThisType
 
typedef T value_type
 
typedef T theType
 
typedef UT_StorageNum< TStorage
 

Public Member Functions

SYS_FORCE_INLINE UT_Vector4T ()=default
 
SYS_FORCE_INLINE UT_Vector4T (const UT_Vector4T< T > &that)=default
 
SYS_FORCE_INLINE UT_Vector4T (UT_Vector4T< T > &&that)=default
 
SYS_FORCE_INLINE UT_Vector4T (T vx, T vy, T vz, T vw=1.0f)
 
SYS_FORCE_INLINE UT_Vector4T (const fpreal32 v[tuple_size])
 
SYS_FORCE_INLINE UT_Vector4T (const fpreal64 v[tuple_size])
 
SYS_FORCE_INLINE UT_Vector4T (const int32 v[tuple_size])
 
SYS_FORCE_INLINE UT_Vector4T (const int64 v[tuple_size])
 
SYS_FORCE_INLINE UT_Vector4T (const UT_Vector2T< T > &v)
 
SYS_FORCE_INLINE UT_Vector4T (const UT_Vector3T< T > &v, T w=1.f)
 
template<typename S >
SYS_FORCE_INLINE UT_Vector4T (const UT_Vector4T< S > &v)
 Our own type of any given value_type. More...
 
template<typename S , bool S_INSTANTIATED>
SYS_FORCE_INLINE UT_Vector4T (const UT_FixedVector< S, tuple_size, S_INSTANTIATED > &v)
 Arbitrary UT_FixedVector of the same size. More...
 
SYS_FORCE_INLINE UT_Vector4T< T > & operator= (const UT_Vector4T< T > &that)=default
 
SYS_FORCE_INLINE UT_Vector4T< T > & operator= (UT_Vector4T< T > &&that)=default
 
template<typename S >
SYS_FORCE_INLINE UT_Vector4T< T > & operator= (const UT_Vector4T< S > &v)
 
UT_Vector4T< T > & operator= (const UT_Vector3T< T > &v)
 
int equalZero3 (T tol=0.00001f) const
 
void clampZero (T tol=0.00001f)
 
void clampZero3 (T tol=0.00001f)
 
void negate3 ()
 
void multiplyComponents (const UT_Vector4T< T > &v)
 
int isEqual (const UT_Vector3T< T > &vect, T tol=0.00001f) const
 
unsigned hash () const
 Compute a hash. More...
 
void assign (T xx=0.0f, T yy=0.0f, T zz=0.0f, T ww=1.0f)
 Set the values of the vector components. More...
 
void assign (const T *v, int size=tuple_size)
 Set the values of the vector components. More...
 
void save (std::ostream &os, int binary=0) const
 
bool load (UT_IStream &is)
 
template<typename S >
void rowVecMult (const UT_Matrix4T< S > &m)
 
template<typename S >
void colVecMult (const UT_Matrix4T< S > &m)
 
template<typename S >
void rowVecMult3 (const UT_Matrix4T< S > &m)
 
template<typename S >
UT_Vector4T< T > & operator*= (const UT_Matrix4T< S > &mat)
 
template<typename S >
void multiply3 (const UT_Matrix4T< S > &mat)
 
template<typename S >
void multiply3 (UT_Vector4T< T > &dest, const UT_Matrix4T< 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...
 
Tx (void)
 
T x (void) const
 
Ty (void)
 
T y (void) const
 
Tz (void)
 
T z (void) const
 
Tw (void)
 
T w (void) const
 
Toperator() (unsigned i)
 
T operator() (unsigned i) const
 
void homogenize (void)
 Express the point in homogeneous coordinates or vice-versa. More...
 
void dehomogenize (void)
 Express the point in homogeneous coordinates or vice-versa. More...
 
bool save (UT_JSONWriter &w) const
 
bool save (UT_JSONValue &v) const
 
bool load (UT_JSONParser &p)
 
- Public Member Functions inherited from UT_FixedVector< T, 4, true >
SYS_FORCE_INLINE UT_FixedVector ()=default
 
SYS_FORCE_INLINE UT_FixedVector (T that) noexcept
 Initializes every component to the same value. More...
 
SYS_FORCE_INLINE UT_FixedVector (const ThisType &that)=default
 
SYS_FORCE_INLINE UT_FixedVector (ThisType &&that)=default
 
SYS_FORCE_INLINE UT_FixedVector (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) noexcept
 
SYS_FORCE_INLINE UT_FixedVector (const S that[SIZE]) noexcept
 
SYS_FORCE_INLINE const Toperator[] (exint i) const noexcept
 
SYS_FORCE_INLINE Toperator[] (exint i) noexcept
 
SYS_FORCE_INLINE constexpr
const T
data () const noexcept
 
SYS_FORCE_INLINE Tdata () noexcept
 
SYS_FORCE_INLINE ThisTypeoperator= (const ThisType &that)=default
 
SYS_FORCE_INLINE ThisTypeoperator= (ThisType &&that)=default
 
SYS_FORCE_INLINE ThisTypeoperator= (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) noexcept
 
SYS_FORCE_INLINE const ThisTypeoperator= (T that) noexcept
 
SYS_FORCE_INLINE void operator+= (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that)
 
SYS_FORCE_INLINE void operator+= (T that)
 
SYS_FORCE_INLINE
UT_FixedVector< typename
UT_StorageBetter< T, S >::Type,
SIZE
operator+ (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
 
SYS_FORCE_INLINE void operator-= (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that)
 
SYS_FORCE_INLINE void operator-= (T that)
 
SYS_FORCE_INLINE
UT_FixedVector< typename
UT_StorageBetter< T, S >::Type,
SIZE
operator- (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
 
SYS_FORCE_INLINE
UT_FixedVector< T, SIZE
operator- () const
 
SYS_FORCE_INLINE void operator*= (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that)
 
SYS_FORCE_INLINE void operator*= (T that)
 
SYS_FORCE_INLINE
UT_FixedVector< typename
UT_StorageBetter< T, S >::Type,
SIZE
operator* (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
 
SYS_FORCE_INLINE
UT_FixedVector< T, SIZE
operator* (T that) const
 
SYS_FORCE_INLINE void operator/= (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that)
 
SYS_FORCE_INLINE void operator/= (T that)
 
SYS_FORCE_INLINE
UT_FixedVector< typename
UT_StorageBetter< T, S >::Type,
SIZE
operator/ (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
 
SYS_FORCE_INLINE
UT_FixedVector< T, SIZE
operator/ (T that) const
 
SYS_FORCE_INLINE void negate ()
 
SYS_FORCE_INLINE bool operator== (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const noexcept
 
SYS_FORCE_INLINE bool operator!= (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const noexcept
 
SYS_FORCE_INLINE bool isNan () const
 
SYS_FORCE_INLINE bool isFinite () const
 
SYS_FORCE_INLINE bool isZero () const noexcept
 
SYS_FORCE_INLINE bool equalZero (T tol=T(SYS_FTOLERANCE)) const
 
SYS_FORCE_INLINE bool isEqual (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that, S tol=S(SYS_FTOLERANCE)) const
 
SYS_FORCE_INLINE T maxComponent () const
 
SYS_FORCE_INLINE T minComponent () const
 
SYS_FORCE_INLINE T avgComponent () const
 
SYS_FORCE_INLINE
UT_StorageAtLeast32Bit< T, T >
::Type 
length2 () const noexcept
 
SYS_FORCE_INLINE Storage::MathFloat length () const
 
SYS_FORCE_INLINE
UT_StorageAtLeast32Bit< T, S >
::Type 
dot (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
 
SYS_FORCE_INLINE
UT_StorageAtLeast32Bit< T, S >
::Type 
distance2 (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
 
SYS_FORCE_INLINE UT_StorageNum
< typename UT_StorageBetter< T,
S >::Type >::MathFloat 
distance (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
 
SYS_FORCE_INLINE Storage::MathFloat normalize ()
 
SYS_FORCE_INLINE bool operator< (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const noexcept
 
SYS_FORCE_INLINE bool operator<= (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const noexcept
 
SYS_FORCE_INLINE bool operator> (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const noexcept
 
SYS_FORCE_INLINE bool operator>= (const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const noexcept
 

Static Public Member Functions

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

Static Public Attributes

static const int tuple_size = 4
 
- Static Public Attributes inherited from UT_FixedVector< T, 4, true >
static const exint theSize
 

Friends

std::ostream & operator<< (std::ostream &os, const UT_Vector4T< T > &v)
 I/O friends. More...
 

Additional Inherited Members

- Public Attributes inherited from UT_FixedVector< T, 4, true >
T vec [SIZE]
 

Detailed Description

template<typename T>
class UT_Vector4T< T >

4D Vector class.

Examples:
COP2/COP2_SampleGenerator.h, and tetprim/GEO_PrimTetra.h.

Definition at line 163 of file UT_Vector4.h.

Member Typedef Documentation

template<typename T>
typedef UT_FixedVector<T,4,true> UT_Vector4T< T >::Base

Definition at line 166 of file UT_Vector4.h.

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

Definition at line 181 of file UT_Vector4.h.

Constructor & Destructor Documentation

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

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

template<typename T>
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( const UT_Vector4T< T > &  that)
default
template<typename T>
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( UT_Vector4T< T > &&  that)
default
template<typename T>
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( T  vx,
T  vy,
T  vz,
T  vw = 1.0f 
)
inline

Definition at line 191 of file UT_Vector4.h.

template<typename T>
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( const fpreal32  v[tuple_size])
inline

Definition at line 198 of file UT_Vector4.h.

template<typename T>
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( const fpreal64  v[tuple_size])
inline

Definition at line 201 of file UT_Vector4.h.

template<typename T>
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( const int32  v[tuple_size])
inline

Definition at line 204 of file UT_Vector4.h.

template<typename T>
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( const int64  v[tuple_size])
inline

Definition at line 207 of file UT_Vector4.h.

template<typename T>
UT_Vector4T< T >::UT_Vector4T ( const UT_Vector2T< T > &  v)
inlineexplicit

Definition at line 483 of file UT_Vector4.h.

template<typename T>
UT_Vector4T< T >::UT_Vector4T ( const UT_Vector3T< T > &  v,
T  w = 1.f 
)
inlineexplicit

Definition at line 491 of file UT_Vector4.h.

template<typename T>
template<typename S >
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( const UT_Vector4T< S > &  v)
inline

Our own type of any given value_type.

Definition at line 219 of file UT_Vector4.h.

template<typename T>
template<typename S , bool S_INSTANTIATED>
SYS_FORCE_INLINE UT_Vector4T< T >::UT_Vector4T ( const UT_FixedVector< S, tuple_size, S_INSTANTIATED > &  v)
inline

Arbitrary UT_FixedVector of the same size.

Definition at line 225 of file UT_Vector4.h.

Member Function Documentation

template<typename T>
void UT_Vector4T< T >::assign ( T  xx = 0.0f,
T  yy = 0.0f,
T  zz = 0.0f,
T  ww = 1.0f 
)
inline

Set the values of the vector components.

Definition at line 409 of file UT_Vector4.h.

template<typename T>
void UT_Vector4T< T >::assign ( const T v,
int  size = tuple_size 
)
inline

Set the values of the vector components.

Definition at line 415 of file UT_Vector4.h.

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

Definition at line 254 of file UT_Vector4.h.

template<typename T>
void UT_Vector4T< T >::clampZero3 ( T  tol = 0.00001f)
inline

Definition at line 262 of file UT_Vector4.h.

template<typename T>
template<typename S >
void UT_Vector4T< T >::colVecMult ( const UT_Matrix4T< S > &  m)
inline

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.

Definition at line 294 of file UT_Vector4.h.

template<typename T>
void UT_Vector4T< T >::dehomogenize ( void  )
inline

Express the point in homogeneous coordinates or vice-versa.

Definition at line 431 of file UT_Vector4.h.

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

Returns the vector size.

Definition at line 455 of file UT_Vector4.h.

template<typename T>
int UT_Vector4T< T >::equalZero3 ( T  tol = 0.00001f) const
inline

Definition at line 247 of file UT_Vector4.h.

template<typename T>
int UT_Vector4T< T >::findMaxAbsAxis ( ) const
inline

These allow you to find out what indices to use for different axes.

Definition at line 353 of file UT_Vector4.h.

template<typename T>
int UT_Vector4T< T >::findMinAbsAxis ( ) const
inline

These allow you to find out what indices to use for different axes.

Definition at line 328 of file UT_Vector4.h.

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

Compute a hash.

Definition at line 404 of file UT_Vector4.h.

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

Express the point in homogeneous coordinates or vice-versa.

Definition at line 425 of file UT_Vector4.h.

template<typename T>
int UT_Vector4T< T >::isEqual ( const UT_Vector3T< T > &  vect,
T  tol = 0.00001f 
) const
inline

Definition at line 513 of file UT_Vector4.h.

template<typename T>
bool UT_Vector4T< T >::load ( UT_IStream is)
template<typename T>
bool UT_Vector4T< T >::load ( UT_JSONParser p)

Methods to serialize to a JSON stream. The vector is stored as an array of 4 reals.

template<typename T>
template<typename S >
void UT_Vector4T< T >::multiply3 ( const UT_Matrix4T< S > &  mat)
inline

Definition at line 319 of file UT_Vector4.h.

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

Definition at line 322 of file UT_Vector4.h.

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

Definition at line 272 of file UT_Vector4.h.

template<typename T>
void UT_Vector4T< T >::negate3 ( )
inline

Definition at line 269 of file UT_Vector4.h.

template<typename T>
T& UT_Vector4T< T >::operator() ( unsigned  i)
inline

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

Definition at line 391 of file UT_Vector4.h.

template<typename T>
T UT_Vector4T< T >::operator() ( unsigned  i) const
inline

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

Definition at line 396 of file UT_Vector4.h.

template<typename T>
template<typename S >
UT_Vector4T<T>& UT_Vector4T< T >::operator*= ( const UT_Matrix4T< S > &  mat)
inline

Definition at line 315 of file UT_Vector4.h.

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

Definition at line 233 of file UT_Vector4.h.

template<typename T>
UT_Vector4T<T>& UT_Vector4T< T >::operator= ( const UT_Vector3T< T > &  v)

Assignment operator that creates a V4 from a V3 by adding a '1' element.

template<typename T>
template<typename S >
void UT_Vector4T< T >::rowVecMult ( const UT_Matrix4T< S > &  m)
inline

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.

Definition at line 291 of file UT_Vector4.h.

template<typename T>
template<typename S >
void UT_Vector4T< T >::rowVecMult3 ( const UT_Matrix4T< S > &  m)
inline

This multiply will ignore the 4th component both in the vector an in the matrix. This helps when you want to avoid affecting the 'w' component. This in turns annihilates the translation components (row 4) in mat, so be careful.

Definition at line 304 of file UT_Vector4.h.

template<typename T>
void UT_Vector4T< T >::save ( std::ostream &  os,
int  binary = 0 
) const
template<typename T>
bool UT_Vector4T< T >::save ( UT_JSONWriter w) const

Methods to serialize to a JSON stream. The vector is stored as an array of 4 reals.

template<typename T>
bool UT_Vector4T< T >::save ( UT_JSONValue v) const

Methods to serialize to a JSON stream. The vector is stored as an array of 4 reals.

template<typename T>
T& UT_Vector4T< T >::w ( void  )
inline

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

Examples:
COP2/COP2_SampleGenerator.h.

Definition at line 389 of file UT_Vector4.h.

template<typename T>
T UT_Vector4T< T >::w ( void  ) const
inline

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

Definition at line 390 of file UT_Vector4.h.

template<typename T>
T& UT_Vector4T< T >::x ( void  )
inline

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

Examples:
COP2/COP2_SampleGenerator.h.

Definition at line 383 of file UT_Vector4.h.

template<typename T>
T UT_Vector4T< T >::x ( void  ) const
inline

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

Definition at line 384 of file UT_Vector4.h.

template<typename T>
T& UT_Vector4T< T >::y ( void  )
inline

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

Examples:
COP2/COP2_SampleGenerator.h.

Definition at line 385 of file UT_Vector4.h.

template<typename T>
T UT_Vector4T< T >::y ( void  ) const
inline

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

Definition at line 386 of file UT_Vector4.h.

template<typename T>
T& UT_Vector4T< T >::z ( void  )
inline

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

Examples:
COP2/COP2_SampleGenerator.h.

Definition at line 387 of file UT_Vector4.h.

template<typename T>
T UT_Vector4T< T >::z ( void  ) const
inline

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

Definition at line 388 of file UT_Vector4.h.

Friends And Related Function Documentation

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

I/O friends.

Definition at line 460 of file UT_Vector4.h.

Member Data Documentation

template<typename T>
const int UT_Vector4T< T >::tuple_size = 4
static

Definition at line 182 of file UT_Vector4.h.


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