abs needs the Signed trait.

This commit is contained in:
Sébastien Crozet 2013-07-10 17:43:45 +00:00
parent c37d58f3fb
commit 7f05cc5977
2 changed files with 3 additions and 3 deletions

0
src/lib.rs Normal file
View File

View File

@ -1,6 +1,6 @@
use std::vec::{VecIterator, VecMutIterator}; use std::vec::{VecIterator, VecMutIterator};
use std::iterator::FromIterator; use std::iterator::FromIterator;
use std::num::{Zero, One, abs}; use std::num::{Zero, One};
use traits::basis::Basis; use traits::basis::Basis;
use traits::cross::Cross; use traits::cross::Cross;
use traits::division_ring::DivisionRing; use traits::division_ring::DivisionRing;
@ -69,7 +69,7 @@ impl<N: Clone + One + Zero + Neg<N>> Basis for Vec2<N>
{ f(Vec2::new([-self.at[1], self.at[0].clone()])) } { f(Vec2::new([-self.at[1], self.at[0].clone()])) }
} }
impl<N: Clone + Copy + DivisionRing + Ord + Algebraic> impl<N: Clone + Copy + DivisionRing + Ord + Algebraic + Signed>
Basis for Vec3<N> Basis for Vec3<N>
{ {
#[inline(always)] #[inline(always)]
@ -84,7 +84,7 @@ Basis for Vec3<N>
fn orthonormal_subspace_basis(&self, f: &fn(Vec3<N>)) fn orthonormal_subspace_basis(&self, f: &fn(Vec3<N>))
{ {
let a = let a =
if abs(self.at[0].clone()) > abs(self.at[1].clone()) if self.at[0].clone().abs() > self.at[1].clone().abs()
{ Vec3::new([self.at[2].clone(), Zero::zero(), -self.at[0]]).normalized() } { Vec3::new([self.at[2].clone(), Zero::zero(), -self.at[0]]).normalized() }
else else
{ Vec3::new([Zero::zero(), -self.at[2], self.at[1].clone()]).normalized() }; { Vec3::new([Zero::zero(), -self.at[2], self.at[1].clone()]).normalized() };