diff --git a/.gitignore b/.gitignore index 0756691e..2cb7d551 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.swp doc +lib diff --git a/src/adaptors/rotmat.rs b/src/adaptors/rotmat.rs index f0dcb42b..c2f61a85 100644 --- a/src/adaptors/rotmat.rs +++ b/src/adaptors/rotmat.rs @@ -7,18 +7,24 @@ use traits::dim::Dim; use traits::inv::Inv; use traits::transpose::Transpose; use traits::rotation::Rotation; +use traits::delta_transform::DeltaTransform; use dim1::vec1::{Vec1, vec1}; use dim2::mat2::{Mat2, mat2}; use dim3::mat3::{Mat3, mat3}; use dim3::vec3::{Vec3}; -// FIXME: use a newtype here? #[deriving(Eq)] pub struct Rotmat { priv submat: M } +impl Rotmat +{ + fn submat(&self) -> M + { self.submat } +} + pub fn rotmat2>(angle: T) -> Rotmat> { let coa = Trigonometric::cos(angle); @@ -130,8 +136,13 @@ impl> LMul for Rotmat { self.submat.lmul(other) } } -impl -Inv for Rotmat +impl DeltaTransform for Rotmat +{ + fn delta_transform(&self) -> M + { self.submat } +} + +impl Inv for Rotmat { fn invert(&mut self) { self.transpose() } diff --git a/src/adaptors/transform.rs b/src/adaptors/transform.rs index b820a12e..b2d90413 100644 --- a/src/adaptors/transform.rs +++ b/src/adaptors/transform.rs @@ -6,15 +6,17 @@ use traits::inv::Inv; use traits::rotation::Rotation; use traits::translation::Translation; use traits::transpose::Transpose; +use traits::delta_transform::DeltaTransform; use traits::workarounds::rlmul::{RMul, LMul}; pub struct Transform { - submat : M, - subtrans : V + priv submat : M, + priv subtrans : V } -pub fn transform(mat: &M, trans: &V) -> Transform +pub fn transform(mat: &M, trans: &V) +-> Transform { Transform { submat: *mat, subtrans: *trans } } impl Dim for Transform @@ -95,6 +97,12 @@ Rotation for Transform } } +impl DeltaTransform for Transform +{ + fn delta_transform(&self) -> M + { self.submat } +} + impl, V:Copy + Neg> Inv for Transform { diff --git a/src/nalgebra.rc b/src/nalgebra.rc index 6e5ec61a..4a9e04d7 100644 --- a/src/nalgebra.rc +++ b/src/nalgebra.rc @@ -48,6 +48,10 @@ mod traits mod norm; mod rotation; mod translation; + mod delta_transform; + mod vector_space; + mod ring; + mod division_ring; mod workarounds { diff --git a/src/tests/mat.rs b/src/tests/mat.rs index fca18dd0..290615fe 100644 --- a/src/tests/mat.rs +++ b/src/tests/mat.rs @@ -4,8 +4,6 @@ use core::num::{One, abs}; use core::rand::{random}; #[test] use std::cmp::FuzzyEq; -// #[test] -// use ndim::nmat::NMat; #[test] use traits::inv::Inv; #[test] @@ -20,8 +18,6 @@ use dim2::mat2::Mat2; use dim3::mat3::Mat3; #[test] use adaptors::rotmat::Rotmat; -// #[test] -// use traits::dim::d7; // FIXME: this one fails with an ICE: node_id_to_type: no type for node [...] // #[test]