From 03bfe9b7a77a4cf3217cf3ab0df884dfa98bfcc5 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Tue, 16 Jul 2013 09:23:57 +1000 Subject: [PATCH] Move rotation module into transform module This decouples these types from the more general math types. It also makes more sense, because rotations are indeed a type of transformation. --- src/math/math.rs | 5 ----- src/{math => transform}/rotation.rs | 13 +++---------- src/transform/transform.rs | 5 +++++ 3 files changed, 8 insertions(+), 15 deletions(-) rename src/{math => transform}/rotation.rs (98%) diff --git a/src/math/math.rs b/src/math/math.rs index fb36498..97e8a22 100644 --- a/src/math/math.rs +++ b/src/math/math.rs @@ -31,10 +31,6 @@ pub use self::point::Point; pub use self::point::{Point2, AsPoint2}; pub use self::point::{Point3, AsPoint3}; pub use self::ray::{Ray2, Ray3}; -pub use self::rotation::Rotation; -pub use self::rotation::{Euler, ToEuler}; -pub use self::rotation::{AxisAngle, ToAxisAngle}; -pub use self::rotation::{AngleX, AngleY, AngleZ}; pub mod mat; pub mod quat; @@ -43,7 +39,6 @@ pub mod vec; pub mod plane; pub mod point; pub mod ray; -pub mod rotation; pub trait Dimensioned { pub fn index<'a>(&'a self, i: uint) -> &'a T; diff --git a/src/math/rotation.rs b/src/transform/rotation.rs similarity index 98% rename from src/math/rotation.rs rename to src/transform/rotation.rs index 7cd6706..1fa879a 100644 --- a/src/math/rotation.rs +++ b/src/transform/rotation.rs @@ -28,12 +28,7 @@ use std::cast; -use math::{Dimensioned, SwapComponents}; -use math::{Mat, NumMat, FloatMat}; -use math::{Mat3, ToMat3}; -use math::{Mat4, ToMat4}; -use math::{Quat, ToQuat}; -use math::{Vec3, ToVec3, AsVec3}; +use math::*; use math::{Point3, Ray3}; @@ -327,10 +322,8 @@ impl ToMat4 for AxisAngle { #[cfg(test)] mod axis_angle_tests { - use math::mat::*; - use math::quat::*; - use math::rotation::*; - use math::vec::*; + use math::*; + use transform::*; #[test] fn test_to_quat() { diff --git a/src/transform/transform.rs b/src/transform/transform.rs index 2de7ecd..8d0a113 100644 --- a/src/transform/transform.rs +++ b/src/transform/transform.rs @@ -14,10 +14,15 @@ // limitations under the License. pub use self::projection::{Projection, Perspective, PerspectiveFOV, Ortho}; +pub use self::rotation::Rotation; +pub use self::rotation::{Euler, ToEuler}; +pub use self::rotation::{AxisAngle, ToAxisAngle}; +pub use self::rotation::{AngleX, AngleY, AngleZ}; use math::{Vec3, Quat}; pub mod projection; +pub mod rotation; pub trait Transform {}