us.ihmc.euclid.referenceFrame.interfaces.FrameMatrix3DReadOnly Maven / Gradle / Ivy
package us.ihmc.euclid.referenceFrame.interfaces;
import us.ihmc.euclid.exceptions.NotAMatrix2DException;
import us.ihmc.euclid.exceptions.SingularMatrixException;
import us.ihmc.euclid.matrix.interfaces.Matrix3DBasics;
import us.ihmc.euclid.matrix.interfaces.Matrix3DReadOnly;
import us.ihmc.euclid.referenceFrame.ReferenceFrame;
import us.ihmc.euclid.referenceFrame.exceptions.ReferenceFrameMismatchException;
import us.ihmc.euclid.referenceFrame.tools.EuclidFrameIOTools;
import us.ihmc.euclid.tools.EuclidCoreIOTools;
import us.ihmc.euclid.tuple2D.interfaces.Tuple2DBasics;
import us.ihmc.euclid.tuple2D.interfaces.Tuple2DReadOnly;
import us.ihmc.euclid.tuple3D.interfaces.Tuple3DBasics;
import us.ihmc.euclid.tuple3D.interfaces.Tuple3DReadOnly;
import us.ihmc.euclid.tuple4D.interfaces.Vector4DBasics;
import us.ihmc.euclid.tuple4D.interfaces.Vector4DReadOnly;
/**
* Read-only interface for any type of 3-by-3 matrix expressed in a given reference frame.
*
* In addition to representing a {@link Matrix3DReadOnly}, a {@link ReferenceFrame} is associated to
* a {@code FrameMatrix3DReadOnly}. This allows, for instance, to enforce, at runtime, that
* operations on matrices occur in the same coordinate system.
*
*
* Because a {@code FrameMatrix3DReadOnly} extends {@code Matrix3DReadOnly}, it is compatible with
* methods only requiring {@code Matrix3DReadOnly}. However, these methods do NOT assert that the
* operation occur in the proper coordinate system. Use this feature carefully and always prefer
* using methods requiring {@code FrameMatrix3DReadOnly}.
*
*
* @author Sylvain Bertrand
*/
public interface FrameMatrix3DReadOnly extends Matrix3DReadOnly, EuclidFrameGeometry
{
/**
* Packs a column of this matrix into a 3D frame tuple.
*
* @param column the index of the column to pack.
* @param columnToPack the tuple in which the column of this matrix is stored. Modified.
* @throws ArrayIndexOutOfBoundsException if {@code column} ∉ [0, 2].
* @throws ReferenceFrameMismatchException if {@code columnToPack} is not expressed in the same
* reference frame as {@code this}.
*/
default void getColumn(int column, FixedFrameTuple3DBasics columnToPack)
{
checkReferenceFrameMatch(columnToPack);
Matrix3DReadOnly.super.getColumn(column, columnToPack);
}
/**
* Packs a column of this matrix into a 3D frame tuple.
*
* @param column the index of the column to pack.
* @param columnToPack the tuple in which the column of this matrix is stored. Modified.
* @throws ArrayIndexOutOfBoundsException if {@code column} ∉ [0, 2].
*/
default void getColumn(int column, FrameTuple3DBasics columnToPack)
{
columnToPack.setReferenceFrame(getReferenceFrame());
Matrix3DReadOnly.super.getColumn(column, columnToPack);
}
/**
* Packs a row of this matrix into a 3D frame tuple.
*
* @param row the index of the row to pack.
* @param rowToPack the array in which the row of this matrix is stored. Modified.
* @throws ArrayIndexOutOfBoundsException if {@code row} ∉ [0, 2].
* @throws ReferenceFrameMismatchException if {@code rowToPack} is not expressed in the same
* reference frame as {@code this}.
*/
default void getRow(int row, FixedFrameTuple3DBasics rowToPack)
{
checkReferenceFrameMatch(rowToPack);
Matrix3DReadOnly.super.getRow(row, rowToPack);
}
/**
* Packs a row of this matrix into a 3D frame tuple.
*
* @param row the index of the row to pack.
* @param rowToPack the array in which the row of this matrix is stored. Modified.
* @throws ArrayIndexOutOfBoundsException if {@code row} ∉ [0, 2].
*/
default void getRow(int row, FrameTuple3DBasics rowToPack)
{
rowToPack.setReferenceFrame(getReferenceFrame());
Matrix3DReadOnly.super.getRow(row, rowToPack);
}
/**
* Transforms the given tuple by this matrix.
*
* tupleToTransform = this * tupleToTransform
*
*
* @param tupleToTransform the tuple to transform. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FixedFrameTuple3DBasics tupleToTransform)
{
transform(tupleToTransform, tupleToTransform);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameTuple3DReadOnly tupleOriginal, Tuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleOriginal);
Matrix3DReadOnly.super.transform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(Tuple3DReadOnly tupleOriginal, FixedFrameTuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleTransformed);
Matrix3DReadOnly.super.transform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @throws ReferenceFrameMismatchException if either {@code tupleOriginal} or
* {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameTuple3DReadOnly tupleOriginal, FixedFrameTuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleOriginal, tupleTransformed);
Matrix3DReadOnly.super.transform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple by this matrix and add the result to the tuple.
*
* tupleToTransform = tupleToTransform + this * tupleToTransform
*
*
* @param tupleToTransform the tuple to transform. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void addTransform(FixedFrameTuple3DBasics tupleToTransform)
{
addTransform(tupleToTransform, tupleToTransform);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and add the result to
* {@code tupleTransformed}.
*
* tupleTransformed = tupleTransformed + this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to add the result to. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void addTransform(FrameTuple3DReadOnly tupleOriginal, Tuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleOriginal);
Matrix3DReadOnly.super.addTransform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and add the result to
* {@code tupleTransformed}.
*
* tupleTransformed = tupleTransformed + this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to add the result to. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void addTransform(Tuple3DReadOnly tupleOriginal, FixedFrameTuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleTransformed);
Matrix3DReadOnly.super.addTransform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and add the result to
* {@code tupleTransformed}.
*
* tupleTransformed = tupleTransformed + this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to add the result to. Modified.
* @throws ReferenceFrameMismatchException if either {@code tupleOriginal} or
* {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void addTransform(FrameTuple3DReadOnly tupleOriginal, FixedFrameTuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleOriginal, tupleTransformed);
Matrix3DReadOnly.super.addTransform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple by this matrix and subtract the result to the tuple.
*
* tupleToTransform = tupleToTransform - this * tupleToTransform
*
*
* @param tupleToTransform the tuple to transform. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void subTransform(FixedFrameTuple3DBasics tupleToTransform)
{
subTransform(tupleToTransform, tupleToTransform);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and subtract the result to
* {@code tupleTransformed}.
*
* tupleTransformed = tupleTransformed - this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to subtract the result to. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void subTransform(FrameTuple3DReadOnly tupleOriginal, Tuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleOriginal);
Matrix3DReadOnly.super.subTransform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and subtract the result to
* {@code tupleTransformed}.
*
* tupleTransformed = tupleTransformed - this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to subtract the result to. Modified.
* @throws ReferenceFrameMismatchException if {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void subTransform(Tuple3DReadOnly tupleOriginal, FixedFrameTuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleTransformed);
Matrix3DReadOnly.super.subTransform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and subtract the result to
* {@code tupleTransformed}.
*
* tupleTransformed = tupleTransformed - this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to subtract the result to. Modified.
* @throws ReferenceFrameMismatchException if either {@code tupleOriginal} or
* {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void subTransform(FrameTuple3DReadOnly tupleOriginal, FixedFrameTuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleOriginal, tupleTransformed);
Matrix3DReadOnly.super.subTransform(tupleOriginal, tupleTransformed);
}
/**
* Transforms the given tuple by this matrix.
*
* tupleToTransform = this * tupleToTransform
*
*
* @param tupleToTransform the tuple to transform. Modified.
* @throws NotAMatrix2DException if this matrix does not represent a transformation in the
* XY plane.
* @throws ReferenceFrameMismatchException if {@code tupleToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FixedFrameTuple2DBasics tupleToTransform)
{
transform(tupleToTransform, tupleToTransform, true);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @throws NotAMatrix2DException if this matrix does not represent a transformation in the
* XY plane.
* @throws ReferenceFrameMismatchException if {@code tupleOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameTuple2DReadOnly tupleOriginal, Tuple2DBasics tupleTransformed)
{
transform(tupleOriginal, tupleTransformed, true);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @throws NotAMatrix2DException if this matrix does not represent a transformation in the
* XY plane.
* @throws ReferenceFrameMismatchException if {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(Tuple2DReadOnly tupleOriginal, FixedFrameTuple2DBasics tupleTransformed)
{
transform(tupleOriginal, tupleTransformed, true);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @throws NotAMatrix2DException if this matrix does not represent a transformation in the
* XY plane.
* @throws ReferenceFrameMismatchException if either {@code tupleOriginal} or
* {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameTuple2DReadOnly tupleOriginal, FixedFrameTuple2DBasics tupleTransformed)
{
transform(tupleOriginal, tupleTransformed, true);
}
/**
* Transforms the given tuple by this matrix.
*
* tupleToTransform = this * tupleToTransform
*
*
* @param tupleToTransform the tuple to transform. Modified.
* @param checkIfTransformInXYPlane whether this method should assert that this matrix represents a
* transformation in the XY plane.
* @throws NotAMatrix2DException if {@code checkIfTransformInXYPlane == true} and this
* matrix does not represent a transformation in the XY
* plane.
* @throws ReferenceFrameMismatchException if {@code tupleToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FixedFrameTuple2DBasics tupleToTransform, boolean checkIfTransformInXYPlane)
{
transform(tupleToTransform, tupleToTransform, checkIfTransformInXYPlane);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @param checkIfRotationInXYPlane whether this method should assert that this matrix represents a
* transformation in the XY plane.
* @throws NotAMatrix2DException if {@code checkIfTransformInXYPlane == true} and this
* matrix does not represent a transformation in the XY
* plane.
* @throws ReferenceFrameMismatchException if {@code tupleOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameTuple2DReadOnly tupleOriginal, Tuple2DBasics tupleTransformed, boolean checkIfRotationInXYPlane)
{
checkReferenceFrameMatch(tupleOriginal);
Matrix3DReadOnly.super.transform(tupleOriginal, tupleTransformed, checkIfRotationInXYPlane);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @param checkIfRotationInXYPlane whether this method should assert that this matrix represents a
* transformation in the XY plane.
* @throws NotAMatrix2DException if {@code checkIfTransformInXYPlane == true} and this
* matrix does not represent a transformation in the XY
* plane.
* @throws ReferenceFrameMismatchException if {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(Tuple2DReadOnly tupleOriginal, FixedFrameTuple2DBasics tupleTransformed, boolean checkIfRotationInXYPlane)
{
checkReferenceFrameMatch(tupleTransformed);
Matrix3DReadOnly.super.transform(tupleOriginal, tupleTransformed, checkIfRotationInXYPlane);
}
/**
* Transforms the given tuple {@code tupleOriginal} by this matrix and stores the result in
* {@code tupleTransformed}.
*
* tupleTransformed = this * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple to store the result. Modified.
* @param checkIfRotationInXYPlane whether this method should assert that this matrix represents a
* transformation in the XY plane.
* @throws NotAMatrix2DException if {@code checkIfTransformInXYPlane == true} and this
* matrix does not represent a transformation in the XY
* plane.
* @throws ReferenceFrameMismatchException if either {@code tupleOriginal} or
* {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameTuple2DReadOnly tupleOriginal, FixedFrameTuple2DBasics tupleTransformed, boolean checkIfRotationInXYPlane)
{
checkReferenceFrameMatch(tupleOriginal, tupleTransformed);
Matrix3DReadOnly.super.transform(tupleOriginal, tupleTransformed, checkIfRotationInXYPlane);
}
/**
* Transforms the given 3D matrix by this matrix.
*
* matrixToTransform = this * matrixToTransform * this-1
*
*
* @param matrixToTransform the matrix to transform. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code matrixToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FixedFrameMatrix3DBasics matrixToTransform)
{
transform(matrixToTransform, matrixToTransform);
}
/**
* Transforms the given 3D matrix {@code matrixOriginal} by this matrix and stores the result in
* {@code matrixTransformed}.
*
* matrixTransformed = this * matrixOriginal * this-1
*
*
* @param matrixOriginal the matrix to transform. Not modified.
* @param matrixTransformed the matrix in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code matrixOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameMatrix3DReadOnly matrixOriginal, Matrix3DBasics matrixTransformed)
{
checkReferenceFrameMatch(matrixOriginal);
transform((Matrix3DReadOnly) matrixOriginal, matrixTransformed);
}
/**
* Transforms the given 3D matrix {@code matrixOriginal} by this matrix and stores the result in
* {@code matrixTransformed}.
*
* matrixTransformed = this * matrixOriginal * this-1
*
*
* @param matrixOriginal the matrix to transform. Not modified.
* @param matrixTransformed the matrix in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code matrixTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(Matrix3DReadOnly matrixOriginal, FixedFrameMatrix3DBasics matrixTransformed)
{
checkReferenceFrameMatch(matrixTransformed);
transform(matrixOriginal, (Matrix3DBasics) matrixTransformed);
}
/**
* Transforms the given 3D matrix {@code matrixOriginal} by this matrix and stores the result in
* {@code matrixTransformed}.
*
* matrixTransformed = this * matrixOriginal * this-1
*
*
* @param matrixOriginal the matrix to transform. Not modified.
* @param matrixTransformed the matrix in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if either {@code matrixOriginal} or
* {@code matrixTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameMatrix3DReadOnly matrixOriginal, FixedFrameMatrix3DBasics matrixTransformed)
{
checkReferenceFrameMatch(matrixOriginal);
checkReferenceFrameMatch(matrixTransformed);
transform((Matrix3DReadOnly) matrixOriginal, (Matrix3DBasics) matrixTransformed);
}
/**
* Transforms the vector part of the given 4D vector.
*
* vectorToTransform.s = vectorToTransform.s
* vectorToTransform.xyz = this * vectorToTransform.xyz
*
*
* @param vectorToTransform the vector to transform. Modified.
* @throws ReferenceFrameMismatchException if {@code vectorToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FixedFrameVector4DBasics vectorToTransform)
{
transform(vectorToTransform, vectorToTransform);
}
/**
* Transforms the vector part of the given 4D vector {@code vectorOriginal} and stores the result
* into {@code vectorTransformed}.
*
* vectorTransformed.s = vectorOriginal.s
* vectorTransformed.xyz = this * vectorOriginal.xyz
*
*
* @param vectorOriginal the vector to transform. Not modified.
* @param vectorTransformed the vector in which the result is stored. Modified.
* @throws ReferenceFrameMismatchException if {@code vectorOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameVector4DReadOnly vectorOriginal, Vector4DBasics vectorTransformed)
{
checkReferenceFrameMatch(vectorOriginal);
Matrix3DReadOnly.super.transform(vectorOriginal, vectorTransformed);
}
/**
* Transforms the vector part of the given 4D vector {@code vectorOriginal} and stores the result
* into {@code vectorTransformed}.
*
* vectorTransformed.s = vectorOriginal.s
* vectorTransformed.xyz = this * vectorOriginal.xyz
*
*
* @param vectorOriginal the vector to transform. Not modified.
* @param vectorTransformed the vector in which the result is stored. Modified.
* @throws ReferenceFrameMismatchException if {@code vectorTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(Vector4DReadOnly vectorOriginal, FixedFrameVector4DBasics vectorTransformed)
{
checkReferenceFrameMatch(vectorTransformed);
Matrix3DReadOnly.super.transform(vectorOriginal, vectorTransformed);
}
/**
* Transforms the vector part of the given 4D vector {@code vectorOriginal} and stores the result
* into {@code vectorTransformed}.
*
* vectorTransformed.s = vectorOriginal.s
* vectorTransformed.xyz = this * vectorOriginal.xyz
*
*
* @param vectorOriginal the vector to transform. Not modified.
* @param vectorTransformed the vector in which the result is stored. Modified.
* @throws ReferenceFrameMismatchException if either {@code vectorOriginal} or
* {@code vectorTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void transform(FrameVector4DReadOnly vectorOriginal, FixedFrameVector4DBasics vectorTransformed)
{
checkReferenceFrameMatch(vectorOriginal, vectorTransformed);
Matrix3DReadOnly.super.transform(vectorOriginal, vectorTransformed);
}
/**
* Performs the inverse of the transform to the given tuple by this matrix.
*
* tupleToTransform = this-1 * tupleToTransform
*
*
* @param tupleToTransform the tuple to transform. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FixedFrameTuple3DBasics tupleToTransform)
{
inverseTransform(tupleToTransform, tupleToTransform);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameTuple3DReadOnly tupleOriginal, Tuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleOriginal);
inverseTransform((Tuple3DReadOnly) tupleOriginal, tupleTransformed);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(Tuple3DReadOnly tupleOriginal, FixedFrameTuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleTransformed);
inverseTransform(tupleOriginal, (Tuple3DBasics) tupleTransformed);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if either {@code tupleOriginal} or
* {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameTuple3DReadOnly tupleOriginal, FixedFrameTuple3DBasics tupleTransformed)
{
checkReferenceFrameMatch(tupleOriginal, tupleTransformed);
inverseTransform((Tuple3DReadOnly) tupleOriginal, (Tuple3DBasics) tupleTransformed);
}
/**
* Performs the inverse of the transform to the given tuple by this matrix.
*
* tupleToTransform = this-1 * tupleToTransform
*
*
* @param tupleToTransform the tuple to transform. Modified.
* @throws NotAMatrix2DException if this matrix does not represent a transformation in the
* XY plane.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FixedFrameTuple2DBasics tupleToTransform)
{
inverseTransform(tupleToTransform, tupleToTransform, true);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @throws NotAMatrix2DException if this matrix does not represent a transformation in the
* XY plane.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameTuple2DReadOnly tupleOriginal, Tuple2DBasics tupleTransformed)
{
inverseTransform(tupleOriginal, tupleTransformed, true);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @throws NotAMatrix2DException if this matrix does not represent a transformation in the
* XY plane.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(Tuple2DReadOnly tupleOriginal, FixedFrameTuple2DBasics tupleTransformed)
{
inverseTransform(tupleOriginal, tupleTransformed, true);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @throws NotAMatrix2DException if this matrix does not represent a transformation in the
* XY plane.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if either {@code tupleOriginal} or
* {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameTuple2DReadOnly tupleOriginal, FixedFrameTuple2DBasics tupleTransformed)
{
inverseTransform(tupleOriginal, tupleTransformed, true);
}
/**
* Performs the inverse of the transform to the given tuple by this matrix.
*
* tupleToTransform = this-1 * tupleToTransform
*
*
* @param tupleToTransform the tuple to transform. Modified.
* @param checkIfTransformInXYPlane whether this method should assert that this matrix represents a
* transformation in the XY plane.
* @throws NotAMatrix2DException if {@code checkIfTransformInXYPlane == true} and this
* matrix does not represent a transformation in the XY
* plane.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FixedFrameTuple2DBasics tupleToTransform, boolean checkIfTransformInXYPlane)
{
inverseTransform(tupleToTransform, tupleToTransform, checkIfTransformInXYPlane);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @param checkIfTransformInXYPlane whether this method should assert that this matrix represents a
* transformation in the XY plane.
* @throws NotAMatrix2DException if {@code checkIfTransformInXYPlane == true} and this
* matrix does not represent a transformation in the XY
* plane.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameTuple2DReadOnly tupleOriginal, Tuple2DBasics tupleTransformed, boolean checkIfTransformInXYPlane)
{
checkReferenceFrameMatch(tupleOriginal);
inverseTransform((Tuple2DReadOnly) tupleOriginal, tupleTransformed, checkIfTransformInXYPlane);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @param checkIfTransformInXYPlane whether this method should assert that this matrix represents a
* transformation in the XY plane.
* @throws NotAMatrix2DException if {@code checkIfTransformInXYPlane == true} and this
* matrix does not represent a transformation in the XY
* plane.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(Tuple2DReadOnly tupleOriginal, FixedFrameTuple2DBasics tupleTransformed, boolean checkIfTransformInXYPlane)
{
checkReferenceFrameMatch(tupleTransformed);
inverseTransform(tupleOriginal, (Tuple2DBasics) tupleTransformed, checkIfTransformInXYPlane);
}
/**
* Performs the inverse of the transform to the given tuple {@code tupleOriginal} by this matrix and
* stores the result in {@code tupleTransformed}.
*
* tupleTransformed = this-1 * tupleOriginal
*
*
* @param tupleOriginal the tuple to transform. Not modified.
* @param tupleTransformed the tuple in which the result is stored. Modified.
* @param checkIfTransformInXYPlane whether this method should assert that this matrix represents a
* transformation in the XY plane.
* @throws NotAMatrix2DException if {@code checkIfTransformInXYPlane == true} and this
* matrix does not represent a transformation in the XY
* plane.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if either {@code tupleOriginal} or
* {@code tupleTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameTuple2DReadOnly tupleOriginal, FixedFrameTuple2DBasics tupleTransformed, boolean checkIfTransformInXYPlane)
{
checkReferenceFrameMatch(tupleOriginal, tupleTransformed);
inverseTransform((Tuple2DReadOnly) tupleOriginal, (Tuple2DBasics) tupleTransformed, checkIfTransformInXYPlane);
}
/**
* Performs the inverse of the transforms to the given 3D matrix {@code matrixOriginal} by this
* matrix.
*
* matrixToTransform = this-1 * matrixToTransform * this
*
*
* @param matrixToTransform the matrix to transform. Not modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code matrixToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FixedFrameMatrix3DBasics matrixToTransform)
{
inverseTransform(matrixToTransform, matrixToTransform);
}
/**
* Performs the inverse of the transforms to the given 3D matrix {@code matrixOriginal} by this
* matrix and stores the result in {@code matrixTransformed}.
*
* matrixTransformed = this-1 * matrixOriginal * this
*
*
* @param matrixOriginal the matrix to transform. Not modified.
* @param matrixTransformed the matrix in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code matrixOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameMatrix3DReadOnly matrixOriginal, Matrix3DBasics matrixTransformed)
{
checkReferenceFrameMatch(matrixOriginal);
inverseTransform((Matrix3DReadOnly) matrixOriginal, matrixTransformed);
}
/**
* Performs the inverse of the transforms to the given 3D matrix {@code matrixOriginal} by this
* matrix and stores the result in {@code matrixTransformed}.
*
* matrixTransformed = this-1 * matrixOriginal * this
*
*
* @param matrixOriginal the matrix to transform. Not modified.
* @param matrixTransformed the matrix in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code matrixTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(Matrix3DReadOnly matrixOriginal, FixedFrameMatrix3DBasics matrixTransformed)
{
checkReferenceFrameMatch(matrixTransformed);
inverseTransform(matrixOriginal, (Matrix3DBasics) matrixTransformed);
}
/**
* Performs the inverse of the transforms to the given 3D matrix {@code matrixOriginal} by this
* matrix and stores the result in {@code matrixTransformed}.
*
* matrixTransformed = this-1 * matrixOriginal * this
*
*
* @param matrixOriginal the matrix to transform. Not modified.
* @param matrixTransformed the matrix in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if either {@code matrixOriginal} or
* {@code matrixTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameMatrix3DReadOnly matrixOriginal, FixedFrameMatrix3DBasics matrixTransformed)
{
checkReferenceFrameMatch(matrixOriginal, matrixTransformed);
inverseTransform((Matrix3DReadOnly) matrixOriginal, (Matrix3DBasics) matrixTransformed);
}
/**
* Performs the inverse of the transform to the vector part the given 4D vector by this matrix.
*
* vectorToTransform.s = vectorToTransform.s
* vectorToTransform.xyz = this-1 * vectorToTransform.xyz
*
*
* @param vectorToTransform the vector to transform. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code vectorToTransform} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FixedFrameVector4DBasics vectorToTransform)
{
inverseTransform(vectorToTransform, vectorToTransform);
}
/**
* Performs the inverse of the transform to the vector part the given 4D vector
* {@code vectorOriginal} by this matrix and stores the result in {@code vectorTransformed}.
*
* vectorTransformed.s = vectorOriginal.s
* vectorTransformed.xyz = this-1 * vectorOriginal.xyz
*
*
* @param vectorOriginal the vector to transform. Not modified.
* @param vectorTransformed the vector in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code vectorOriginal} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameVector4DReadOnly vectorOriginal, Vector4DBasics vectorTransformed)
{
checkReferenceFrameMatch(vectorOriginal);
inverseTransform((Vector4DReadOnly) vectorOriginal, vectorTransformed);
}
/**
* Performs the inverse of the transform to the vector part the given 4D vector
* {@code vectorOriginal} by this matrix and stores the result in {@code vectorTransformed}.
*
* vectorTransformed.s = vectorOriginal.s
* vectorTransformed.xyz = this-1 * vectorOriginal.xyz
*
*
* @param vectorOriginal the vector to transform. Not modified.
* @param vectorTransformed the vector in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if {@code vectorTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(Vector4DReadOnly vectorOriginal, FixedFrameVector4DBasics vectorTransformed)
{
checkReferenceFrameMatch(vectorTransformed);
inverseTransform(vectorOriginal, (Vector4DBasics) vectorTransformed);
}
/**
* Performs the inverse of the transform to the vector part the given 4D vector
* {@code vectorOriginal} by this matrix and stores the result in {@code vectorTransformed}.
*
* vectorTransformed.s = vectorOriginal.s
* vectorTransformed.xyz = this-1 * vectorOriginal.xyz
*
*
* @param vectorOriginal the vector to transform. Not modified.
* @param vectorTransformed the vector in which the result is stored. Modified.
* @throws SingularMatrixException if this matrix is not invertible.
* @throws ReferenceFrameMismatchException if either {@code vectorOriginal} or
* {@code vectorTransformed} is not expressed in the same
* reference frame as {@code this}.
*/
default void inverseTransform(FrameVector4DReadOnly vectorOriginal, FixedFrameVector4DBasics vectorTransformed)
{
checkReferenceFrameMatch(vectorOriginal, vectorTransformed);
inverseTransform((Vector4DReadOnly) vectorOriginal, (Vector4DBasics) vectorTransformed);
}
/**
* Gets a representative {@code String} of this matrix 3D given a specific format to use.
*
* Using the default format {@link EuclidCoreIOTools#DEFAULT_FORMAT}, this provides a {@code String}
* as follows:
*
*
* /-0.576, -0.784, 0.949 \
* | 0.649, -0.542, -0.941 |
* \-0.486, -0.502, -0.619 /
* worldFrame
*
*
*/
@Override
default String toString(String format)
{
return EuclidFrameIOTools.getFrameMatrix3DString(format, this);
}
}