/** * Check a transform... if it is null or one of its members are invalid, return false. Else return true. * * @param transform * the transform to check * * @return true or false as stated above. */ public static boolean isValid(final ReadOnlyTransform transform) { if (transform == null) { return false; } if (!Vector3.isValid(transform.getScale()) || !Vector3.isValid(transform.getTranslation()) || !Matrix3.isValid(transform.getMatrix())) { return false; } return true; }
/** * Check a transform... if it is null or one of its members are invalid, return false. Else return true. * * @param transform * the transform to check * * @return true or false as stated above. */ public static boolean isValid(final ReadOnlyTransform transform) { if (transform == null) { return false; } if (!Vector3.isValid(transform.getScale()) || !Vector3.isValid(transform.getTranslation()) || !Matrix3.isValid(transform.getMatrix())) { return false; } return true; }
@Test public void testValid() { final Matrix3 mat3 = new Matrix3(); assertTrue(Matrix3.isValid(mat3)); for (int i = 0; i < 9; i++) { mat3.setIdentity(); mat3.setValue(i / 3, i % 3, Double.NaN); assertFalse(Matrix3.isValid(mat3)); mat3.setIdentity(); mat3.setValue(i / 3, i % 3, Double.POSITIVE_INFINITY); assertFalse(Matrix3.isValid(mat3)); assertTrue(Matrix3.isValid(mat3)); assertFalse(Matrix3.isValid(null));