Properties:
Methods:
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.
Public Functions
- Since
- 1.0
Propertybool Equals(Matrix other)Matrix()Matrix(Matrix other)
Constructs a transformation matrix from the specified basis and translation vectors.
Hand leapHand = frame.Hand (handID); Vector handXBasis = leapHand.PalmNormal.Cross (leapHand.Direction.Normalized); Vector handYBasis = -leapHand.PalmNormal; Vector handZBasis = -leapHand.Direction; Vector handOrigin = leapHand.PalmPosition; Matrix handTransform = new Matrix (handXBasis, handYBasis, handZBasis, handOrigin);
- Since
- 1.0
- Parameters
Matrix(Vector axis, float angleRadians)Constructs a transformation matrix specifying a rotation around the specified vector.
Vector axisOfRotation = hand.Direction; float angleOfRotation = 1.27f; Matrix rotator = new Matrix (axisOfRotation, angleOfRotation);
- Since
- 1.0
- Parameters
- axis -
A Vector specifying the axis of rotation.
- angleRadians -
The amount of rotation in radians.
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.
thisMatrix = thatMatrix.RigidInverse ();Note that all matrices that are directly returned by the API are rigid.
- Return
- The rigid inverse of the matrix.
- Since
- 1.0
void SetRotation(Vector axis, float angleRadians)Sets this transformation matrix to represent a rotation around the specified vector.
thisMatrix.SetRotation (Vector.ZAxis, 1.46f);This function erases any previous rotation and scale transforms applied to this matrix, but does not affect translation.
- Since
- 1.0
- Parameters
- axis -
A Vector specifying the axis of rotation.
- angleRadians -
The amount of rotation in radians.
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.
- Since
- 1.0
Transforms a vector with this matrix by transforming its rotation, scale, and translation.
Vector newPosition = thisMatrix.TransformPoint (oldPosition);Translation is applied after rotation and scale.
Public Static FunctionsMatrix Identity
Vector origin
The translation factors for all three axes.
Vector thisTranslation = thisMatrix.origin;
- Since
- 1.0
Vector xBasis
The basis vector for the x-axis.
Vector xTransform = thisMatrix.xBasis;
- Since
- 1.0
Vector yBasis
The basis vector for the y-axis.
Vector yTransform = thisMatrix.yBasis;
- Since
- 1.0
Vector zBasis
The basis vector for the z-axis.
Vector zTransform = thisMatrix.zBasis;
- Since
- 1.0