/** * Sets this matrix coefficients to the per-component sum of the two given matrices. * <p> * this = matrix1 + matrix2 * </p> * * @param matrix1 the first term of the addition. Not modified. * @param matrix2 the second term of the addition. Not modified. * @throws ReferenceFrameMismatchException if either {@code matrix1} or {@code matrix2} is not * expressed in the same reference frame as {@code this}. */ default void add(FrameMatrix3DReadOnly matrix1, FrameMatrix3DReadOnly matrix2) { checkReferenceFrameMatch(matrix1); checkReferenceFrameMatch(matrix2); Matrix3DBasics.super.add(matrix1, matrix2); }
/** * Sets this matrix to {@code matrix3DReadOnly}. * * @param referenceFrame the reference frame in which the matrix is expressed. * @param matrix3DReadOnly the other matrix to copy the values of. Not modified. * @throws ReferenceFrameMismatchException if the matrix is not expressed in the same reference * frame as {@code this}. */ default void set(ReferenceFrame referenceFrame, Matrix3DReadOnly matrix3DReadOnly) { checkReferenceFrameMatch(referenceFrame); set(matrix3DReadOnly); }
/** * Sets this matrix to {@code other}. * * @param other the other frame matrix to copy the values of. Not modified. * @throws ReferenceFrameMismatchException if the matrix is not expressed in the same reference * frame as {@code this}. */ default void set(FrameMatrix3DReadOnly other) { set(other.getReferenceFrame(), other); }
/** * Sets this matrix to {@code other}. * <p> * If {@code other} is expressed in the frame as {@code this}, then this method is equivalent to * {@link #set(FrameMatrix3DReadOnly)}. * </p> * <p> * If {@code other} is expressed in a different frame than {@code this}, then {@code this} is set * to {@code other} once transformed to be expressed in {@code this.getReferenceFrame()}. * </p> * * @param other the other frame matrix to set this to. Not modified. */ default void setMatchingFrame(FrameMatrix3DReadOnly other) { Matrix3DBasics.super.set(other); other.getReferenceFrame().transformFromThisToDesiredFrame(getReferenceFrame(), this); }
@Test public void testSetMatchingFrame() throws Exception { Random random = new Random(544354); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame sourceFrame = EuclidFrameRandomTools.nextReferenceFrame(random, true); ReferenceFrame destinationFrame = EuclidFrameRandomTools.nextReferenceFrame(random, true); FrameMatrix3DReadOnly source = EuclidFrameRandomTools.nextFrameMatrix3D(random, sourceFrame); FixedFrameMatrix3DBasics actual = EuclidFrameRandomTools.nextFrameMatrix3D(random, destinationFrame); actual.setMatchingFrame(source); FrameMatrix3D expected = new FrameMatrix3D(source); expected.changeFrame(destinationFrame); EuclidCoreTestTools.assertMatrix3DEquals(expected, actual, EPSILON); } } }
/** * Sets this matrix coefficients to the per-component difference of the two given matrices. * <p> * this = matrix1 - matrix2 * </p> * * @param matrix1 the first term of the addition. Not modified. * @param matrix2 the second term of the addition. Not modified. * @throws ReferenceFrameMismatchException if either {@code matrix1} or {@code matrix2} is not * expressed in the same reference frame as {@code this}. */ default void sub(FrameMatrix3DReadOnly matrix1, FrameMatrix3DReadOnly matrix2) { checkReferenceFrameMatch(matrix1); checkReferenceFrameMatch(matrix2); Matrix3DBasics.super.sub(matrix1, matrix2); }
/** * Sets the 9 coefficients of this matrix to the given ones. * * @param referenceFrame the reference frame in which the given coefficients are expressed. * @param m00 the new 1st row 1st column coefficient for this matrix. * @param m01 the new 1st row 2nd column coefficient for this matrix. * @param m02 the new 1st row 3rd column coefficient for this matrix. * @param m10 the new 2nd row 1st column coefficient for this matrix. * @param m11 the new 2nd row 2nd column coefficient for this matrix. * @param m12 the new 2nd row 3rd column coefficient for this matrix. * @param m20 the new 3rd row 1st column coefficient for this matrix. * @param m21 the new 3rd row 2nd column coefficient for this matrix. * @param m22 the new 3rd row 3rd column coefficient for this matrix. * @throws ReferenceFrameMismatchException if the coefficients are not expressed in the same * reference frame as {@code this}. */ default void set(ReferenceFrame referenceFrame, double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22) { checkReferenceFrameMatch(referenceFrame); set(m00, m01, m02, m10, m11, m12, m20, m21, m22); }
/** * Sets this matrix to {@code other} and then calls {@link #negate()}. * * @param other the other matrix used to update this matrix. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void setAndNegate(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.setAndNegate(other); }
/** * Sets this matrix to equal the other matrix and then normalizes this, see {@link #normalize()}. * * @param other the other matrix used to update this matrix. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void setAndNormalize(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.setAndNormalize(other); }
/** * Sets the {@code row}<sup>th</sup> row components to the values contained in the given tuple * {@code rowValues}. * * @param row the index of the row to set the values of. * @param rowValues the tuple containing the new values for the row. Not modified. * @throws ArrayIndexOutOfBoundsException if {@code row} ∉ [0, 2]. * @throws ReferenceFrameMismatchException if {@code rowValues} is not expressed in the same * reference frame as {@code this}. */ default void setRow(int row, FrameTuple3DReadOnly rowValues) { checkReferenceFrameMatch(rowValues); Matrix3DBasics.super.setRow(row, rowValues); }
/** * Performs a per-component addition onto the coefficients of this matrix. * <p> * this = this + other * </p> * * @param other the other matrix to use for the addition. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void add(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.add(other); }
/** * Performs a matrix multiplication on this. * <p> * this = this * other<sup>T</sup> * </p> * * @param other the other matrix to multiply this by. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void multiplyTransposeOther(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.multiplyTransposeOther(other); }
/** * Performs a matrix multiplication on this. * <p> * this = other * this<sup>T</sup> * </p> * * @param other the other matrix to multiply this by. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void preMultiplyTransposeThis(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.preMultiplyTransposeThis(other); }
/** * Sets this matrix to be equal to the outer-product of {@code other}. * <p> * this = other * other<sup>T<sup> * </p> * * @param other the other matrix used for this operation. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void setAndMultiplyOuter(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.setAndMultiplyOuter(other); }
/** * Performs a matrix multiplication on this. * <p> * this = this * other * </p> * * @param other the other matrix to multiply this by. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void multiply(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.multiply(other); }
/** * Performs a matrix multiplication on this. * <p> * this = other * this * </p> * * @param other the other matrix to multiply this by. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void preMultiply(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.preMultiply(other); }
/** * Sets this matrix to equal the other matrix and then transposes this. * <p> * this = other<sup>T</sup> * </p> * * @param other the other matrix used to update this matrix. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void setAndTranspose(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.setAndTranspose(other); }
/** * Sets the {@code column}<sup>th</sup> column components to the values contained in the given * tuple {@code columnValues}. * * @param column the index of the column to set the values of. * @param columnValues the tuple containing the new values for the column. Not modified. * @throws ArrayIndexOutOfBoundsException if {@code column} ∉ [0, 2]. * @throws ReferenceFrameMismatchException if {@code columnValues} is not expressed in the same * reference frame as {@code this}. */ default void setColumn(int column, FrameTuple3DReadOnly columnValues) { checkReferenceFrameMatch(columnValues); Matrix3DBasics.super.setColumn(column, columnValues); }
/** * Performs a matrix multiplication on this. * <p> * this = this<sup>T</sup> * other * </p> * * @param other the other matrix to multiply this by. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void multiplyTransposeThis(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.multiplyTransposeThis(other); }
/** * Performs a matrix multiplication on this. * <p> * this = other<sup>T</sup> * this * </p> * * @param other the other matrix to multiply this by. Not modified. * @throws ReferenceFrameMismatchException if {@code other} is not expressed in the same * reference frame as {@code this}. */ default void preMultiplyTransposeOther(FrameMatrix3DReadOnly other) { checkReferenceFrameMatch(other); Matrix3DBasics.super.preMultiplyTransposeOther(other); }