From 70de3404989f70574693828e9ef422423cd10d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Fri, 10 Oct 2014 22:16:47 +0200 Subject: [PATCH] Remove the `Iso * Vec` overload and the ability to Transform a Vector with an Iso. This is too error prone as the user has to remember if he is using a vector or a point. Istead, to transform a vector with an Isometry, use the internal rotation matrix of the isometry: `iso.rotation * vector` instead of `iso * vector`. The `Rotation` trait can also be used. --- src/structs/iso.rs | 8 +------- src/structs/iso_macros.rs | 34 ---------------------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/structs/iso.rs b/src/structs/iso.rs index 00bfcbae..096dcc1c 100644 --- a/src/structs/iso.rs +++ b/src/structs/iso.rs @@ -10,7 +10,7 @@ use traits::operations::{Inv, ApproxEq}; use traits::geometry::{RotationMatrix, Rotation, Rotate, AbsoluteRotate, Transform, Transformation, Translate, Translation, ToHomogeneous}; -use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec2MulRhs, Vec3MulRhs, Vec4MulRhs}; +use structs::vec::{Vec1, Vec2, Vec3, Vec4}; use structs::pnt::{Pnt2, Pnt3, Pnt4, Pnt2MulRhs, Pnt3MulRhs, Pnt4MulRhs}; use structs::rot::{Rot2, Rot3, Rot4}; @@ -111,8 +111,6 @@ rotate_impl!(Iso2, Vec2) translation_impl!(Iso2, Vec2) translate_impl!(Iso2, Pnt2) iso_mul_iso_impl!(Iso2, Iso2MulRhs) -iso_mul_vec_impl!(Iso2, Vec2, Iso2MulRhs) -vec_mul_iso_impl!(Iso2, Vec2, Vec2MulRhs) iso_mul_pnt_impl!(Iso2, Pnt2, Iso2MulRhs) pnt_mul_iso_impl!(Iso2, Pnt2, Pnt2MulRhs) @@ -134,8 +132,6 @@ rotate_impl!(Iso3, Vec3) translation_impl!(Iso3, Vec3) translate_impl!(Iso3, Pnt3) iso_mul_iso_impl!(Iso3, Iso3MulRhs) -iso_mul_vec_impl!(Iso3, Vec3, Iso3MulRhs) -vec_mul_iso_impl!(Iso3, Vec3, Vec3MulRhs) iso_mul_pnt_impl!(Iso3, Pnt3, Iso3MulRhs) pnt_mul_iso_impl!(Iso3, Pnt3, Pnt3MulRhs) @@ -157,7 +153,5 @@ rotate_impl!(Iso4, Vec4) translation_impl!(Iso4, Vec4) translate_impl!(Iso4, Pnt4) iso_mul_iso_impl!(Iso4, Iso4MulRhs) -iso_mul_vec_impl!(Iso4, Vec4, Iso4MulRhs) -vec_mul_iso_impl!(Iso4, Vec4, Vec4MulRhs) iso_mul_pnt_impl!(Iso4, Pnt4, Iso4MulRhs) pnt_mul_iso_impl!(Iso4, Pnt4, Pnt4MulRhs) diff --git a/src/structs/iso_macros.rs b/src/structs/iso_macros.rs index 93e472f0..6eeb6fad 100644 --- a/src/structs/iso_macros.rs +++ b/src/structs/iso_macros.rs @@ -72,28 +72,6 @@ macro_rules! iso_mul_iso_impl( ) ) -macro_rules! iso_mul_vec_impl( - ($t: ident, $tv: ident, $tmul: ident) => ( - impl $tmul> for $tv { - #[inline] - fn binop(left: &$t, right: &$tv) -> $tv { - left.rotation * *right - } - } - ) -) - -macro_rules! vec_mul_iso_impl( - ($t: ident, $tv: ident, $tmul: ident) => ( - impl $tmul> for $t { - #[inline] - fn binop(left: &$tv, right: &$t) -> $tv { - left * right.rotation - } - } - ) -) - macro_rules! iso_mul_pnt_impl( ($t: ident, $tv: ident, $tmul: ident) => ( impl $tmul> for $tv { @@ -298,18 +276,6 @@ macro_rules! transform_impl( } } - impl $trhs for $tv { - #[inline] - fn transform(t: &$t, v: &$tv) -> $tv { - t.rotation.transform(v) - } - - #[inline] - fn inv_transform(t: &$t, v: &$tv) -> $tv { - t.rotation.inv_transform(v) - } - } - impl $trhs for $tp { #[inline] fn transform(t: &$t, p: &$tp) -> $tp {