/** Use {@link ReferenceFrameTools#constructARootFrame(String)} instead. */ @Deprecated public static ReferenceFrame constructARootFrame(String frameName) { return ReferenceFrameTools.constructARootFrame(frameName); }
ReferenceFrame anotherRoot = ReferenceFrameTools.constructARootFrame("anotherRoot");
@Test public void testChangeFrame() throws Exception { Random random = new Random(43563); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame[] referenceFrames = EuclidFrameRandomTools.nextReferenceFrameTree(random, true); ReferenceFrame initialFrame = referenceFrames[random.nextInt(referenceFrames.length)]; ReferenceFrame anotherFrame = referenceFrames[random.nextInt(referenceFrames.length)]; Point2D expected = EuclidCoreRandomTools.nextPoint2D(random); FramePoint2D actual = new FramePoint2D(initialFrame, expected); RigidBodyTransform transform = initialFrame.getTransformToDesiredFrame(anotherFrame); expected.applyTransform(transform); actual.changeFrame(anotherFrame); assertTrue(anotherFrame == actual.getReferenceFrame()); EuclidCoreTestTools.assertTuple2DEquals(expected, actual, EPSILON); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try { actual.changeFrame(differentRootFrame); fail("Should have thrown a RuntimeException"); } catch (RuntimeException e) { // good } } }
@Test public void testChangeFrame() throws Exception { Random random = new Random(43563); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame[] referenceFrames = EuclidFrameRandomTools.nextReferenceFrameTree(random); ReferenceFrame initialFrame = referenceFrames[random.nextInt(referenceFrames.length)]; ReferenceFrame anotherFrame = referenceFrames[random.nextInt(referenceFrames.length)]; YawPitchRoll expected = EuclidCoreRandomTools.nextYawPitchRoll(random); FrameYawPitchRoll yawPitchRoll = new FrameYawPitchRoll(initialFrame, expected); RigidBodyTransform transform = initialFrame.getTransformToDesiredFrame(anotherFrame); expected.applyTransform(transform); yawPitchRoll.changeFrame(anotherFrame); assertTrue(anotherFrame == yawPitchRoll.getReferenceFrame()); EuclidCoreTestTools.assertYawPitchRollGeometricallyEquals(expected, yawPitchRoll, EPSILON); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try { yawPitchRoll.changeFrame(differentRootFrame); fail("Should have thrown a RuntimeException"); } catch (RuntimeException e) { // good } } }
@Test public void testChangeFrame() throws Exception { Random random = new Random(43563); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame[] referenceFrames = EuclidFrameRandomTools.nextReferenceFrameTree(random); ReferenceFrame initialFrame = referenceFrames[random.nextInt(referenceFrames.length)]; ReferenceFrame anotherFrame = referenceFrames[random.nextInt(referenceFrames.length)]; Vector3D expected = EuclidCoreRandomTools.nextVector3D(random); FrameVector3D actual = new FrameVector3D(initialFrame, expected); RigidBodyTransform transform = initialFrame.getTransformToDesiredFrame(anotherFrame); expected.applyTransform(transform); actual.changeFrame(anotherFrame); assertTrue(anotherFrame == actual.getReferenceFrame()); EuclidCoreTestTools.assertTuple3DEquals(expected, actual, EPSILON); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try { actual.changeFrame(differentRootFrame); fail("Should have thrown a RuntimeException"); } catch (RuntimeException e) { // good } } }
@Test public void testChangeFrame() throws Exception { Random random = new Random(43563); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame[] referenceFrames = EuclidFrameRandomTools.nextReferenceFrameTree(random); ReferenceFrame initialFrame = referenceFrames[random.nextInt(referenceFrames.length)]; ReferenceFrame anotherFrame = referenceFrames[random.nextInt(referenceFrames.length)]; Quaternion expected = EuclidCoreRandomTools.nextQuaternion(random); FrameQuaternion quaternion = new FrameQuaternion(initialFrame, expected); RigidBodyTransform transform = initialFrame.getTransformToDesiredFrame(anotherFrame); expected.applyTransform(transform); quaternion.changeFrame(anotherFrame); assertTrue(anotherFrame == quaternion.getReferenceFrame()); EuclidCoreTestTools.assertQuaternionGeometricallyEquals(expected, quaternion, EPSILON); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try { quaternion.changeFrame(differentRootFrame); fail("Should have thrown a RuntimeException"); } catch (RuntimeException e) { // good } } }
@Test public void testChangeFrame() throws Exception { Random random = new Random(43563); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame[] referenceFrames = EuclidFrameRandomTools.nextReferenceFrameTree(random); ReferenceFrame initialFrame = referenceFrames[random.nextInt(referenceFrames.length)]; ReferenceFrame anotherFrame = referenceFrames[random.nextInt(referenceFrames.length)]; Vector4D expected = EuclidCoreRandomTools.nextVector4D(random); FrameVector4D actual = new FrameVector4D(initialFrame, expected); RigidBodyTransform transform = initialFrame.getTransformToDesiredFrame(anotherFrame); expected.applyTransform(transform); actual.changeFrame(anotherFrame); assertTrue(anotherFrame == actual.getReferenceFrame()); EuclidCoreTestTools.assertTuple4DEquals(expected, actual, EPSILON); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try { actual.changeFrame(differentRootFrame); fail("Should have thrown a RuntimeException"); } catch (RuntimeException e) { // good } } }
@Test public void testChangeFrame() throws Exception { Random random = new Random(43563); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame[] referenceFrames = EuclidFrameRandomTools.nextReferenceFrameTree(random); ReferenceFrame initialFrame = referenceFrames[random.nextInt(referenceFrames.length)]; ReferenceFrame anotherFrame = referenceFrames[random.nextInt(referenceFrames.length)]; Point3D expectedPoint = EuclidCoreRandomTools.nextPoint3D(random); FramePoint3D framePoint = new FramePoint3D(initialFrame, expectedPoint); RigidBodyTransform transform = initialFrame.getTransformToDesiredFrame(anotherFrame); expectedPoint.applyTransform(transform); framePoint.changeFrame(anotherFrame); assertTrue(anotherFrame == framePoint.getReferenceFrame()); EuclidCoreTestTools.assertTuple3DEquals(expectedPoint, framePoint, 10.0 * EPSILON); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try { framePoint.changeFrame(differentRootFrame); fail("Should have thrown a RuntimeException"); } catch (RuntimeException e) { // good } } }
@Test public void testChangeFrame() throws Exception { Random random = new Random(43563); for (int i = 0; i < ITERATIONS; i++) { ReferenceFrame[] referenceFrames = EuclidFrameRandomTools.nextReferenceFrameTree(random, true); ReferenceFrame initialFrame = referenceFrames[random.nextInt(referenceFrames.length)]; ReferenceFrame anotherFrame = referenceFrames[random.nextInt(referenceFrames.length)]; Vector2D expected = EuclidCoreRandomTools.nextVector2D(random); FrameVector2D actual = new FrameVector2D(initialFrame, expected); RigidBodyTransform transform = initialFrame.getTransformToDesiredFrame(anotherFrame); expected.applyTransform(transform); actual.changeFrame(anotherFrame); assertTrue(anotherFrame == actual.getReferenceFrame()); EuclidCoreTestTools.assertTuple2DEquals(expected, actual, EPSILON); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try { actual.changeFrame(differentRootFrame); fail("Should have thrown a RuntimeException"); } catch (RuntimeException e) { // good } } }
@Test public void testTransformFromHereToDesiredFrame() throws Exception { Random random = new Random(9825); for (int i = 0; i < ITERATIONS; i++) { Point3D original = EuclidCoreRandomTools.nextPoint3D(random); Point3D expected = new Point3D(original); Point3D actual = new Point3D(expected); ReferenceFrame[] referenceFrames = EuclidFrameRandomTools.nextReferenceFrameTree(random); ReferenceFrame initialFrame = referenceFrames[random.nextInt(referenceFrames.length)]; ReferenceFrame desiredFrame = referenceFrames[random.nextInt(referenceFrames.length)]; RigidBodyTransform transform = initialFrame.getTransformToDesiredFrame(desiredFrame); transform.transform(expected); initialFrame.transformFromThisToDesiredFrame(desiredFrame, actual); EuclidCoreTestTools.assertTuple3DEquals("Iteration #" + i, expected, actual, EPSILON); desiredFrame.transformFromThisToDesiredFrame(initialFrame, actual); EuclidCoreTestTools.assertTuple3DEquals(original, actual, EPSILON); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try { initialFrame.transformFromThisToDesiredFrame(differentRootFrame, actual); fail("Should have thrown a RuntimeException"); } catch (RuntimeException e) { // good } } }
assertTrue(expectedGeometry.epsilonEquals(frameGeometry.getGeometryObject(), EPSILON)); ReferenceFrame differentRootFrame = ReferenceFrameTools.constructARootFrame("anotherRootFrame"); try