HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
openvdb::OPENVDB_VERSION_NAME::math::Vec4< T > Class Template Reference

#include <Mat4.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >:

Public Types

typedef T value_type
 
typedef T ValueType
 
- Public Types inherited from openvdb::OPENVDB_VERSION_NAME::math::Tuple< 4, T >
typedef T value_type
 
typedef T ValueType
 

Public Member Functions

 Vec4 ()
 Trivial constructor, the vector is NOT initialized. More...
 
 Vec4 (T val)
 Construct a vector all of whose components have the given value. More...
 
 Vec4 (T x, T y, T z, T w)
 Constructor with four arguments, e.g. Vec4f v(1,2,3,4);. More...
 
template<typename Source >
 Vec4 (Source *a)
 Constructor with array argument, e.g. float a[4]; Vec4f v(a);. More...
 
template<typename Source >
 Vec4 (const Tuple< 4, Source > &v)
 Conversion constructor. More...
 
template<typename Other >
 Vec4 (Other val, typename std::enable_if< std::is_arithmetic< Other >::value, Conversion >::type=Conversion{})
 Construct a vector all of whose components have the given value, which may be of an arithmetic type different from this vector's value type. More...
 
T & x ()
 Reference to the component, e.g. v.x() = 4.5f;. More...
 
T & y ()
 
T & z ()
 
T & w ()
 
x () const
 Get the component, e.g. float f = v.y();. More...
 
y () const
 
z () const
 
w () const
 
T * asPointer ()
 
const T * asPointer () const
 
T & operator() (int i)
 Alternative indexed reference to the elements. More...
 
operator() (int i) const
 Alternative indexed constant reference to the elements,. More...
 
Vec3< T > getVec3 () const
 Returns a Vec3 with the first three elements of the Vec4. More...
 
const Vec4< T > & init (T x=0, T y=0, T z=0, T w=0)
 
const Vec4< T > & setZero ()
 Set "this" vector to zero. More...
 
template<typename Source >
const Vec4< T > & operator= (const Vec4< Source > &v)
 Assignment operator. More...
 
bool eq (const Vec4< T > &v, T eps=1.0e-8) const
 
Vec4< T > operator- () const
 Negation operator, for e.g. v1 = -v2;. More...
 
template<typename T0 , typename T1 >
const Vec4< T > & add (const Vec4< T0 > &v1, const Vec4< T1 > &v2)
 
template<typename T0 , typename T1 >
const Vec4< T > & sub (const Vec4< T0 > &v1, const Vec4< T1 > &v2)
 
template<typename T0 , typename T1 >
const Vec4< T > & scale (T0 scale, const Vec4< T1 > &v)
 
template<typename T0 , typename T1 >
const Vec4< T > & div (T0 scalar, const Vec4< T1 > &v)
 
dot (const Vec4< T > &v) const
 Dot product. More...
 
length () const
 Length of the vector. More...
 
lengthSqr () const
 
const Vec4< T > & exp ()
 
const Vec4< T > & log ()
 
sum () const
 Return the sum of all the vector components. More...
 
product () const
 Return the product of all the vector components. More...
 
bool normalize (T eps=1.0e-8)
 this = normalized this More...
 
Vec4< T > unit (T eps=0) const
 return normalized this, throws if null vector More...
 
Vec4< T > unit (T eps, T &len) const
 return normalized this and length, throws if null vector More...
 
Vec4< T > unitSafe () const
 return normalized this, or (1, 0, 0, 0) if this is null vector More...
 
template<typename S >
const Vec4< T > & operator*= (S scalar)
 Returns v, where $v_i *= scalar$ for $i \in [0, 3]$. More...
 
template<typename S >
const Vec4< T > & operator*= (const Vec4< S > &v1)
 Returns v0, where $v0_i *= v1_i$ for $i \in [0, 3]$. More...
 
template<typename S >
const Vec4< T > & operator/= (S scalar)
 Returns v, where $v_i /= scalar$ for $i \in [0, 3]$. More...
 
template<typename S >
const Vec4< T > & operator/= (const Vec4< S > &v1)
 Returns v0, where $v0_i /= v1_i$ for $i \in [0, 3]$. More...
 
template<typename S >
const Vec4< T > & operator+= (S scalar)
 Returns v, where $v_i += scalar$ for $i \in [0, 3]$. More...
 
template<typename S >
const Vec4< T > & operator+= (const Vec4< S > &v1)
 Returns v0, where $v0_i += v1_i$ for $i \in [0, 3]$. More...
 
template<typename S >
const Vec4< T > & operator-= (S scalar)
 Returns v, where $v_i += scalar$ for $i \in [0, 3]$. More...
 
template<typename S >
const Vec4< T > & operator-= (const Vec4< S > &v1)
 Returns v0, where $v0_i -= v1_i$ for $i \in [0, 3]$. More...
 
bool isNan () const
 True if a Nan is present in vector. More...
 
bool isInfinite () const
 True if an Inf is present in vector. More...
 
bool isFinite () const
 True if all no Nan or Inf values present. More...
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::math::Tuple< 4, T >
 Tuple ()
 Default ctor. Does nothing. More...
 
 Tuple (Tuple const &src)
 Copy constructor. Used when the class signature matches exactly. More...
 
 Tuple (Tuple< src_size, src_valtype > const &src)
 Conversion constructor. More...
 
Tupleoperator= (Tuple const &src)
 Assignment operator. More...
 
T operator[] (int i) const
 
Toperator[] (int i)
 
std::string str () const
 
void write (std::ostream &os) const
 
void read (std::istream &is)
 
void toV (S *v) const
 Copies this tuple into an array of a compatible type. More...
 
value_typeasV ()
 Exposes the internal array. Be careful when using this function. More...
 
value_type constasV () const
 Exposes the internal array. Be careful when using this function. More...
 

Static Public Member Functions

static unsigned numRows ()
 
static unsigned numColumns ()
 
static unsigned numElements ()
 
static Vec4< T > zero ()
 Predefined constants, e.g. Vec4f v = Vec4f::xNegAxis();. More...
 
static Vec4< T > origin ()
 
static Vec4< T > ones ()
 

Additional Inherited Members

- Static Public Attributes inherited from openvdb::OPENVDB_VERSION_NAME::math::Tuple< 4, T >
static const int size
 
- Protected Attributes inherited from openvdb::OPENVDB_VERSION_NAME::math::Tuple< 4, T >
T mm [SIZE]
 

Detailed Description

template<typename T>
class openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >

Definition at line 51 of file Mat4.h.

Member Typedef Documentation

template<typename T>
typedef T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::value_type

Definition at line 53 of file Vec4.h.

template<typename T>
typedef T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::ValueType

Definition at line 54 of file Vec4.h.

Constructor & Destructor Documentation

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::Vec4 ( )
inline

Trivial constructor, the vector is NOT initialized.

Definition at line 57 of file Vec4.h.

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::Vec4 ( val)
inlineexplicit

Construct a vector all of whose components have the given value.

Definition at line 60 of file Vec4.h.

template<typename T>
openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::Vec4 ( x,
y,
z,
w 
)
inline

Constructor with four arguments, e.g. Vec4f v(1,2,3,4);.

Definition at line 63 of file Vec4.h.

template<typename T>
template<typename Source >
openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::Vec4 ( Source *  a)
inline

Constructor with array argument, e.g. float a[4]; Vec4f v(a);.

Definition at line 73 of file Vec4.h.

template<typename T>
template<typename Source >
openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::Vec4 ( const Tuple< 4, Source > &  v)
inlineexplicit

Conversion constructor.

Definition at line 83 of file Vec4.h.

template<typename T>
template<typename Other >
openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::Vec4 ( Other  val,
typename std::enable_if< std::is_arithmetic< Other >::value, Conversion >::type  = Conversion{} 
)
inlineexplicit

Construct a vector all of whose components have the given value, which may be of an arithmetic type different from this vector's value type.

Type conversion warnings are suppressed.

Definition at line 95 of file Vec4.h.

Member Function Documentation

template<typename T>
template<typename T0 , typename T1 >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::add ( const Vec4< T0 > &  v1,
const Vec4< T1 > &  v2 
)
inline

this = v1 + v2 "this", v1 and v2 need not be distinct objects, e.g. v.add(v1,v);

Definition at line 176 of file Vec4.h.

template<typename T>
T* openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::asPointer ( )
inline

Definition at line 113 of file Vec4.h.

template<typename T>
const T* openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::asPointer ( ) const
inline

Definition at line 114 of file Vec4.h.

template<typename T>
template<typename T0 , typename T1 >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::div ( T0  scalar,
const Vec4< T1 > &  v 
)
inline

Definition at line 214 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::dot ( const Vec4< T > &  v) const
inline

Dot product.

Definition at line 225 of file Vec4.h.

template<typename T>
bool openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::eq ( const Vec4< T > &  v,
eps = 1.0e-8 
) const
inline

Test if "this" vector is equivalent to vector v with tolerance of eps

Definition at line 155 of file Vec4.h.

template<typename T>
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::exp ( )
inline

Return a reference to itself after the exponent has been applied to all the vector components.

Definition at line 252 of file Vec4.h.

template<typename T>
Vec3<T> openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::getVec3 ( ) const
inline

Returns a Vec3 with the first three elements of the Vec4.

Definition at line 123 of file Vec4.h.

template<typename T>
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::init ( x = 0,
y = 0,
z = 0,
w = 0 
)
inline

"this" vector gets initialized to [x, y, z, w], calling v.init(); has same effect as calling v = Vec4::zero();

Definition at line 127 of file Vec4.h.

template<typename T>
bool openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::isFinite ( ) const
inline

True if all no Nan or Inf values present.

Definition at line 428 of file Vec4.h.

template<typename T>
bool openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::isInfinite ( ) const
inline

True if an Inf is present in vector.

Definition at line 421 of file Vec4.h.

template<typename T>
bool openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::isNan ( ) const
inline

True if a Nan is present in vector.

Definition at line 414 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::length ( void  ) const
inline

Length of the vector.

Definition at line 232 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::lengthSqr ( ) const
inline

Squared length of the vector, much faster than length() as it does not involve square root

Definition at line 244 of file Vec4.h.

template<typename T>
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::log ( )
inline

Return a reference to itself after log has been applied to all the vector components.

Definition at line 263 of file Vec4.h.

template<typename T>
bool openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::normalize ( eps = 1.0e-8)
inline

this = normalized this

Definition at line 285 of file Vec4.h.

template<typename T>
static unsigned openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::numColumns ( )
inlinestatic

Definition at line 410 of file Vec4.h.

template<typename T>
static unsigned openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::numElements ( )
inlinestatic

Definition at line 411 of file Vec4.h.

template<typename T>
static unsigned openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::numRows ( )
inlinestatic

Definition at line 409 of file Vec4.h.

template<typename T>
static Vec4<T> openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::ones ( )
inlinestatic

Definition at line 437 of file Vec4.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator() ( int  i)
inline

Alternative indexed reference to the elements.

Definition at line 117 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator() ( int  i) const
inline

Alternative indexed constant reference to the elements,.

Definition at line 120 of file Vec4.h.

template<typename T>
template<typename S >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator*= ( scalar)
inline

Returns v, where $v_i *= scalar$ for $i \in [0, 3]$.

Definition at line 321 of file Vec4.h.

template<typename T>
template<typename S >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator*= ( const Vec4< S > &  v1)
inline

Returns v0, where $v0_i *= v1_i$ for $i \in [0, 3]$.

Definition at line 332 of file Vec4.h.

template<typename T>
template<typename S >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator+= ( scalar)
inline

Returns v, where $v_i += scalar$ for $i \in [0, 3]$.

Definition at line 366 of file Vec4.h.

template<typename T>
template<typename S >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator+= ( const Vec4< S > &  v1)
inline

Returns v0, where $v0_i += v1_i$ for $i \in [0, 3]$.

Definition at line 377 of file Vec4.h.

template<typename T>
Vec4<T> openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator- ( ) const
inline

Negation operator, for e.g. v1 = -v2;.

Definition at line 164 of file Vec4.h.

template<typename T>
template<typename S >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator-= ( scalar)
inline

Returns v, where $v_i += scalar$ for $i \in [0, 3]$.

Definition at line 388 of file Vec4.h.

template<typename T>
template<typename S >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator-= ( const Vec4< S > &  v1)
inline

Returns v0, where $v0_i -= v1_i$ for $i \in [0, 3]$.

Definition at line 399 of file Vec4.h.

template<typename T>
template<typename S >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator/= ( scalar)
inline

Returns v, where $v_i /= scalar$ for $i \in [0, 3]$.

Definition at line 344 of file Vec4.h.

template<typename T>
template<typename S >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator/= ( const Vec4< S > &  v1)
inline

Returns v0, where $v0_i /= v1_i$ for $i \in [0, 3]$.

Definition at line 355 of file Vec4.h.

template<typename T>
template<typename Source >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::operator= ( const Vec4< Source > &  v)
inline

Assignment operator.

Definition at line 142 of file Vec4.h.

template<typename T>
static Vec4<T> openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::origin ( )
inlinestatic

Definition at line 436 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::product ( ) const
inline

Return the product of all the vector components.

Definition at line 279 of file Vec4.h.

template<typename T>
template<typename T0 , typename T1 >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::scale ( T0  scale,
const Vec4< T1 > &  v 
)
inline

this = scalar*v, v need not be a distinct object from "this", e.g. v.scale(1.5,v1);

Definition at line 203 of file Vec4.h.

template<typename T>
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::setZero ( )
inline

Set "this" vector to zero.

Definition at line 134 of file Vec4.h.

template<typename T>
template<typename T0 , typename T1 >
const Vec4<T>& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::sub ( const Vec4< T0 > &  v1,
const Vec4< T1 > &  v2 
)
inline

this = v1 - v2 "this", v1 and v2 need not be distinct objects, e.g. v.sub(v1,v);

Definition at line 190 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::sum ( ) const
inline

Return the sum of all the vector components.

Definition at line 273 of file Vec4.h.

template<typename T>
Vec4<T> openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::unit ( eps = 0) const
inline

return normalized this, throws if null vector

Definition at line 296 of file Vec4.h.

template<typename T>
Vec4<T> openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::unit ( eps,
T &  len 
) const
inline

return normalized this and length, throws if null vector

Definition at line 303 of file Vec4.h.

template<typename T>
Vec4<T> openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::unitSafe ( ) const
inline

return normalized this, or (1, 0, 0, 0) if this is null vector

Definition at line 313 of file Vec4.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::w ( )
inline

Definition at line 105 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::w ( ) const
inline

Definition at line 111 of file Vec4.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::x ( )
inline

Reference to the component, e.g. v.x() = 4.5f;.

Definition at line 102 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::x ( ) const
inline

Get the component, e.g. float f = v.y();.

Definition at line 108 of file Vec4.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::y ( )
inline

Definition at line 103 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::y ( ) const
inline

Definition at line 109 of file Vec4.h.

template<typename T>
T& openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::z ( )
inline

Definition at line 104 of file Vec4.h.

template<typename T>
T openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::z ( ) const
inline

Definition at line 110 of file Vec4.h.

template<typename T>
static Vec4<T> openvdb::OPENVDB_VERSION_NAME::math::Vec4< T >::zero ( )
inlinestatic

Predefined constants, e.g. Vec4f v = Vec4f::xNegAxis();.

Definition at line 435 of file Vec4.h.


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