Leap Motion Java API Reference  0.8.0
com.leapmotion.leap.Matrix Class Reference

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

Public Member Functions

boolean equals (Matrix other)
 Compare Matrix equality component-wise.
 
Vector getOrigin ()
 The translation factors for all three axes.
 
Vector getXBasis ()
 The rotation and scale factors for the x-axis.
 
Vector getYBasis ()
 The rotation and scale factors for the y-axis.
 
Vector getZBasis ()
 The rotation and scale factors for the z-axis.
 
 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 setOrigin (Vector value)
 The translation factors for all three axes.
 
void setRotation (Vector axis, float angleRadians)
 Sets this transformation matrix to represent a rotation around the specified vector.
 
void setXBasis (Vector value)
 The rotation and scale factors for the x-axis.
 
void setYBasis (Vector value)
 The rotation and scale factors for the y-axis.
 
void setZBasis (Vector value)
 The rotation and scale factors for the z-axis.
 
Matrix times (Matrix other)
 Multiply transform matrices.
 
String toString ()
 Write the matrix to a string in a human readable format.
 
Vector transformDirection (Vector in)
 Transforms a vector with this matrix by transforming its rotation and scale only.
 
Vector transformPoint (Vector in)
 Transforms a vector with this matrix by transforming its rotation, scale, and translation.
 

Static Public Member Functions

static Matrix identity ()
 Returns the identity matrix specifying no translation, rotation, and scale.
 

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

com.leapmotion.leap.Matrix.Matrix ( )

Constructs an identity transformation matrix.

com.leapmotion.leap.Matrix.Matrix ( Matrix  other)

Constructs a copy of the specified Matrix object.

com.leapmotion.leap.Matrix.Matrix ( Vector  _xBasis,
Vector  _yBasis,
Vector  _zBasis 
)

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.
com.leapmotion.leap.Matrix.Matrix ( Vector  _xBasis,
Vector  _yBasis,
Vector  _zBasis,
Vector  _origin 
)

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.
com.leapmotion.leap.Matrix.Matrix ( Vector  axis,
float  angleRadians 
)

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.
com.leapmotion.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.

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

boolean com.leapmotion.leap.Matrix.equals ( Matrix  other)

Compare Matrix equality component-wise.

Vector com.leapmotion.leap.Matrix.getOrigin ( )

The translation factors for all three axes.

Vector com.leapmotion.leap.Matrix.getXBasis ( )

The rotation and scale factors for the x-axis.

Vector com.leapmotion.leap.Matrix.getYBasis ( )

The rotation and scale factors for the y-axis.

Vector com.leapmotion.leap.Matrix.getZBasis ( )

The rotation and scale factors for the z-axis.

static Matrix com.leapmotion.leap.Matrix.identity ( )
static

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

Returns
The identity matrix.
Matrix com.leapmotion.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 matricies that are directly returned by the API are rigid.

Returns
The rigid inverse of the matrix.
void com.leapmotion.leap.Matrix.setOrigin ( Vector  value)

The translation factors for all three axes.

void com.leapmotion.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.

Parameters
axisA Vector specifying the axis of rotation.
angleRadiansThe amount of rotation in radians.
void com.leapmotion.leap.Matrix.setXBasis ( Vector  value)

The rotation and scale factors for the x-axis.

void com.leapmotion.leap.Matrix.setYBasis ( Vector  value)

The rotation and scale factors for the y-axis.

void com.leapmotion.leap.Matrix.setZBasis ( Vector  value)

The rotation and scale factors for the z-axis.

Matrix com.leapmotion.leap.Matrix.times ( Matrix  other)

Multiply transform matrices.

Combines two transformations into a single equivalent transformation.

Parameters
otherA Matrix to multiply on the right hand side.
Returns
A new Matrix representing the transformation equivalent to applying the other transformation followed by this transformation.
String com.leapmotion.leap.Matrix.toString ( )

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

Vector com.leapmotion.leap.Matrix.transformDirection ( Vector  in)

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 com.leapmotion.leap.Matrix.transformPoint ( Vector  in)

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.