/** * Asserts on a per component basis that the two frame tuples are equal to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param messagePrefix prefix to add to the error message. * @param expected the expected frame tuple. Not modified. * @param actual the actual frame tuple. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two tuples are not equal or not expressed in the reference frame. * If only one of the arguments is equal to {@code null}. */ public static void assertFrameTuple4DEquals(String messagePrefix, FrameTuple4DReadOnly expected, FrameTuple4DReadOnly actual, double epsilon) { assertFrameTuple4DEquals(messagePrefix, expected, actual, epsilon, DEFAULT_FORMAT); }
/** * Asserts on a per component basis that the two frame tuples are equal to an {@code epsilon}. * <p> * Note: the two arguments are considered to be equal if they are both equal to {@code null}. * </p> * * @param expected the expected frame tuple. Not modified. * @param actual the actual frame tuple. Not modified. * @param epsilon the tolerance to use. * @throws AssertionError if the two tuples are not equal or not expressed in the reference frame. * If only one of the arguments is equal to {@code null}. */ public static void assertFrameTuple4DEquals(FrameTuple4DReadOnly expected, FrameTuple4DReadOnly actual, double epsilon) { assertFrameTuple4DEquals(null, expected, actual, epsilon); }
@Test public void testMatchingFrame() throws Exception { Random random = new Random(3225); for (int i = 0; i < ITERATIONS; i++) { // Test setMatchingFrame(FrameQuaternionReadOnly other) ReferenceFrame sourceFrame = EuclidFrameRandomTools.nextReferenceFrame(random); ReferenceFrame destinationFrame = EuclidFrameRandomTools.nextReferenceFrame(random); FrameQuaternion expected = EuclidFrameRandomTools.nextFrameQuaternion(random, sourceFrame); FrameQuaternion actual = EuclidFrameRandomTools.nextFrameQuaternion(random, destinationFrame); actual.setMatchingFrame(expected); expected.changeFrame(destinationFrame); EuclidFrameTestTools.assertFrameTuple4DEquals(expected, actual, EPSILON); } for (int i = 0; i < ITERATIONS; i++) { // Test setMatchingFrame(FrameTuple4DReadOnly other) ReferenceFrame sourceFrame = EuclidFrameRandomTools.nextReferenceFrame(random); ReferenceFrame destinationFrame = EuclidFrameRandomTools.nextReferenceFrame(random); FrameTuple4DBasics source = EuclidFrameRandomTools.nextFrameQuaternion(random, sourceFrame); FrameQuaternion actual = EuclidFrameRandomTools.nextFrameQuaternion(random, destinationFrame); actual.setMatchingFrame(source); FrameQuaternion expected = new FrameQuaternion(source); expected.changeFrame(destinationFrame); EuclidFrameTestTools.assertFrameTuple4DEquals(expected, actual, EPSILON); } }
assertTrue(frameTupleReadOnly.getReferenceFrame() == frameTuple.getReferenceFrame()); EuclidCoreTestTools.assertTuple4DEquals(frameTuple, frameTupleReadOnly, EPSILON); EuclidFrameTestTools.assertFrameTuple4DEquals(frameTuple, frameTupleReadOnly, EPSILON);
assertTrue(frameQuaternion.getReferenceFrame() == randomFrame); EuclidCoreTestTools.assertTuple4DEquals(randomFrameTuple4D, frameQuaternion, EPSILON); EuclidFrameTestTools.assertFrameTuple4DEquals(randomFrameTuple4D, frameQuaternion, EPSILON); assertTrue(frameQuaternion.getReferenceFrame() == randomFrame); EuclidCoreTestTools.assertTuple4DEquals(randomFrameQuaternion, frameQuaternion, EPSILON); EuclidFrameTestTools.assertFrameTuple4DEquals(randomFrameQuaternion, frameQuaternion, EPSILON);
assertTrue(frameVector4D.getReferenceFrame() == randomFrame); EuclidCoreTestTools.assertTuple4DEquals(randomTuple, frameVector4D, EPSILON); EuclidFrameTestTools.assertFrameTuple4DEquals(randomTuple, frameVector4D, EPSILON);