diff --git a/src/adaptors/rotmat.rs b/src/adaptors/rotmat.rs index d484bb76..6233fb7a 100644 --- a/src/adaptors/rotmat.rs +++ b/src/adaptors/rotmat.rs @@ -195,7 +195,7 @@ impl + LMul, V> Rotate for Rotmat { impl + LMul, V> Transform for Rotmat { #[inline] - fn transform_vec(&self, v: &V) -> V { + fn transform(&self, v: &V) -> V { self.rotate(v) } diff --git a/src/adaptors/transform.rs b/src/adaptors/transform.rs index c1e72869..5e838cff 100644 --- a/src/adaptors/transform.rs +++ b/src/adaptors/transform.rs @@ -244,8 +244,8 @@ Transformation> for Transform { impl, V: Add + Sub> Ts for Transform { #[inline] - fn transform_vec(&self, v: &V) -> V { - self.submat.transform_vec(v) + self.subtrans + fn transform(&self, v: &V) -> V { + self.submat.transform(v) + self.subtrans } #[inline] diff --git a/src/dmat.rs b/src/dmat.rs index 619bae73..79a02715 100644 --- a/src/dmat.rs +++ b/src/dmat.rs @@ -1,7 +1,6 @@ use std::num::{One, Zero}; use std::vec::from_elem; use std::cmp::ApproxEq; -use std::iterator::IteratorUtil; use traits::inv::Inv; use traits::division_ring::DivisionRing; use traits::transpose::Transpose; diff --git a/src/dvec.rs b/src/dvec.rs index 0afed924..d76d3505 100644 --- a/src/dvec.rs +++ b/src/dvec.rs @@ -2,7 +2,7 @@ use std::num::{Zero, One, Algebraic}; use std::vec::{VecIterator, VecMutIterator}; use std::vec::from_elem; use std::cmp::ApproxEq; -use std::iterator::{FromIterator, IteratorUtil}; +use std::iterator::FromIterator; use traits::iterable::{Iterable, IterableMut}; use traits::ring::Ring; use traits::division_ring::DivisionRing; @@ -117,7 +117,7 @@ impl> Add, DVec> for DVec { fn add(&self, other: &DVec) -> DVec { assert!(self.at.len() == other.at.len()); DVec { - at: self.at.iter().zip(other.at.iter()).transform(|(a, b)| *a + *b).collect() + at: self.at.iter().zip(other.at.iter()).map(|(a, b)| *a + *b).collect() } } } @@ -127,7 +127,7 @@ impl> Sub, DVec> for DVec { fn sub(&self, other: &DVec) -> DVec { assert!(self.at.len() == other.at.len()); DVec { - at: self.at.iter().zip(other.at.iter()).transform(|(a, b)| *a - *b).collect() + at: self.at.iter().zip(other.at.iter()).map(|(a, b)| *a - *b).collect() } } } @@ -135,7 +135,7 @@ impl> Sub, DVec> for DVec { impl> Neg> for DVec { #[inline] fn neg(&self) -> DVec { - DVec { at: self.at.iter().transform(|a| -a).collect() } + DVec { at: self.at.iter().map(|a| -a).collect() } } } @@ -170,7 +170,7 @@ impl SubDot for DVec { impl> ScalarMul for DVec { #[inline] fn scalar_mul(&self, s: &N) -> DVec { - DVec { at: self.at.iter().transform(|a| a * *s).collect() } + DVec { at: self.at.iter().map(|a| a * *s).collect() } } #[inline] @@ -185,7 +185,7 @@ impl> ScalarMul for DVec { impl> ScalarDiv for DVec { #[inline] fn scalar_div(&self, s: &N) -> DVec { - DVec { at: self.at.iter().transform(|a| a / *s).collect() } + DVec { at: self.at.iter().map(|a| a / *s).collect() } } #[inline] @@ -199,7 +199,7 @@ impl> ScalarDiv for DVec { impl> ScalarAdd for DVec { #[inline] fn scalar_add(&self, s: &N) -> DVec { - DVec { at: self.at.iter().transform(|a| a + *s).collect() } + DVec { at: self.at.iter().map(|a| a + *s).collect() } } #[inline] @@ -213,7 +213,7 @@ impl> ScalarAdd for DVec { impl> ScalarSub for DVec { #[inline] fn scalar_sub(&self, s: &N) -> DVec { - DVec { at: self.at.iter().transform(|a| a - *s).collect() } + DVec { at: self.at.iter().map(|a| a - *s).collect() } } #[inline] diff --git a/src/mat.rs b/src/mat.rs index 45b30593..cc064419 100644 --- a/src/mat.rs +++ b/src/mat.rs @@ -3,7 +3,6 @@ use std::cast; use std::num::{One, Zero}; use std::cmp::ApproxEq; -use std::iterator::IteratorUtil; use std::vec::{VecIterator, VecMutIterator}; use vec::{Vec1, Vec2, Vec3, Vec4, Vec5, Vec6}; use traits::dim::Dim; diff --git a/src/mat_macros.rs b/src/mat_macros.rs index 8fdd13ea..2aafe6f0 100644 --- a/src/mat_macros.rs +++ b/src/mat_macros.rs @@ -204,14 +204,14 @@ macro_rules! transform_impl( impl Transform<$v> for $t { #[inline] - fn transform_vec(&self, v: &$v) -> $v { + fn transform(&self, v: &$v) -> $v { self.rmul(v) } #[inline] fn inv_transform(&self, v: &$v) -> $v { match self.inverse() { - Some(t) => t.transform_vec(v), + Some(t) => t.transform(v), None => fail!("Cannot use inv_transform on a non-inversible matrix.") } } diff --git a/src/tests/vec.rs b/src/tests/vec.rs index a5759fc6..b68f6048 100644 --- a/src/tests/vec.rs +++ b/src/tests/vec.rs @@ -1,6 +1,4 @@ #[test] -use std::iterator::IteratorUtil; -#[test] use std::num::{Zero, One}; #[test] use std::rand::{random}; @@ -28,7 +26,7 @@ macro_rules! test_iterator_impl( let mut mv: $t = v.clone(); let n: $n = random(); - let nv: $t = v.iter().transform(|e| e * n).collect(); + let nv: $t = v.iter().map(|e| e * n).collect(); for e in mv.mut_iter() { *e = *e * n diff --git a/src/traits/transformation.rs b/src/traits/transformation.rs index cb228b90..d1de2276 100644 --- a/src/traits/transformation.rs +++ b/src/traits/transformation.rs @@ -15,10 +15,8 @@ pub trait Transformation { /// Trait of objects able to transform other objects. This is typically implemented by matrices which /// transform vectors. pub trait Transform { - // XXX: sadly we cannot call this `transform` as it conflicts with the - // iterators' `transform` function (which seems always exist). /// Apply a transformation to an object. - fn transform_vec(&self, &V) -> V; + fn transform(&self, &V) -> V; /// Apply an inverse transformation to an object. fn inv_transform(&self, &V) -> V; }