new Matrix()
Constructs a Matrix object.
Creates a new Matrix from the specified Array of Vectors or Matrix. The default constructor creates an identity matrix.
- Source:
- matrix.js, line 4
Members
-
<static> identity :Leap.Matrix
-
Returns the identity matrix specifying no translation, rotation, and scale.
Type:
- Source:
- matrix.js, line 293
-
[0] :Leap.Vector
-
The rotation and scale factors for the x-axis.
Type:
- Source:
- matrix.js, line 54
-
[1] :Leap.Vector
-
The rotation and scale factors for the y-axis.
Type:
- Source:
- matrix.js, line 68
-
[2] :Leap.Vector
-
The rotation and scale factors for the z-axis.
Type:
- Source:
- matrix.js, line 82
-
[3] :Leap.Vector
-
The translation factors for all three axes.
Type:
- Source:
- matrix.js, line 96
-
origin :Leap.Vector
-
The translation factors for all three axes.
Type:
- Source:
- matrix.js, line 95
-
xBasis :Leap.Vector
-
The rotation and scale factors for the x-axis.
Type:
- Source:
- matrix.js, line 53
-
yBasis :Leap.Vector
-
The rotation and scale factors for the y-axis.
Type:
- Source:
- matrix.js, line 67
-
zBasis :Leap.Vector
-
The rotation and scale factors for the z-axis.
Type:
- Source:
- matrix.js, line 81
Methods
-
compare() → {Boolean}
-
Compare Matrix equality component-wise.
- Source:
- matrix.js, line 275
Returns:
- Type
- Boolean
-
rigidInverse() → {Leap.Matrix}
-
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.
- Source:
- matrix.js, line 185
Returns:
The rigid inverse of the matrix.
- Type
- Leap.Matrix
-
setRotation(_axis, 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.
Parameters:
Name Type Description _axis
Leap.Vector A Vector specifying the axis of rotation.
angleRadians
float The amount of rotation in radians.
- Source:
- matrix.js, line 112
-
times(other) → {Leap.Matrix}
-
Multiply transform matrices.
Combines two transformations into a single equivalent transformation.
Parameters:
Name Type Description other
Matrix A Matrix to multiply on the right hand side.
- Source:
- matrix.js, line 166
Returns:
A new Matrix representing the transformation equivalent to applying the other transformation followed by this transformation.
- Type
- Leap.Matrix
-
toArray3x3() → {Array}
-
Writes the 3x3 Matrix object to a 9 element row-major float array.
Translation factors are discarded.
- Source:
- matrix.js, line 206
Returns:
The rotation Matrix as a flattened array.
- Type
- Array
-
toArray4x4() → {Array}
-
Convert a 4x4 Matrix object to a 16 element row-major float array.
Translation factors are discarded.
- Source:
- matrix.js, line 230
Returns:
The entire Matrix as a flattened array.
- Type
- Array
-
toString() → {String}
-
Write the matrix to a string in a human readable format.
- Source:
- matrix.js, line 261
Returns:
- Type
- String
-
transformDirection(in) → {Leap.Vector}
-
Transforms a vector with this matrix by transforming its rotation and scale only.
Parameters:
Name Type Description in
Leap.Vector The Vector to transform.
- Source:
- matrix.js, line 150
Returns:
A new Vector representing the transformed original.
- Type
- Leap.Vector
-
transformPoint(in) → {Leap.Vector}
-
Transforms a vector with this matrix by transforming its rotation, scale, and translation.
Translation is applied after rotation and scale.
Parameters:
Name Type Description in
Leap.Vector The Vector to transform.
- Source:
- matrix.js, line 135
Returns:
A new Vector representing the transformed original.
- Type
- Leap.Vector