OpenVDB
1.1.0
|
#include <Vec2.h>
Inherits Tuple< 2, T >.
Public Types | |
typedef T | value_type |
typedef T | ValueType |
enum | SIZE_ |
Public Member Functions | |
Vec2 () | |
Trivial constructor, the vector is NOT initialized. | |
Vec2 (T val) | |
Constructor with one argument, e.g. Vec2f v(0);. | |
Vec2 (T x, T y) | |
Constructor with three arguments, e.g. Vec2f v(1,2,3);. | |
template<typename Source > | |
Vec2 (Source *a) | |
Constructor with array argument, e.g. float a[2]; Vec2f v(a);. | |
template<typename Source > | |
Vec2 (const Tuple< 2, Source > &t) | |
Conversion constructor. | |
T & | x () |
Reference to the component, e.g. v.x() = 4.5f;. | |
T & | y () |
T | x () const |
Get the component, e.g. float f = v.y();. | |
T | y () const |
T & | operator() (int i) |
Alternative indexed reference to the elements. | |
T | operator() (int i) const |
Alternative indexed constant reference to the elements,. | |
T * | asPointer () |
const T * | asPointer () const |
const Vec2< T > & | init (T x=0, T y=0) |
const Vec2< T > & | setZero () |
Set "this" vector to zero. | |
template<typename Source > | |
const Vec2< T > & | operator= (const Vec2< Source > &v) |
Assignment operator. | |
bool | operator== (const Vec2< T > &v) const |
Equality operator, does exact floating point comparisons. | |
bool | operator!= (const Vec2< T > &v) const |
Inequality operator, does exact floating point comparisons. | |
bool | eq (const Vec2< T > &v, T eps=static_cast< T >(1.0e-7)) const |
Test if "this" vector is equivalent to vector v with tolerance of eps. | |
Vec2< T > | operator- () const |
Negation operator, for e.g. v1 = -v2;. | |
template<typename T0 , typename T1 > | |
const Vec2< T > & | add (const Vec2< T0 > &v1, const Vec2< T1 > &v2) |
template<typename T0 , typename T1 > | |
const Vec2< T > & | sub (const Vec2< T0 > &v1, const Vec2< T1 > &v2) |
template<typename T0 , typename T1 > | |
const Vec2< T > & | scale (T0 scalar, const Vec2< T1 > &v) |
template<typename T0 , typename T1 > | |
const Vec2< T > & | div (T0 scalar, const Vec2< T1 > &v) |
T | dot (const Vec2< T > &v) const |
Dot product. | |
T | length () const |
Length of the vector. | |
T | lengthSqr () const |
bool | normalize (T eps=1.0e-8) |
this = normalized this | |
Vec2< T > | unit (T eps=0) const |
return normalized this, throws if null vector | |
Vec2< T > | unit (T eps, T &len) const |
return normalized this and length, throws if null vector | |
template<typename S > | |
const Vec2< T > & | operator*= (S scalar) |
Returns v, where ![]() ![]() | |
template<typename S > | |
const Vec2< T > & | operator*= (const Vec2< S > &v1) |
Returns v0, where ![]() ![]() | |
template<typename S > | |
const Vec2< T > & | operator/= (S scalar) |
Returns v, where ![]() ![]() | |
template<typename S > | |
const Vec2< T > & | operator/= (const Vec2< S > &v1) |
Returns v0, where ![]() ![]() | |
template<typename S > | |
const Vec2< T > & | operator+= (S scalar) |
Returns v, where ![]() ![]() | |
template<typename S > | |
const Vec2< T > & | operator+= (const Vec2< S > &v1) |
Returns v0, where ![]() ![]() | |
template<typename S > | |
const Vec2< T > & | operator-= (S scalar) |
Returns v, where ![]() ![]() | |
template<typename S > | |
const Vec2< T > & | operator-= (const Vec2< S > &v1) |
Returns v0, where ![]() ![]() | |
T | component (const Vec2< T > &onto, T eps=1.0e-8) const |
Vec2< T > | projection (const Vec2< T > &onto, T eps=1.0e-8) const |
Vec2< T > | getArbPerpendicular () const |
bool | isNan () const |
True if a Nan is present in vector. | |
bool | isInfinite () const |
True if an Inf is present in vector. | |
bool | isFinite () const |
True if all no Nan or Inf values present. | |
T | operator[] (int i) const |
T & | operator[] (int i) |
std::string | str () const |
void | write (std::ostream &os) const |
void | read (std::istream &is) |
Compatibility | |
These are mostly for backwards compability with functions that take old-style Vs (which are just arrays). | |
void | toV (S *v) const |
Copies this tuple into an array of a compatible type. | |
value_type * | asV () |
Exposes the internal array. Be careful when using this function. | |
value_type const * | asV () const |
Exposes the internal array. Be careful when using this function. |
Static Public Member Functions | |
static unsigned | numRows () |
static unsigned | numColumns () |
static unsigned | numElements () |
static Vec2< T > | zero () |
Predefined constants, e.g. Vec2f v = Vec2f::xNegAxis();. |
Protected Attributes | |
T | mm [SIZE] |
typedef T value_type |
typedef T ValueType |
|
inherited |
|
inline |
Trivial constructor, the vector is NOT initialized.
|
inlineexplicit |
Constructor with one argument, e.g. Vec2f v(0);.
|
inline |
Constructor with three arguments, e.g. Vec2f v(1,2,3);.
|
inline |
Constructor with array argument, e.g. float a[2]; Vec2f v(a);.
this = v1 + v2 "this", v1 and v2 need not be distinct objects, e.g. v.add(v1,v);
|
inline |
|
inline |
|
inlineinherited |
Exposes the internal array. Be careful when using this function.
|
inlineinherited |
Exposes the internal array. Be careful when using this function.
|
inline |
Returns the scalar component of v in the direction of onto, onto need not be unit. e.g float c = Vec2f::component(v1,v2);
|
inline |
Dot product.
|
inline |
Test if "this" vector is equivalent to vector v with tolerance of eps.
|
inline |
Return an arbitrary unit vector perpendicular to v Vector v must be a unit vector e.g. v.normalize(); Vec2f n = Vec2f::getArbPerpendicular(v);
|
inline |
"this" vector gets initialized to [x, y, z], calling v.init(); has same effect as calling v = Vec2::zero();
|
inline |
True if all no Nan or Inf values present.
|
inline |
True if an Inf is present in vector.
|
inline |
True if a Nan is present in vector.
|
inline |
Length of the vector.
|
inline |
Squared length of the vector, much faster than length() as it does not involve square root
|
inline |
this = normalized this
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
Inequality operator, does exact floating point comparisons.
|
inline |
Alternative indexed reference to the elements.
|
inline |
Alternative indexed constant reference to the elements,.
|
inline |
Returns v, where for
.
|
inline |
Returns v, where for
.
|
inline |
Negation operator, for e.g. v1 = -v2;.
|
inline |
Returns v, where for
.
|
inline |
Returns v, where for
.
|
inline |
Equality operator, does exact floating point comparisons.
|
inlineinherited |
|
inlineinherited |
Return the projection of v onto the vector, onto need not be unit e.g. Vec2f v = Vec2f::projection(v,n);
|
inlineinherited |
this = scalar*v, v need not be a distinct object from "this", e.g. v.scale(1.5,v1);
|
inline |
Set "this" vector to zero.
|
inlineinherited |
this = v1 - v2 "this", v1 and v2 need not be distinct objects, e.g. v.sub(v1,v);
|
inlineinherited |
Copies this tuple into an array of a compatible type.
|
inline |
return normalized this, throws if null vector
|
inline |
return normalized this and length, throws if null vector
|
inlineinherited |
|
inline |
Reference to the component, e.g. v.x() = 4.5f;.
|
inline |
Get the component, e.g. float f = v.y();.
|
inline |
|
inline |
|
inlinestatic |
Predefined constants, e.g. Vec2f v = Vec2f::xNegAxis();.
|
protectedinherited |