matrices: rename inverse_old to inverse_rtiow to indicate origin.

This commit is contained in:
Bill Thiede 2021-07-18 16:30:38 -07:00
parent 37048ddd52
commit ce998c68eb

View File

@ -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");