Tanoda
Leap.Matrix Struct Reference

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

Public Member Functions

float[] ToArray3x3 (float[] output)
 Copy this matrix to the specified array of 9 float values in row-major order. More...
 
double[] ToArray3x3 (double[] output)
 Copy this matrix to the specified array containing 9 double values in row-major order. More...
 
float[] ToArray3x3 ()
 Convert this matrix to an array containing 9 float values in row-major order. More...
 
float[] ToArray4x4 (float[] output)
 Copy this matrix to the specified array of 16 float values in row-major order. More...
 
double[] ToArray4x4 (double[] output)
 Copy this matrix to the specified array of 16 double values in row-major order. More...
 
float[] ToArray4x4 ()
 Convert this matrix to an array containing 16 float values in row-major order. More...
 
 Matrix (Matrix other)
 Constructs a copy of the specified Matrix object. More...
 
 Matrix (Vector xBasis, Vector yBasis, Vector zBasis)
 Constructs a transformation matrix from the specified basis vectors. More...
 
 Matrix (Vector xBasis, Vector yBasis, Vector zBasis, Vector origin)
 Constructs a transformation matrix from the specified basis and translation vectors. More...
 
 Matrix (Vector axis, float angleRadians)
 Constructs a transformation matrix specifying a rotation around the specified vector. More...
 
 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. More...
 
 Matrix (float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
 
 Matrix (float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22, float m30, float m31, float m32)
 
void SetRotation (Vector axis, float angleRadians)
 Sets this transformation matrix to represent a rotation around the specified vector. More...
 
Vector TransformPoint (Vector point)
 Transforms a vector with this matrix by transforming its rotation, scale, and translation. More...
 
Vector TransformDirection (Vector direction)
 Transforms a vector with this matrix by transforming its rotation and scale only. More...
 
Matrix RigidInverse ()
 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. More...
 
bool Equals (Matrix other)
 Compare Matrix equality component-wise. More...
 
override string ToString ()
 Write the matrix to a string in a human readable format. More...
 

Static Public Member Functions

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

Static Public Attributes

static readonly Matrix Identity = new Matrix(Vector.XAxis, Vector.YAxis, Vector.ZAxis, Vector.Zero)
 Returns the identity matrix specifying no translation, rotation, and scale. More...
 

Properties

Vector xBasis [get, set]
 The basis vector for the x-axis. More...
 
Vector yBasis [get, set]
 The basis vector for the y-axis. More...
 
Vector zBasis [get, set]
 The basis vector for the z-axis. More...
 
Vector origin [get, set]
 The translation factors for all three axes. More...
 

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.

Since
1.0

Definition at line 23 of file Matrix.cs.

Constructor & Destructor Documentation

◆ Matrix() [1/7]

Leap.Matrix.Matrix ( Matrix  other)

Constructs a copy of the specified Matrix object.

Since
1.0

Definition at line 128 of file Matrix.cs.

◆ Matrix() [2/7]

Leap.Matrix.Matrix ( Vector  xBasis,
Vector  yBasis,
Vector  zBasis 
)

Constructs a transformation matrix from the specified basis vectors.

Since
1.0

Definition at line 140 of file Matrix.cs.

◆ Matrix() [3/7]

Leap.Matrix.Matrix ( Vector  xBasis,
Vector  yBasis,
Vector  zBasis,
Vector  origin 
)

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

Since
1.0

Definition at line 152 of file Matrix.cs.

◆ Matrix() [4/7]

Leap.Matrix.Matrix ( Vector  axis,
float  angleRadians 
)

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

Since
1.0

Definition at line 164 of file Matrix.cs.

◆ Matrix() [5/7]

Leap.Matrix.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.

Since
1.0

Definition at line 178 of file Matrix.cs.

◆ Matrix() [6/7]

Leap.Matrix.Matrix ( float  m00,
float  m01,
float  m02,
float  m10,
float  m11,
float  m12,
float  m20,
float  m21,
float  m22 
)

Definition at line 187 of file Matrix.cs.

◆ Matrix() [7/7]

Leap.Matrix.Matrix ( float  m00,
float  m01,
float  m02,
float  m10,
float  m11,
float  m12,
float  m20,
float  m21,
float  m22,
float  m30,
float  m31,
float  m32 
)

Definition at line 203 of file Matrix.cs.

Member Function Documentation

◆ Equals()

bool Leap.Matrix.Equals ( Matrix  other)

Compare Matrix equality component-wise.

Since
1.0

Definition at line 295 of file Matrix.cs.

◆ operator*()

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

Multiply two matrices.

Definition at line 28 of file Matrix.cs.

◆ RigidInverse()

Matrix Leap.Matrix.RigidInverse ( )

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 matrices that are directly returned by the API are rigid.

Since
1.0

Definition at line 271 of file Matrix.cs.

◆ SetRotation()

void Leap.Matrix.SetRotation ( Vector  axis,
float  angleRadians 
)

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.

Since
1.0

Definition at line 230 of file Matrix.cs.

◆ ToArray3x3() [1/3]

float[] Leap.Matrix.ToArray3x3 ( )

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

Definition at line 67 of file Matrix.cs.

◆ ToArray3x3() [2/3]

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

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

Definition at line 51 of file Matrix.cs.

◆ ToArray3x3() [3/3]

float[] Leap.Matrix.ToArray3x3 ( float[]  output)

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

Definition at line 35 of file Matrix.cs.

◆ ToArray4x4() [1/3]

float[] Leap.Matrix.ToArray4x4 ( )

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

Definition at line 120 of file Matrix.cs.

◆ ToArray4x4() [2/3]

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

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

Definition at line 97 of file Matrix.cs.

◆ ToArray4x4() [3/3]

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

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

Definition at line 74 of file Matrix.cs.

◆ ToString()

override string Leap.Matrix.ToString ( )

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

Definition at line 305 of file Matrix.cs.

◆ TransformDirection()

Vector Leap.Matrix.TransformDirection ( Vector  direction)

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

Since
1.0

Definition at line 258 of file Matrix.cs.

◆ TransformPoint()

Vector Leap.Matrix.TransformPoint ( Vector  point)

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

Translation is applied after rotation and scale.

Since
1.0

Definition at line 249 of file Matrix.cs.

Member Data Documentation

◆ Identity

readonly Matrix Leap.Matrix.Identity = new Matrix(Vector.XAxis, Vector.YAxis, Vector.ZAxis, Vector.Zero)
static

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

Since
1.0

Definition at line 337 of file Matrix.cs.

Property Documentation

◆ origin

Vector Leap.Matrix.origin
getset

The translation factors for all three axes.

Since
1.0

Definition at line 331 of file Matrix.cs.

◆ xBasis

Vector Leap.Matrix.xBasis
getset

The basis vector for the x-axis.

Since
1.0

Definition at line 313 of file Matrix.cs.

◆ yBasis

Vector Leap.Matrix.yBasis
getset

The basis vector for the y-axis.

Since
1.0

Definition at line 319 of file Matrix.cs.

◆ zBasis

Vector Leap.Matrix.zBasis
getset

The basis vector for the z-axis.

Since
1.0

Definition at line 325 of file Matrix.cs.


The documentation for this struct was generated from the following file: