forked from M-Labs/nalgebra
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.
This commit is contained in:
parent
bf67f079e7
commit
70de340498
@ -10,7 +10,7 @@ use traits::operations::{Inv, ApproxEq};
|
|||||||
use traits::geometry::{RotationMatrix, Rotation, Rotate, AbsoluteRotate, Transform, Transformation,
|
use traits::geometry::{RotationMatrix, Rotation, Rotate, AbsoluteRotate, Transform, Transformation,
|
||||||
Translate, Translation, ToHomogeneous};
|
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::pnt::{Pnt2, Pnt3, Pnt4, Pnt2MulRhs, Pnt3MulRhs, Pnt4MulRhs};
|
||||||
use structs::rot::{Rot2, Rot3, Rot4};
|
use structs::rot::{Rot2, Rot3, Rot4};
|
||||||
|
|
||||||
@ -111,8 +111,6 @@ rotate_impl!(Iso2, Vec2)
|
|||||||
translation_impl!(Iso2, Vec2)
|
translation_impl!(Iso2, Vec2)
|
||||||
translate_impl!(Iso2, Pnt2)
|
translate_impl!(Iso2, Pnt2)
|
||||||
iso_mul_iso_impl!(Iso2, Iso2MulRhs)
|
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)
|
iso_mul_pnt_impl!(Iso2, Pnt2, Iso2MulRhs)
|
||||||
pnt_mul_iso_impl!(Iso2, Pnt2, Pnt2MulRhs)
|
pnt_mul_iso_impl!(Iso2, Pnt2, Pnt2MulRhs)
|
||||||
|
|
||||||
@ -134,8 +132,6 @@ rotate_impl!(Iso3, Vec3)
|
|||||||
translation_impl!(Iso3, Vec3)
|
translation_impl!(Iso3, Vec3)
|
||||||
translate_impl!(Iso3, Pnt3)
|
translate_impl!(Iso3, Pnt3)
|
||||||
iso_mul_iso_impl!(Iso3, Iso3MulRhs)
|
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)
|
iso_mul_pnt_impl!(Iso3, Pnt3, Iso3MulRhs)
|
||||||
pnt_mul_iso_impl!(Iso3, Pnt3, Pnt3MulRhs)
|
pnt_mul_iso_impl!(Iso3, Pnt3, Pnt3MulRhs)
|
||||||
|
|
||||||
@ -157,7 +153,5 @@ rotate_impl!(Iso4, Vec4)
|
|||||||
translation_impl!(Iso4, Vec4)
|
translation_impl!(Iso4, Vec4)
|
||||||
translate_impl!(Iso4, Pnt4)
|
translate_impl!(Iso4, Pnt4)
|
||||||
iso_mul_iso_impl!(Iso4, Iso4MulRhs)
|
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)
|
iso_mul_pnt_impl!(Iso4, Pnt4, Iso4MulRhs)
|
||||||
pnt_mul_iso_impl!(Iso4, Pnt4, Pnt4MulRhs)
|
pnt_mul_iso_impl!(Iso4, Pnt4, Pnt4MulRhs)
|
||||||
|
@ -72,28 +72,6 @@ macro_rules! iso_mul_iso_impl(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
macro_rules! iso_mul_vec_impl(
|
|
||||||
($t: ident, $tv: ident, $tmul: ident) => (
|
|
||||||
impl<N: Num + Clone> $tmul<N, $tv<N>> for $tv<N> {
|
|
||||||
#[inline]
|
|
||||||
fn binop(left: &$t<N>, right: &$tv<N>) -> $tv<N> {
|
|
||||||
left.rotation * *right
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
macro_rules! vec_mul_iso_impl(
|
|
||||||
($t: ident, $tv: ident, $tmul: ident) => (
|
|
||||||
impl<N: Clone + Num> $tmul<N, $tv<N>> for $t<N> {
|
|
||||||
#[inline]
|
|
||||||
fn binop(left: &$tv<N>, right: &$t<N>) -> $tv<N> {
|
|
||||||
left * right.rotation
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
macro_rules! iso_mul_pnt_impl(
|
macro_rules! iso_mul_pnt_impl(
|
||||||
($t: ident, $tv: ident, $tmul: ident) => (
|
($t: ident, $tv: ident, $tmul: ident) => (
|
||||||
impl<N: Num + Clone> $tmul<N, $tv<N>> for $tv<N> {
|
impl<N: Num + Clone> $tmul<N, $tv<N>> for $tv<N> {
|
||||||
@ -298,18 +276,6 @@ macro_rules! transform_impl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Num + Clone> $trhs<N> for $tv<N> {
|
|
||||||
#[inline]
|
|
||||||
fn transform(t: &$t<N>, v: &$tv<N>) -> $tv<N> {
|
|
||||||
t.rotation.transform(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
fn inv_transform(t: &$t<N>, v: &$tv<N>) -> $tv<N> {
|
|
||||||
t.rotation.inv_transform(v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<N: Num + Clone> $trhs<N> for $tp<N> {
|
impl<N: Num + Clone> $trhs<N> for $tp<N> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn transform(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
fn transform(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||||
|
Loading…
Reference in New Issue
Block a user