Skip to content

Commit cb78df9

Browse files
Address Matrix4f test review feedback
1 parent f15dc9d commit cb78df9

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

jme3-core/src/test/java/com/jme3/math/Matrix4fTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public class Matrix4fTest {
3939

4040
/**
4141
* Builds an affine transform with translation, scale, and rotation via
42-
* setTransform, inverts it, multiplies transform by inverse, and asserts
43-
* the product is the identity matrix.
42+
* setTransform, inverts it, and asserts transform * inverse and
43+
* inverse * transform are both the identity matrix.
4444
*/
4545
@Test
4646
public void testInvert_roundTripWithTranslationScaleAndRotation() {
@@ -54,8 +54,13 @@ public void testInvert_roundTripWithTranslationScaleAndRotation() {
5454
rotation);
5555

5656
final Matrix4f inverse = transform.invert();
57+
5758
final Matrix4f product = transform.mult(inverse);
59+
assertTrue(product.isSimilar(Matrix4f.IDENTITY, 1e-4f),
60+
() -> "transform * inverse should be identity, but was:\n" + product);
5861

59-
assertTrue(product.isSimilar(Matrix4f.IDENTITY, 1e-4f));
62+
final Matrix4f inverseProduct = inverse.mult(transform);
63+
assertTrue(inverseProduct.isSimilar(Matrix4f.IDENTITY, 1e-4f),
64+
() -> "inverse * transform should be identity, but was:\n" + inverseProduct);
6065
}
6166
}

0 commit comments

Comments
 (0)