From 4312daa53c52419d1b59838685b0a6dd71047f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Mon, 20 May 2013 10:02:02 +0000 Subject: [PATCH] Removed the triginometric trait workaround. --- src/adaptors/rotmat.rs | 13 ++++++------- src/nalgebra.rc | 1 - src/traits/workarounds/trigonometric.rs | 23 ----------------------- 3 files changed, 6 insertions(+), 31 deletions(-) delete mode 100644 src/traits/workarounds/trigonometric.rs diff --git a/src/adaptors/rotmat.rs b/src/adaptors/rotmat.rs index c2f61a85..c60b982e 100644 --- a/src/adaptors/rotmat.rs +++ b/src/adaptors/rotmat.rs @@ -1,8 +1,7 @@ -use core::num::{One, Zero}; // , Trigonometric}; +use core::num::{One, Zero}; use core::rand::{Rand, Rng, RngUtil}; use std::cmp::FuzzyEq; use traits::workarounds::rlmul::{RMul, LMul}; -use traits::workarounds::trigonometric::Trigonometric; use traits::dim::Dim; use traits::inv::Inv; use traits::transpose::Transpose; @@ -27,8 +26,8 @@ impl Rotmat pub fn rotmat2>(angle: T) -> Rotmat> { - let coa = Trigonometric::cos(angle); - let sia = Trigonometric::sin(angle); + let coa = angle.cos(); + let sia = angle.sin(); Rotmat { submat: mat2(coa, -sia, sia, coa) } @@ -45,9 +44,9 @@ pub fn rotmat3 + One + Sub + Add + let sqx = ux * ux; let sqy = uy * uy; let sqz = uz * uz; - let cos = Trigonometric::cos(angle); + let cos = angle.cos(); let one_m_cos = _1 - cos; - let sin = Trigonometric::sin(angle); + let sin = angle.sin(); Rotmat { submat: mat3( @@ -69,7 +68,7 @@ impl + Trigonometric + Neg + Mul + Add + Copy> Rotation> for Rotmat> { fn rotation(&self) -> Vec1 - { vec1(-Trigonometric::atan(self.submat.m12 / self.submat.m11)) } + { vec1(-(self.submat.m12 / self.submat.m11).atan()) } fn rotated(&self, rot: &Vec1) -> Rotmat> { rotmat2(rot.x) * *self } diff --git a/src/nalgebra.rc b/src/nalgebra.rc index 4a9e04d7..9a2d05fe 100644 --- a/src/nalgebra.rc +++ b/src/nalgebra.rc @@ -56,7 +56,6 @@ mod traits mod workarounds { mod rlmul; - mod trigonometric; mod scalar_op; } } diff --git a/src/traits/workarounds/trigonometric.rs b/src/traits/workarounds/trigonometric.rs deleted file mode 100644 index 9f28abd8..00000000 --- a/src/traits/workarounds/trigonometric.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Trigonometric is available in core, but compilation fails with internal -// error. - -use core::f64::{cos, sin, atan}; - -pub trait Trigonometric -{ - fn cos(Self) -> Self; - fn sin(Self) -> Self; - fn atan(Self) -> Self; -} - -impl Trigonometric for f64 -{ - fn cos(a: f64) -> f64 - { cos(a) } - - fn sin(a: f64) -> f64 - { sin(a) } - - fn atan(a: f64) -> f64 - { atan(a) } -}