![]() |
3Gear Systems SDK
v0.9.34
|
A minimal 3-vector class. More...
#include <VecMath.h>
Public Member Functions | |
Vector3 () | |
The default constructor initializes to (0, 0, 0). | |
Vector3 (T x_in, T y_in, T z_in) | |
Initialize from the passed-in values. | |
template<typename T2 > | |
Vector3< T2 > | cast () const |
Convert to a vector with a different base type. | |
Vector3< T > & | operator+= (const Vector3< T > &rhs) |
Adds the passed-in vector to this vector. | |
Vector3< T > & | operator-= (const Vector3< T > &rhs) |
Subtracts the passed-in vector to this vector. | |
Vector3< T > | operator- () const |
Unary minus operator. | |
Vector3< T > & | operator*= (const T rhs) |
Multiplies this vector (in place) by the scalar. | |
Vector3< T > & | operator/= (const T rhs) |
Divides this vector (in place) by the scalar. | |
T | dot (const Vector3< T > &rhs) const |
Computes the dot product of this vector with another. | |
Vector3< T > | cross (const Vector3< T > &rhs) const |
Computes the cross product of this vector with another. | |
bool | operator== (const Vector3< T > &rhs) const |
Tests for equality (no floating point slop). | |
bool | operator!= (const Vector3< T > &rhs) const |
Tests for inequality (no floating point slop). | |
T | squaredNorm () const |
Returns the L2 squared norm (x^2 + y^2 + z^2). | |
T | lInfNorm () const |
Returns the l_infinity norm (the supremum over the absolute values of the elements). | |
T | norm () const |
Returns the L2 norm sqrt(x^2 + y^2 + z^2). | |
void | normalize () |
Vector3< T > | normalized () const |
Returns a normalized version of this vector. | |
Public Attributes | |
T | x |
The x component. | |
T | y |
The y component. | |
T | z |
The z component. | |
A minimal 3-vector class.
We have provided this simple vector class to avoid a dependence on an external math library (like Eigen).
void HandTrackingClient::Vector3< T >::normalize | ( | ) |
Normalize this vector. Note that it avoids the divide by zero in cases where the vector is equal to (0, 0, 0).