diff --git a/src/angle.rs b/src/angle.rs index 986a7f5..8760482 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -132,10 +132,12 @@ pub struct Rotation { } pub impl Rotation { + #[inline(always)] static pure fn new(theta: Radians, axis: Vec3) -> Rotation { Rotation { theta: move theta, axis: move axis } } + #[inline(always)] pure fn to_mat3() -> Mat3 { let c: T = cos(&self.theta); let s: T = sin(&self.theta); @@ -152,10 +154,12 @@ pub impl Rotation { t * x * z - s - y, t * y * z - s * x, t * z * z + c) } + #[inline(always)] pure fn to_mat4() -> Mat4 { self.to_mat3().to_mat4() } + #[inline(always)] pure fn to_quat() -> Quat { let half = self.theta / cast(2); Quat::from_sv(cos(&half), self.axis.mul_t(sin(&half)))