![]() |
Leap Motion C++ API Reference
0.8.0
|
The Matrix struct represents a transformation matrix. More...
Public Member Functions | |
Matrix () | |
Constructs an identity transformation matrix. | |
Matrix (const Matrix &other) | |
Constructs a copy of the specified Matrix object. | |
Matrix (const Vector &_xBasis, const Vector &_yBasis, const Vector &_zBasis) | |
Constructs a transformation matrix from the specified basis vectors. | |
Matrix (const Vector &_xBasis, const Vector &_yBasis, const Vector &_zBasis, const Vector &_origin) | |
Constructs a transformation matrix from the specified basis and translation vectors. | |
Matrix (const Vector &axis, float angleRadians) | |
Constructs a transformation matrix specifying a rotation around the specified vector. | |
Matrix (const Vector &axis, float angleRadians, const Vector &translation) | |
Constructs a transformation matrix specifying a rotation around the specified vector and a translation by the specified vector. | |
bool | operator!= (const Matrix &other) const |
Compare Matrix inequality component-wise. | |
Matrix | operator* (const Matrix &other) const |
Multiply transform matrices. | |
Matrix & | operator*= (const Matrix &other) |
Multiply transform matrices and assign the product. | |
bool | operator== (const Matrix &other) const |
Compare Matrix equality component-wise. | |
Matrix | rigidInverse () const |
Performs a matrix inverse if the matrix consists entirely of rigid transformations (translations and rotations). | |
void | setRotation (const Vector &axis, float angleRadians) |
Sets this transformation matrix to represent a rotation around the specified vector. | |
template<typename T > | |
T * | toArray3x3 (T *output) const |
Writes the 3x3 Matrix object to a 9 element row-major float or double array. | |
FloatArray | toArray3x3 () const |
Convert a 3x3 Matrix object to a 9 element row-major float array. | |
template<typename T > | |
T * | toArray4x4 (T *output) const |
Writes the 4x4 Matrix object to a 16 element row-major float or double array. | |
FloatArray | toArray4x4 () const |
Convert a 4x4 Matrix object to a 16 element row-major float array. | |
template<typename Matrix3x3Type > | |
const Matrix3x3Type | toMatrix3x3 () const |
Convert a Leap::Matrix object to another 3x3 matrix type. | |
template<typename Matrix4x4Type > | |
const Matrix4x4Type | toMatrix4x4 () const |
Convert a Leap::Matrix object to another 4x4 matrix type. | |
std::string | toString () const |
Write the matrix to a string in a human readable format. | |
Vector | transformDirection (const Vector &in) const |
Transforms a vector with this matrix by transforming its rotation and scale only. | |
Vector | transformPoint (const Vector &in) const |
Transforms a vector with this matrix by transforming its rotation, scale, and translation. | |
Static Public Member Functions | |
static const Matrix & | identity () |
Returns the identity matrix specifying no translation, rotation, and scale. | |
Public Attributes | |
Vector | origin |
The translation factors for all three axes. | |
Vector | xBasis |
The rotation and scale factors for the x-axis. | |
Vector | yBasis |
The rotation and scale factors for the y-axis. | |
Vector | zBasis |
The rotation and scale factors for the z-axis. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Matrix &matrix) |
Write the matrix to an output stream in a human readable format. | |
The Matrix struct represents a transformation matrix.
To use this struct to transform a Vector, construct a matrix containing the desired transformation and then use the Matrix::transformPoint() or Matrix::transformDirection() functions to apply the transform.
Transforms can be combined by multiplying two or more transform matrices using the * operator.
|
inline |
Constructs an identity transformation matrix.
|
inline |
Constructs a copy of the specified Matrix object.
|
inline |
Constructs a transformation matrix from the specified basis and translation vectors.
|
inline |
Constructs a transformation matrix specifying a rotation around the specified vector.
axis | A Vector specifying the axis of rotation. |
angleRadians | The amount of rotation in radians. |
Constructs a transformation matrix specifying a rotation around the specified vector and a translation by the specified vector.
|
inlinestatic |
Returns the identity matrix specifying no translation, rotation, and scale.
|
inline |
Compare Matrix inequality component-wise.
Multiply transform matrices and assign the product.
|
inline |
Compare Matrix equality component-wise.
|
inline |
Performs a matrix inverse if the matrix consists entirely of rigid transformations (translations and rotations).
If the matrix is not rigid, this operation will not represent an inverse.
Note that all matricies that are directly returned by the API are rigid.
|
inline |
Sets this transformation matrix to represent a rotation around the specified vector.
This function erases any previous rotation and scale transforms applied to this matrix, but does not affect translation.
axis | A Vector specifying the axis of rotation. |
angleRadians | The amount of rotation in radians. |
|
inline |
Writes the 3x3 Matrix object to a 9 element row-major float or double array.
Translation factors are discarded.
Returns a pointer to the same data.
|
inline |
Convert a 3x3 Matrix object to a 9 element row-major float array.
Translation factors are discarded.
Returns a FloatArray struct to avoid dynamic memory allocation.
|
inline |
Writes the 4x4 Matrix object to a 16 element row-major float or double array.
Returns a pointer to the same data.
|
inline |
Convert a 4x4 Matrix object to a 16 element row-major float array.
Returns a FloatArray struct to avoid dynamic memory allocation.
|
inline |
Convert a Leap::Matrix object to another 3x3 matrix type.
The new type must define a constructor function that takes each matrix element as a parameter in row-major order.
Translation factors are discarded.
|
inline |
Convert a Leap::Matrix object to another 4x4 matrix type.
The new type must define a constructor function that takes each matrix element as a parameter in row-major order.
|
inline |
Write the matrix to a string in a human readable format.
|
friend |
Write the matrix to an output stream in a human readable format.
Vector Leap::Matrix::origin |
The translation factors for all three axes.
Vector Leap::Matrix::xBasis |
The rotation and scale factors for the x-axis.
Vector Leap::Matrix::yBasis |
The rotation and scale factors for the y-axis.
Vector Leap::Matrix::zBasis |
The rotation and scale factors for the z-axis.