transform.getRotation((CommonMatrix3DBasics) rotationMatrix); for (int row = 0; row < 3; row++) for (int column = 0; column < 3; column++) transform.getRotation(rotationMatrix); for (int row = 0; row < 3; row++) for (int column = 0; column < 3; column++) transform.getRotation(denseMatrix); for (int row = 0; row < 3; row++) for (int column = 0; column < 3; column++) transform.getRotation(quaternion); rotationMatrix.set(quaternion); for (int row = 0; row < 3; row++) transform.getRotation(axisAngle); rotationMatrix.set(axisAngle); for (int row = 0; row < 3; row++) transform.getRotation(rotationVector); rotationMatrix.setRotationVector(rotationVector); for (int row = 0; row < 3; row++)
@Test public void testTransformWithRotationMatrix() throws Exception { Random random = new Random(2342L); AffineTransform transform = EuclidCoreRandomTools.nextAffineTransform(random); RotationMatrix matrixOriginal = EuclidCoreRandomTools.nextRotationMatrix(random); RotationMatrix matrixExpected = new RotationMatrix(); RotationMatrix matrixActual = new RotationMatrix(); transform.getRotation(matrixExpected); matrixExpected.multiply(matrixOriginal); matrixActual.set(matrixOriginal); transform.transform(matrixActual); EuclidCoreTestTools.assertMatrix3DEquals(matrixExpected, matrixActual, EPS); }
t1.getRotation(rot); rot[3 * row + column] += 0.999 * epsilon; ((RotationMatrix) t2.getRotationMatrix()).setUnsafe(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]); t1.getRotation(rot); rot[3 * row + column] += 1.001 * epsilon; ((RotationMatrix) t2.getRotationMatrix()).setUnsafe(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]); t1.getRotation(rot); rot[3 * row + column] -= 0.999 * epsilon; ((RotationMatrix) t2.getRotationMatrix()).setUnsafe(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]); t1.getRotation(rot); rot[3 * row + column] -= 1.001 * epsilon; ((RotationMatrix) t2.getRotationMatrix()).setUnsafe(rot[0], rot[1], rot[2], rot[3], rot[4], rot[5], rot[6], rot[7], rot[8]);
@Test public void testResetScale() throws Exception { Random random = new Random(42353L); AffineTransform original = EuclidCoreRandomTools.nextAffineTransform(random); AffineTransform transform = new AffineTransform(original); RotationMatrix rotation = new RotationMatrix(); original.getRotation(rotation); transform.resetScale(); for (int row = 0; row < 3; row++) { for (int column = 0; column < 3; column++) assertTrue(transform.getElement(row, column) == rotation.getElement(row, column)); assertTrue(transform.getElement(row, 3) == original.getElement(row, 3)); } }
@Test public void testTransformWithQuaternion() throws Exception { Random random = new Random(34534L); AffineTransform transform = EuclidCoreRandomTools.nextAffineTransform(random); Quaternion quaternionOriginal = EuclidCoreRandomTools.nextQuaternion(random); Quaternion quaternionExpected = new Quaternion(); Quaternion quaternionActual = new Quaternion(); transform.getRotation(quaternionExpected); quaternionExpected.multiply(quaternionOriginal); transform.transform(quaternionOriginal, quaternionActual); EuclidCoreTestTools.assertQuaternionEquals(quaternionExpected, quaternionActual, EPS); quaternionActual.set(quaternionOriginal); transform.transform(quaternionActual); EuclidCoreTestTools.assertQuaternionEquals(quaternionExpected, quaternionActual, EPS); }
transform.getRotation(rotation); transform.getTranslation(translation); transform.getScale(scale);