diff --git a/src/mat.rs b/src/mat.rs index fb38945..c5df360 100644 --- a/src/mat.rs +++ b/src/mat.rs @@ -1,9 +1,8 @@ use core::cmp::Eq; - use std::cmp::FuzzyEq; use angle::Angle; -use quat::ToQuat; +use quat::Quat; pub mod mat2; pub mod mat3; @@ -257,9 +256,14 @@ pub trait Matrix2: Matrix { /** * A 3 x 3 matrix */ -pub trait Matrix3: Matrix ToQuat { +pub trait Matrix3: Matrix { static pure fn from_axis_angle>(axis: &V, theta: A) -> Mat3; pure fn to_mat4(&self) -> Mat4; + + /** + * Convert the matrix to a quaternion + */ + pure fn to_Quat() -> Quat; } /** diff --git a/src/mat3.rs b/src/mat3.rs index d9ad04e..0df68ca 100644 --- a/src/mat3.rs +++ b/src/mat3.rs @@ -10,7 +10,7 @@ use funs::common::*; use funs::exponential::*; use funs::triganomic::{sin, cos}; use num::types::{Float, Number}; -use quat::{Quat, ToQuat}; +use quat::Quat; use vec::Vec3; /** @@ -393,7 +393,7 @@ pub impl Mat3: MutableMatrix> { } } -pub impl Mat3: Matrix3> { +pub impl Mat3: Matrix3> { #[inline(always)] static pure fn from_axis_angle>(axis: &Vec3, theta: A) -> Mat3 { let c: T = cos(&theta.to_radians()); @@ -415,9 +415,7 @@ pub impl Mat3: Matrix3> { pure fn to_mat4(&self) -> Mat4 { Mat4::from_Mat3(self) } -} - -pub impl Mat3: ToQuat { + pure fn to_Quat() -> Quat { // Implemented using a mix of ideas from jMonkeyEngine and Ken Shoemake's // paper on Quaternions: http://www.cs.ucr.edu/~vbz/resources/Quatut.pdf diff --git a/src/quat.rs b/src/quat.rs index f447cce..85cffc7 100644 --- a/src/quat.rs +++ b/src/quat.rs @@ -182,12 +182,6 @@ pub trait Quaternion: Index Eq Neg { pure fn to_ptr(&self) -> *T; } -pub trait ToQuat { - /** - * Convert `self` to a quaternion - */ - pure fn to_Quat() -> Quat; -}