diff --git a/src/matrix.rs b/src/matrix.rs index 78a0d03..6bdba62 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -4,6 +4,7 @@ use ptr::to_unsafe_ptr; use vec::raw::buf_as_slice; use std::cmp::FuzzyEq; +use funs::common::*; use funs::exp::Exp; use math::*; use ncast::*; @@ -720,7 +721,7 @@ pub impl Mat4: NumericMatrix> { } } -pub impl Mat4: NumericMatrix_NxN { +pub impl Mat4: NumericMatrix_NxN { #[inline(always)] pure fn add_m(other: &Mat4) -> Mat4 { Mat4::from_cols(self[0].add_v(&other[0]), @@ -779,16 +780,7 @@ pub impl Mat4: NumericMatrix_NxN { for uint::range(0, 4) |j| { let mut i1 = j; for uint::range(j + 1, 4) |i| { - // There should really be a generic abs function - let one = a[i][j]; - let two = a[i1][j]; - if one < _0 && two < _0 && -one > -two { - i1 = i; - } else if one > _0 && two > _0 && one > two { - i1 = i; - } else if one < _0 && two > _0 && -one > two { - i1 = i; - } else if one > _0 && two < _0 && one > -two { + if abs(&a[i][j]) > abs(&a[i1][j]) { i1 = i; } }