diff --git a/src/structs/quat.rs b/src/structs/quat.rs index 604a1e20..a8664ef5 100644 --- a/src/structs/quat.rs +++ b/src/structs/quat.rs @@ -12,7 +12,7 @@ use structs::{Vec3, Pnt3, Rot3, Mat3}; use traits::operations::{ApproxEq, Inv, POrd, POrdering, Axpy}; use traits::structure::{Cast, Indexable, Iterable, IterableMut, Dim, Shape, BaseFloat, BaseNum, Bounded, Repeat}; -use traits::geometry::{Norm, Rotation, Rotate, RotationTo, Transform}; +use traits::geometry::{Norm, Rotation, RotationMatrix, Rotate, RotationTo, Transform}; #[cfg(feature="arbitrary")] use quickcheck::{Arbitrary, Gen}; @@ -156,6 +156,8 @@ impl + BaseFloat> Div> for Quat { } } +rand_impl!(Quat, w, i, j, k); + /// A unit quaternion that can represent a 3D rotation. #[repr(C)] @@ -246,8 +248,6 @@ impl UnitQuat { } } -rand_impl!(Quat, w, i, j, k); - impl UnitQuat { /// Creates a new unit quaternion from a quaternion. @@ -432,6 +432,15 @@ impl Rotation> for UnitQuat { } } +impl RotationMatrix, Vec3> for UnitQuat { + type Output = Rot3; + + #[inline] + fn to_rot_mat(&self) -> Rot3 { + self.to_rot() + } +} + impl> Rotate> for UnitQuat { #[inline] fn rotate(&self, v: &Vec3) -> Vec3 {