@Test
public void testCheckIfMatrix2D() throws Exception
{
Random random = new Random(3242L);
RigidBodyTransform transform = new RigidBodyTransform();
double d = EuclidCoreRandomTools.nextDouble(random, 5.0);
transform.setRotationUnsafe(0.0, 0.0, d, 0.0, 0.0, d, d, d, d);
transform.setTranslation(5.0, 3.0, -2.0);
try
{
transform.checkIfRotation2D();
fail("Should have thrown a NotAMatrix2DException.");
}
catch (NotAMatrix2DException e)
{
assertTrue(e.getMessage().equals("The matrix is not in XY plane: \n" + transform.getRotationMatrix()));
}
transform.setRotationUnsafe(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
transform.setTranslation(5.0, 3.0, -2.0);
transform.checkIfRotation2D();
transform.setRotationUnsafe(d, d, 0.0, d, d, 0.0, 0.0, 0.0, 1.0);
transform.setTranslation(5.0, 3.0, -2.0);
transform.checkIfRotation2D();
}