2018-09-20 20:23:31 +08:00
|
|
|
use na::{Real, DefaultAllocator, Transform, TAffine};
|
2018-09-20 16:50:34 +08:00
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
use traits::{Alloc, Dimension};
|
2018-09-20 16:50:34 +08:00
|
|
|
use aliases::Mat;
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn affine_inverse<N: Real, D: Dimension>(m: Mat<N, D, D>) -> Mat<N, D, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D, D> {
|
2018-09-20 20:23:31 +08:00
|
|
|
// FIXME: this should be optimized.
|
|
|
|
m.try_inverse().unwrap_or(Mat::<_, D, D>::zeros())
|
2018-09-20 16:50:34 +08:00
|
|
|
}
|
|
|
|
|
2018-09-20 20:23:31 +08:00
|
|
|
pub fn inverse_transpose<N: Real, D: Dimension>(m: Mat<N, D, D>) -> Mat<N, D, D>
|
2018-09-20 16:50:34 +08:00
|
|
|
where DefaultAllocator: Alloc<N, D, D> {
|
2018-09-20 20:23:31 +08:00
|
|
|
m.try_inverse().unwrap_or(Mat::<_, D, D>::zeros()).transpose()
|
2018-09-20 16:50:34 +08:00
|
|
|
}
|