diff --git a/src/mat.rs b/src/mat.rs index b1d00ac..8208421 100644 --- a/src/mat.rs +++ b/src/mat.rs @@ -32,7 +32,7 @@ pub trait Matrix: Dimensional, ToPtr, Eq, DefaultEq, Neg { pure fn mul_m(&self, other: &self) -> self; pure fn dot(&self, other: &self) -> T; - pure fn det(&self) -> T; + pure fn determinant(&self) -> T; pure fn trace(&self) -> T; pure fn invert(&self) -> Option; @@ -168,7 +168,7 @@ pub impl Mat2: Matrix> { other.transpose().mul_m(self).trace() } - pure fn det(&self) -> T { + pure fn determinant(&self) -> T { self[0][0] * self[1][1] - self[1][0] * self[0][1] } @@ -179,7 +179,7 @@ pub impl Mat2: Matrix> { #[inline(always)] pure fn invert(&self) -> Option> { let _0 = cast(0); - let d = self.det(); + let d = self.determinant(); if d.default_eq(&_0) { None } else { @@ -222,7 +222,7 @@ pub impl Mat2: Matrix> { #[inline(always)] pure fn is_invertible(&self) -> bool { let _0 = cast(0); - !self.det().default_eq(&_0) + !self.determinant().default_eq(&_0) } } @@ -430,7 +430,7 @@ pub impl Mat3: Matrix> { other.transpose().mul_m(self).trace() } - pure fn det(&self) -> T { + pure fn determinant(&self) -> T { self.col(0).dot(&self.col(1).cross(&self.col(2))) } @@ -440,7 +440,7 @@ pub impl Mat3: Matrix> { // #[inline(always)] pure fn invert(&self) -> Option> { - let d = self.det(); + let d = self.determinant(); let _0 = cast(0); if d.default_eq(&_0) { None @@ -499,7 +499,7 @@ pub impl Mat3: Matrix> { #[inline(always)] pure fn is_invertible(&self) -> bool { let _0 = cast(0); - !self.det().default_eq(&_0) + !self.determinant().default_eq(&_0) } } @@ -776,19 +776,19 @@ pub impl Mat4: Matrix> { other.transpose().mul_m(self).trace() } - pure fn det(&self) -> T { + pure fn determinant(&self) -> T { self[0][0]*Mat3::new(self[1][1], self[2][1], self[3][1], self[1][2], self[2][2], self[3][2], - self[1][3], self[2][3], self[3][3]).det() - + self[1][3], self[2][3], self[3][3]).determinant() - self[1][0]*Mat3::new(self[0][1], self[2][1], self[3][1], self[0][2], self[2][2], self[3][2], - self[0][3], self[2][3], self[3][3]).det() + + self[0][3], self[2][3], self[3][3]).determinant() + self[2][0]*Mat3::new(self[0][1], self[1][1], self[3][1], self[0][2], self[1][2], self[3][2], - self[0][3], self[1][3], self[3][3]).det() - + self[0][3], self[1][3], self[3][3]).determinant() - self[3][0]*Mat3::new(self[0][1], self[1][1], self[2][1], self[0][2], self[1][2], self[2][2], - self[0][3], self[1][3], self[2][3]).det() + self[0][3], self[1][3], self[2][3]).determinant() } pure fn trace(&self) -> T { @@ -796,7 +796,7 @@ pub impl Mat4: Matrix> { } pure fn invert(&self) -> Option> { - let d = self.det(); + let d = self.determinant(); let _0 = cast(0); if d.default_eq(&_0) { None @@ -914,7 +914,7 @@ pub impl Mat4: Matrix> { #[inline(always)] pure fn is_invertible(&self) -> bool { let _0 = cast(0); - !self.det().default_eq(&_0) + !self.determinant().default_eq(&_0) } } diff --git a/src/test/test_mat.rs b/src/test/test_mat.rs index 4d24ff4..c4dfcca 100644 --- a/src/test/test_mat.rs +++ b/src/test/test_mat.rs @@ -30,7 +30,7 @@ fn test_Mat2() { assert a.col(0) == Vec2::new(1f, 3f); assert a.col(1) == Vec2::new(2f, 4f); - assert a.det() == -2f; + assert a.determinant() == -2f; assert a.trace() == 5f; assert a.neg() == Mat2::new(-1f, -3f, @@ -137,7 +137,7 @@ fn test_Mat3() { assert a.col(1) == Vec3::new(2f, 5f, 8f); assert a.col(2) == Vec3::new(3f, 6f, 9f); - assert a.det() == 0f; + assert a.determinant() == 0f; assert a.trace() == 15f; assert a.neg() == Mat3::new(-1f, -4f, -7f, @@ -274,7 +274,7 @@ fn test_Mat4() { assert a.col(2) == Vec4::new(3f, 7f, 11f, 15f); assert a.col(3) == Vec4::new(4f, 8f, 12f, 16f); - assert a.det() == 0f; + assert a.determinant() == 0f; assert a.trace() == 34f; assert a.neg() == Mat4::new(-1f, -5f, -9f, -13f,