diff --git a/src/adaptors/transform.rs b/src/adaptors/transform.rs index 4430641c..98654c66 100644 --- a/src/adaptors/transform.rs +++ b/src/adaptors/transform.rs @@ -5,7 +5,7 @@ use traits::dim::Dim; use traits::inv::Inv; use traits::rotation::{Rotation, Rotate, Rotatable}; use traits::translation::{Translation, Translate, Translatable}; -use traits::transformation; +use Ts = traits::transformation::Transform; use traits::transformation::{Transformation, Transformable}; use traits::rlmul::{RMul, LMul}; use traits::homogeneous::{ToHomogeneous, FromHomogeneous}; @@ -192,8 +192,8 @@ Transformation> for Transform { *self = other * *self; } } -impl, V: Add + Sub> -transformation::Transform for Transform +impl, V: Add + Sub> +Ts for Transform { #[inline] fn transform_vec(&self, v: &V) -> V diff --git a/src/mat_impl.rs b/src/mat.rs similarity index 96% rename from src/mat_impl.rs rename to src/mat.rs index 3204687e..2073d18c 100644 --- a/src/mat_impl.rs +++ b/src/mat.rs @@ -17,6 +17,14 @@ use traits::indexable::Indexable; use traits::column::Column; use traits::iterable::{Iterable, IterableMut}; +pub use traits::column::*; +pub use traits::inv::*; +pub use traits::rlmul::*; +pub use traits::rotation::*; +pub use traits::transformation::*; +pub use traits::translation::*; +pub use traits::transpose::*; + mod mat_macros; #[deriving(Eq, Ord, Encodable, Decodable, Clone, DeepClone, IterBytes, Rand, Zero, ToStr)] diff --git a/src/nalgebra.rc b/src/nalgebra.rc index f14aa969..aa19932f 100644 --- a/src/nalgebra.rc +++ b/src/nalgebra.rc @@ -15,8 +15,8 @@ extern mod extra; mod dmat; mod dvec; -mod vec_impl; -mod mat_impl; +pub mod vec; +pub mod mat; // specialization for some 1d, 2d and 3d operations pub mod mat_spec; @@ -30,64 +30,39 @@ pub mod adaptors pub mod transform; } -pub mod vec +pub mod num { - pub use vec_impl::*; - pub use dvec::*; - pub use traits::sample::*; - pub use traits::dot::*; - pub use traits::cross::*; - pub use traits::basis::*; - pub use traits::norm::*; - pub use traits::vector_space::*; - pub use traits::sub_dot::*; - pub use traits::scalar_op::*; -} - -pub mod mat -{ - pub use mat_impl::*; - pub use dmat::*; - pub use traits::column::*; - pub use traits::inv::*; - pub use traits::transpose::*; - pub use traits::rotation::*; - pub use traits::translation::*; - pub use traits::transformation::*; -} - -/// Useful linear-algebra related traits. -pub mod traits -{ - pub use traits::indexable::*; - pub use traits::iterable::*; pub use traits::dim::*; + pub use traits::homogeneous::*; pub use traits::ring::*; pub use traits::division_ring::*; - pub use traits::rlmul::*; - pub use traits::homogeneous::*; +} - pub mod sample; - pub mod indexable; - pub mod column; - pub mod iterable; - pub mod dot; - pub mod cross; - pub mod inv; - pub mod transpose; - pub mod dim; - pub mod basis; - pub mod norm; - pub mod rotation; - pub mod translation; - pub mod transformation; - pub mod vector_space; - pub mod ring; - pub mod division_ring; - pub mod sub_dot; - pub mod rlmul; - pub mod scalar_op; - pub mod homogeneous; +// FIXME: it would be better to hide all those from the outside! +/// Useful linear-algebra related traits. +mod traits +{ + mod sample; + mod indexable; + mod column; + mod iterable; + mod dot; + mod cross; + mod inv; + mod transpose; + mod dim; + mod basis; + mod norm; + mod rotation; + mod translation; + mod transformation; + mod vector_space; + mod ring; + mod division_ring; + mod sub_dot; + mod rlmul; + mod scalar_op; + mod homogeneous; } #[cfg(test)] diff --git a/src/vec_impl.rs b/src/vec.rs similarity index 95% rename from src/vec_impl.rs rename to src/vec.rs index 5f9f9c05..12d8259b 100644 --- a/src/vec_impl.rs +++ b/src/vec.rs @@ -5,19 +5,25 @@ use std::vec::{VecIterator, VecMutIterator}; use std::iterator::{Iterator, IteratorUtil, FromIterator}; use std::cmp::ApproxEq; use std::uint::iterate; -use traits::iterable::{Iterable, IterableMut}; use traits::basis::Basis; use traits::dim::Dim; -use traits::dot::Dot; -use traits::sub_dot::SubDot; -use traits::norm::Norm; use traits::translation::{Translation, Translatable}; -use traits::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub}; use traits::ring::Ring; use traits::division_ring::DivisionRing; use traits::homogeneous::{FromHomogeneous, ToHomogeneous}; use traits::indexable::Indexable; +pub use traits::basis::*; +pub use traits::cross::*; +pub use traits::dot::*; +pub use traits::indexable::*; +pub use traits::iterable::*; +pub use traits::norm::*; +pub use traits::sample::*; +pub use traits::sub_dot::*; +pub use traits::vector_space::*; +pub use traits::scalar_op::*; + mod vec_macros; #[deriving(Eq, Ord, Encodable, Decodable, Clone, DeepClone, Rand, Zero, ToStr)]