From ce998c68eb6c1bf21bf2266e49a935d9be47383e Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 18 Jul 2021 16:30:38 -0700 Subject: [PATCH] matrices: rename inverse_old to inverse_rtiow to indicate origin. --- rtchallenge/src/matrices.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rtchallenge/src/matrices.rs b/rtchallenge/src/matrices.rs index 6363d13..1fda39d 100644 --- a/rtchallenge/src/matrices.rs +++ b/rtchallenge/src/matrices.rs @@ -481,7 +481,7 @@ impl Matrix4x4 { /// use rtchallenge::matrices::Matrix4x4; /// /// let i = Matrix4x4::identity(); - /// assert_eq!(i.inverse_old() * i, i); + /// assert_eq!(i.inverse_rtiow() * i, i); /// /// let m = Matrix4x4::new( /// [2., 0., 0., 0.], @@ -489,10 +489,10 @@ impl Matrix4x4 { /// [0., 0., 4., 0.], /// [0., 0., 0., 1.], /// ); - /// assert_eq!(m.inverse_old() * m, i); - /// assert_eq!(m * m.inverse_old(), i); + /// assert_eq!(m.inverse_rtiow() * m, i); + /// assert_eq!(m * m.inverse_rtiow(), i); /// ``` - pub fn inverse_old(&self) -> Matrix4x4 { + pub fn inverse_rtiow(&self) -> Matrix4x4 { // TODO(wathiede): how come the C++ version doesn't need to deal with non-invertable // matrix. let mut indxc: [usize; 4] = Default::default(); @@ -743,6 +743,9 @@ impl Matrix4x4 { /// assert_eq!(c * b.inverse(), a); /// ``` pub fn inverse(&self) -> Matrix4x4 { + self.inverse_rtc() + } + pub fn inverse_rtc(&self) -> Matrix4x4 { let m = self; if !m.invertable() { panic!("Matrix4x4::inverse called on matrix with determinant() == 0");