nalgebra/nalgebra-glm/src/gtc/matrix_inverse.rs
Sébastien Crozet 85074398d0 Fix nalgebra-glm
2021-08-08 12:59:40 +02:00

17 lines
523 B
Rust

use crate::RealNumber;
use crate::aliases::TMat;
/// Fast matrix inverse for affine matrix.
pub fn affine_inverse<T: RealNumber, const D: usize>(m: TMat<T, D, D>) -> TMat<T, D, D> {
// TODO: this should be optimized.
m.try_inverse().unwrap_or_else(TMat::<_, D, D>::zeros)
}
/// Compute the transpose of the inverse of a matrix.
pub fn inverse_transpose<T: RealNumber, const D: usize>(m: TMat<T, D, D>) -> TMat<T, D, D> {
m.try_inverse()
.unwrap_or_else(TMat::<_, D, D>::zeros)
.transpose()
}