From 3dc76caf7edec82f81f8d47dafedcb1830e7e4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Fri, 2 Feb 2018 12:26:29 +0100 Subject: [PATCH] =?UTF-8?q?Add=20Isometry=20=C3=97=20Unit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #285. --- src/geometry/isometry_ops.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/geometry/isometry_ops.rs b/src/geometry/isometry_ops.rs index 02b89590..7cec960d 100644 --- a/src/geometry/isometry_ops.rs +++ b/src/geometry/isometry_ops.rs @@ -3,7 +3,7 @@ use std::ops::{Mul, MulAssign, Div, DivAssign}; use alga::general::Real; use alga::linear::Rotation as AlgaRotation; -use core::{DefaultAllocator, VectorN}; +use core::{DefaultAllocator, VectorN, Unit}; use core::dimension::{DimName, U1, U3, U4}; use core::allocator::Allocator; @@ -30,6 +30,7 @@ use geometry::{Point, Rotation, Isometry, Translation, UnitQuaternion}; * * Isometry × Point * Isometry × Vector + * Isometry × Unit * * * Isometry × Translation @@ -252,6 +253,18 @@ isometry_binop_impl_all!( [ref ref] => self.rotation.transform_vector(right); ); +// Isometry × Unit +isometry_binop_impl_all!( + Mul, mul; + // FIXME: because of `transform_vector`, we cant use a generic storage type for the rhs vector, + // i.e., right: Vector where S: Storage. + self: Isometry, right: Unit>, Output = Unit>; + [val val] => Unit::new_unchecked(self.rotation.transform_vector(right.as_ref())); + [ref val] => Unit::new_unchecked(self.rotation.transform_vector(right.as_ref())); + [val ref] => Unit::new_unchecked(self.rotation.transform_vector(right.as_ref())); + [ref ref] => Unit::new_unchecked(self.rotation.transform_vector(right.as_ref())); +); + // Isometry × Translation isometry_binop_impl_all!(