From ec160e5219db86254f19c2ca3f7d22042098769e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 19 May 2013 15:01:38 +0000 Subject: [PATCH] Fix rotation for transform adaptor. --- src/adaptors/transform.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/adaptors/transform.rs b/src/adaptors/transform.rs index e8fcab6e..b820a12e 100644 --- a/src/adaptors/transform.rs +++ b/src/adaptors/transform.rs @@ -72,16 +72,27 @@ impl> Translation for Transform { self.subtrans.translate(t) } } -impl + Copy, V: Copy> Rotation for Transform +impl + Copy + RMul + One, V: Copy> +Rotation for Transform { fn rotation(&self) -> V { self.submat.rotation() } fn rotated(&self, rot: &V) -> Transform - { transform(&self.submat.rotated(rot), &self.subtrans) } + { + // FIXME: this does not seem opitmal + let delta = One::one::().rotated(rot); + + transform(&self.submat.rotated(rot), &delta.rmul(&self.subtrans)) + } fn rotate(&mut self, rot: &V) - { self.submat.rotate(rot) } + { + // FIXME: this does not seem opitmal + let delta = One::one::().rotated(rot); + self.submat.rotate(rot); + self.subtrans = delta.rmul(&self.subtrans); + } } impl, V:Copy + Neg>