Leap Motion C# API Reference  0.8.0
Leap.Matrix Class Reference

The Matrix struct represents a transformation matrix. More...

Inherits IDisposable.

Public Member Functions

bool Equals (Matrix other)
 Compare Matrix equality component-wise.
 
 Matrix ()
 Constructs an identity transformation matrix.
 
 Matrix (Matrix other)
 Constructs a copy of the specified Matrix object.
 
 Matrix (Vector _xBasis, Vector _yBasis, Vector _zBasis)
 Constructs a transformation matrix from the specified basis vectors.
 
 Matrix (Vector _xBasis, Vector _yBasis, Vector _zBasis, Vector _origin)
 Constructs a transformation matrix from the specified basis and translation vectors.
 
 Matrix (Vector axis, float angleRadians)
 Constructs a transformation matrix specifying a rotation around the specified vector.
 
 Matrix (Vector axis, float angleRadians, Vector translation)
 Constructs a transformation matrix specifying a rotation around the specified vector and a translation by the specified vector.
 
Matrix RigidInverse ()
 Performs a matrix inverse if the matrix consists entirely of rigid transformations (translations and rotations).
 
void SetRotation (Vector axis, float angleRadians)
 Sets this transformation matrix to represent a rotation around the specified vector.
 
float[] ToArray3x3 (float[] output)
 Copy this matrix to the specified array of 9 float values in row-major order.
 
double[] ToArray3x3 (double[] output)
 Copy this matrix to the specified array containing 9 double values in row-major order.
 
float[] ToArray3x3 ()
 Convert this matrix to an array containing 9 float values in row-major order.
 
float[] ToArray4x4 (float[] output)
 Copy this matrix to the specified array of 16 float values in row-major order.
 
double[] ToArray4x4 (double[] output)
 Copy this matrix to the specified array of 16 double values in row-major order.
 
float[] ToArray4x4 ()
 Convert this matrix to an array containing 16 float values in row-major order.
 
override string ToString ()
 Write the matrix to a string in a human readable format.
 
Vector TransformDirection (Vector arg0)
 Transforms a vector with this matrix by transforming its rotation and scale only.
 
Vector TransformPoint (Vector arg0)
 Transforms a vector with this matrix by transforming its rotation, scale, and translation.
 

Static Public Member Functions

static Matrix operator* (Matrix m1, Matrix m2)
 Multiply two matrices.
 

Properties

static Matrix Identity [get]
 Returns the identity matrix specifying no translation, rotation, and scale.
 
Vector origin [get, set]
 The translation factors for all three axes.
 
Vector xBasis [get, set]
 The rotation and scale factors for the x-axis.
 
Vector yBasis [get, set]
 The rotation and scale factors for the y-axis.
 
Vector zBasis [get, set]
 The rotation and scale factors for the z-axis.
 

Detailed Description

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.

Constructor & Destructor Documentation

Leap.Matrix.Matrix ( )
inline

Constructs an identity transformation matrix.

Leap.Matrix.Matrix ( Matrix  other)
inline

Constructs a copy of the specified Matrix object.

Leap.Matrix.Matrix ( Vector  _xBasis,
Vector  _yBasis,
Vector  _zBasis 
)
inline

Constructs a transformation matrix from the specified basis vectors.

Parameters
_xBasisA Vector specifying rotation and scale factors for the x-axis.
_yBasisA Vector specifying rotation and scale factors for the y-axis.
_zBasisA Vector specifying rotation and scale factors for the z-axis.
Leap.Matrix.Matrix ( Vector  _xBasis,
Vector  _yBasis,
Vector  _zBasis,
Vector  _origin 
)
inline

Constructs a transformation matrix from the specified basis and translation vectors.

Parameters
_xBasisA Vector specifying rotation and scale factors for the x-axis.
_yBasisA Vector specifying rotation and scale factors for the y-axis.
_zBasisA Vector specifying rotation and scale factors for the z-axis.
_originA Vector specifying translation factors on all three axes.
Leap.Matrix.Matrix ( Vector  axis,
float  angleRadians 
)
inline

Constructs a transformation matrix specifying a rotation around the specified vector.

Parameters
axisA Vector specifying the axis of rotation.
angleRadiansThe amount of rotation in radians.
Leap.Matrix.Matrix ( Vector  axis,
float  angleRadians,
Vector  translation 
)
inline

Constructs a transformation matrix specifying a rotation around the specified vector and a translation by the specified vector.

Parameters
axisA Vector specifying the axis of rotation.
angleRadiansThe angle of rotation in radians.
translationA Vector representing the translation part of the transform.

Member Function Documentation

bool Leap.Matrix.Equals ( Matrix  other)
inline

Compare Matrix equality component-wise.

static Matrix Leap.Matrix.operator* ( Matrix  m1,
Matrix  m2 
)
inlinestatic

Multiply two matrices.

Matrix Leap.Matrix.RigidInverse ( )
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.

Returns
The rigid inverse of the matrix.
void Leap.Matrix.SetRotation ( Vector  axis,
float  angleRadians 
)
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.

Parameters
axisA Vector specifying the axis of rotation.
angleRadiansThe amount of rotation in radians.
float [] Leap.Matrix.ToArray3x3 ( float[]  output)
inline

Copy this matrix to the specified array of 9 float values in row-major order.

double [] Leap.Matrix.ToArray3x3 ( double[]  output)
inline

Copy this matrix to the specified array containing 9 double values in row-major order.

float [] Leap.Matrix.ToArray3x3 ( )
inline

Convert this matrix to an array containing 9 float values in row-major order.

float [] Leap.Matrix.ToArray4x4 ( float[]  output)
inline

Copy this matrix to the specified array of 16 float values in row-major order.

double [] Leap.Matrix.ToArray4x4 ( double[]  output)
inline

Copy this matrix to the specified array of 16 double values in row-major order.

float [] Leap.Matrix.ToArray4x4 ( )
inline

Convert this matrix to an array containing 16 float values in row-major order.

override string Leap.Matrix.ToString ( )
inline

Write the matrix to a string in a human readable format.

Vector Leap.Matrix.TransformDirection ( Vector  arg0)
inline

Transforms a vector with this matrix by transforming its rotation and scale only.

Parameters
inThe Vector to transform.
Returns
A new Vector representing the transformed original.
Vector Leap.Matrix.TransformPoint ( Vector  arg0)
inline

Transforms a vector with this matrix by transforming its rotation, scale, and translation.

Translation is applied after rotation and scale.

Parameters
inThe Vector to transform.
Returns
A new Vector representing the transformed original.

Property Documentation

Matrix Leap.Matrix.Identity
staticget

Returns the identity matrix specifying no translation, rotation, and scale.

Returns
The identity matrix.
Vector Leap.Matrix.origin
getset

The translation factors for all three axes.

Vector Leap.Matrix.xBasis
getset

The rotation and scale factors for the x-axis.

Vector Leap.Matrix.yBasis
getset

The rotation and scale factors for the y-axis.

Vector Leap.Matrix.zBasis
getset

The rotation and scale factors for the z-axis.