forked from M-Labs/nalgebra
abs needs the Signed trait.
This commit is contained in:
parent
c37d58f3fb
commit
7f05cc5977
0
src/lib.rs
Normal file
0
src/lib.rs
Normal 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() };
|
||||||
|
Loading…
Reference in New Issue
Block a user