diff --git a/src/mat.rs b/src/mat.rs index 474f7fc..7e786dd 100644 --- a/src/mat.rs +++ b/src/mat.rs @@ -36,7 +36,7 @@ pub trait Matrix: Dimensional, ToPtr, Eq, DefaultEq, Neg { pure fn determinant(&self) -> T; pure fn trace(&self) -> T; - pure fn invert(&self) -> Option; + pure fn inverse(&self) -> Option; pure fn transpose(&self) -> self; pure fn is_identity(&self) -> bool; @@ -178,7 +178,7 @@ pub impl Mat2: Matrix> { } #[inline(always)] - pure fn invert(&self) -> Option> { + pure fn inverse(&self) -> Option> { let _0 = cast(0); let d = self.determinant(); if d.default_eq(&_0) { @@ -440,7 +440,7 @@ pub impl Mat3: Matrix> { } // #[inline(always)] - pure fn invert(&self) -> Option> { + pure fn inverse(&self) -> Option> { let d = self.determinant(); let _0 = cast(0); if d.default_eq(&_0) { @@ -799,7 +799,7 @@ pub impl Mat4: Matrix> { self[0][0] + self[1][1] + self[2][2] + self[3][3] } - pure fn invert(&self) -> Option> { + pure fn inverse(&self) -> Option> { let d = self.determinant(); let _0 = cast(0); if d.default_eq(&_0) { diff --git a/src/test/test_mat.rs b/src/test/test_mat.rs index c4dfcca..1dca40c 100644 --- a/src/test/test_mat.rs +++ b/src/test/test_mat.rs @@ -52,11 +52,11 @@ fn test_Mat2() { assert a.transpose() == Mat2::new(1f, 2f, 3f, 4f); - assert option::unwrap(a.invert()) == Mat2::new(-2f, 1.5f, + assert option::unwrap(a.inverse()) == Mat2::new(-2f, 1.5f, 1f, -0.5f); assert Mat2::new(0f, 2f, - 0f, 5f).invert().is_none(); + 0f, 5f).inverse().is_none(); // exact_eq // fuzzy_eq @@ -165,11 +165,11 @@ fn test_Mat3() { 4f, 5f, 6f, 7f, 8f, 9f); - assert a.invert().is_none(); + assert a.inverse().is_none(); assert option::unwrap(Mat3::new(2f, 4f, 6f, 0f, 2f, 4f, - 0f, 0f, 1f).invert()) + 0f, 0f, 1f).inverse()) == Mat3::new(0.5f, -1f, 1f, 0f, 0.5f, -2f, 0f, 0f, 1f); @@ -177,7 +177,7 @@ fn test_Mat3() { // let ident: Mat3 = NumericMatrixNxN::identity(); // FIXME: there's something wrong with static functions here! let ident: Mat3 = Mat3::identity(); - assert option::unwrap(ident.invert()) == ident; + assert option::unwrap(ident.inverse()) == ident; // exact_eq // fuzzy_eq @@ -308,7 +308,7 @@ fn test_Mat4() { 9f, 10f, 11f, 12f, 13f, 14f, 15f, 16f); - assert option::unwrap(c.invert()) + assert option::unwrap(c.inverse()) == Mat4::new( 5f, -4f, 1f, 0f, -4f, 8f, -4f, 0f, 4f, -8f, 4f, 8f, @@ -317,7 +317,7 @@ fn test_Mat4() { // let ident: Mat4 = NumericMatrixNxN::identity(); let ident: Mat4 = Mat4::identity(); - assert option::unwrap(ident.invert()) == ident; + assert option::unwrap(ident.inverse()) == ident; // exact_eq // fuzzy_eq