com.kuka.roboticsAPI.geometricModel.math
Class MatrixRotation

java.lang.Object
  extended by com.kuka.roboticsAPI.geometricModel.math.AbstractRotation
      extended by com.kuka.roboticsAPI.geometricModel.math.MatrixRotation
All Implemented Interfaces:
IRotation

public final class MatrixRotation
extends AbstractRotation

Immutable representation of a spatial rotation in matrix form.


Field Summary
static MatrixRotation NONE
          Immutable MatrixRotation instance representing no rotation.
 
Method Summary
 MatrixRotation compose(MatrixRotation other)
          The effect of A.compose(B) is that of the matrix multiplication A*B.
 boolean equals(Object obj)
           
 void fillRowFirstArray(double[] elements)
          Fills a "RowFirst" representation (double[3,3]) Array "Frame33" - represented as 9 element vector.
 Matrix getMatrix()
          Returns the underlying matrix that represents this rotation.
 Vector getUnitVectorX()
          Returns the x unit vector after it has been rotated by this rotation.
 Vector getUnitVectorY()
          Returns the y unit vector after it has been rotated by this rotation.
 Vector getUnitVectorZ()
          Returns the z unit vector after it has been rotated by this rotation.
 int hashCode()
           
 MatrixRotation invert()
          Returns an inverted rotation, i.e. a rotation that reverses the effect of this one.
static MatrixRotation of(IRotation orig)
          Returns an immutable instance from the values of the provided rotation.
static MatrixRotation of(Matrix matrix)
          Checked creation of a MatrixRotation from a given rotation matrix.
static MatrixRotation ofUnchecked(Matrix matrix)
          Unchecked creation of a MatrixRotation from a given rotation matrix.
 double[] toRowFirstArray()
          Serialization Support Serialize the MatrixRotation to a linear 9 Vector to support "rowFirstArray" (double[3][3]) Frame33 Represenations.
 String toString()
          Returns a textual description of the rotation.
 
Methods inherited from class com.kuka.roboticsAPI.geometricModel.math.AbstractRotation
applyTo, applyTo, compose, rotationalDistanceTo, rotationTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final MatrixRotation NONE
Immutable MatrixRotation instance representing no rotation.

Method Detail

ofUnchecked

public static MatrixRotation ofUnchecked(Matrix matrix)
Unchecked creation of a MatrixRotation from a given rotation matrix. The matrix must be a rotation matrix, i.e. it must fulfill the following conditions:

equal(matrix.determinant(), 1, epsilon);
equal(matrix.transpose(), matrix.invert(), epsilon);

where equal(a, b, epsilon) is an element-wise test of approximate equality (small epsilon test).

Caution: Don't use this method unless you are absolutely sure that the matrix is a valid rotation matrix! If in doubt, use of(Matrix).

Parameters:
matrix - a rotation matrix. Will be checked if (and only if) assertions are enabled in the VM.
Returns:
the instance

of

public static MatrixRotation of(Matrix matrix)
Checked creation of a MatrixRotation from a given rotation matrix. The matrix must be a rotation matrix, i.e. it must fulfill the following conditions:

equal(matrix.determinant(), 1, epsilon);
equal(matrix.transpose(), matrix.invert(), epsilon);

where equal(a, b, epsilon) is an element-wise test of approximate equality (small epsilon test).

The above conditions will be checked upon creation of the rotation.

Parameters:
matrix - a rotation matrix. Will be checked.
Returns:
the instance
Throws:
IllegalArgumentException - if the matrix is null or not a rotation matrix

of

public static MatrixRotation of(IRotation orig)
Returns an immutable instance from the values of the provided rotation.

Parameters:
orig - the instance from which to take over the rotation
Returns:
an immutable instance

getMatrix

public Matrix getMatrix()
Returns the underlying matrix that represents this rotation.

Specified by:
getMatrix in interface IRotation
Specified by:
getMatrix in class AbstractRotation
Returns:
the corresponding rotation matrix.

compose

public MatrixRotation compose(MatrixRotation other)
The effect of A.compose(B) is that of the matrix multiplication A*B.

Parameters:
other - the rotation to combine with this one
Returns:
the combined matrix rotation

invert

public MatrixRotation invert()
Description copied from interface: IRotation
Returns an inverted rotation, i.e. a rotation that reverses the effect of this one.

Specified by:
invert in interface IRotation
Overrides:
invert in class AbstractRotation
Returns:
the inverted rotation.

getUnitVectorX

public Vector getUnitVectorX()
Returns the x unit vector after it has been rotated by this rotation. The unit vectors returned by the corresponding methods of this rotation span a right-handed orthogonal rotated coordinate system.

Returns:
x unit vector after the rotation.
See Also:
getUnitVectorY(), getUnitVectorZ()

getUnitVectorY

public Vector getUnitVectorY()
Returns the y unit vector after it has been rotated by this rotation. The unit vectors returned by the corresponding methods of this rotation span a right-handed orthogonal rotated coordinate system.

Returns:
y unit vector after the rotation.
See Also:
getUnitVectorX(), getUnitVectorZ()

getUnitVectorZ

public Vector getUnitVectorZ()
Returns the z unit vector after it has been rotated by this rotation. The unit vectors returned by the corresponding methods of this rotation span a right-handed orthogonal rotated coordinate system.

Returns:
z unit vector after the rotation.
See Also:
getUnitVectorX(), getUnitVectorY()

toRowFirstArray

public double[] toRowFirstArray()
Serialization Support Serialize the MatrixRotation to a linear 9 Vector to support "rowFirstArray" (double[3][3]) Frame33 Represenations.

Returns:
newly created 9 Element Vector (to support a row-first 3x3 Array). The sequence of the elements is [rot00, rot01, rot02, rot10, rot11, rot12, rot20,rot21,rot22].

fillRowFirstArray

public void fillRowFirstArray(double[] elements)
Fills a "RowFirst" representation (double[3,3]) Array "Frame33" - represented as 9 element vector. In contrast to @see toRowFirstArray(), the memory of the "elements" vector is already considered to be existent and of the length 9.

Parameters:
elements - - a double vector with exactly 9 Elements It will be filled with the elements of the rotation in the following sequence: [rot00, rot01, rot02, rot10, rot11, rot12, rot20,rot21,rot22]

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Returns a textual description of the rotation. The representation is subject to change.

This implementation will return the rotation matrix in row-first order. The following string can be regarded as typical:

"[[0.00 0.00 -1.00]; [0.00 -1.00 0.00]; [-1.00 0.00 0.00]]"

Overrides:
toString in class AbstractRotation
Returns:
a brief description of the transformation


Copyright © 2019. All rights reserved.