From 0523e1c7015617e532c041d134e2e358da644cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 24 Nov 2013 23:56:44 +0100 Subject: [PATCH] Add a free function to prepend a rotation. --- src/na.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/na.rs b/src/na.rs index cf7dc997..e2cfd7ce 100644 --- a/src/na.rs +++ b/src/na.rs @@ -217,6 +217,7 @@ pub fn inv_rotation>(m: &M) -> V { m.inv_rotation() } +// FIXME: this example is a bit shity /// Applies the rotation `v` to a copy of `m`. /// /// ```rust @@ -237,6 +238,27 @@ pub fn append_rotation>(m: &M, v: &V) -> M { Rotation::append_rotation_cpy(m, v) } +// FIXME: this example is a bit shity +/// Pre-applies the rotation `v` to a copy of `m`. +/// +/// ```rust +/// extern mod nalgebra; +/// use nalgebra::na::{Vec3, Rot3}; +/// use nalgebra::na; +/// +/// pub main() { +/// let t = Rot3::new(Vec3::new(0.0, 0.0, 0.0)); +/// let v = Vec3::new(1.0, 1.0, 1.0); +/// let rt = na::preend_rotation(&t, &v); +/// +/// assert!(na::rotation(&rt) == Vec3::new(1.0, 1.0, 1.0)) +/// } +/// ``` +#[inline(always)] +pub fn prepend_rotation>(m: &M, v: &V) -> M { + Rotation::prepend_rotation_cpy(m, v) +} + /* * Rotate */