Fix conflicting impls for isometry multiplication.
This commit is contained in:
parent
7357d17b77
commit
fefba2ef4e
|
@ -1,13 +1,13 @@
|
||||||
use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
|
use alga::general::{AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid,
|
||||||
AbstractQuasigroup, AbstractSemigroup, Id, Identity, Inverse, Multiplicative,
|
AbstractQuasigroup, AbstractSemigroup, Id, Identity, Inverse, Multiplicative,
|
||||||
Real};
|
Real};
|
||||||
|
use alga::linear::Isometry as AlgaIsometry;
|
||||||
use alga::linear::{AffineTransformation, DirectIsometry, ProjectiveTransformation, Rotation,
|
use alga::linear::{AffineTransformation, DirectIsometry, ProjectiveTransformation, Rotation,
|
||||||
Similarity, Transformation};
|
Similarity, Transformation};
|
||||||
use alga::linear::Isometry as AlgaIsometry;
|
|
||||||
|
|
||||||
use core::{DefaultAllocator, VectorN};
|
|
||||||
use core::dimension::DimName;
|
|
||||||
use core::allocator::Allocator;
|
use core::allocator::Allocator;
|
||||||
|
use core::dimension::DimName;
|
||||||
|
use core::{DefaultAllocator, VectorN};
|
||||||
|
|
||||||
use geometry::{Isometry, Point, Translation};
|
use geometry::{Isometry, Point, Translation};
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ use std::ops::{Div, DivAssign, Mul, MulAssign};
|
||||||
use alga::general::Real;
|
use alga::general::Real;
|
||||||
use alga::linear::Rotation as AlgaRotation;
|
use alga::linear::Rotation as AlgaRotation;
|
||||||
|
|
||||||
use core::{DefaultAllocator, Unit, VectorN};
|
|
||||||
use core::dimension::{DimName, U1, U3, U4};
|
|
||||||
use core::allocator::Allocator;
|
use core::allocator::Allocator;
|
||||||
|
use core::dimension::{DimName, U1, U3, U4};
|
||||||
|
use core::{DefaultAllocator, Unit, VectorN};
|
||||||
|
|
||||||
use geometry::{Isometry, Point, Rotation, Translation, UnitQuaternion};
|
use geometry::{Isometry, Point, Rotation, Translation, UnitQuaternion};
|
||||||
|
|
||||||
|
@ -281,16 +281,6 @@ isometry_binop_impl_all!(
|
||||||
[ref ref] => Isometry::from_parts(self * &right.translation, right.rotation.clone());
|
[ref ref] => Isometry::from_parts(self * &right.translation, right.rotation.clone());
|
||||||
);
|
);
|
||||||
|
|
||||||
// Translation × R
|
|
||||||
isometry_binop_impl_all!(
|
|
||||||
Mul, mul;
|
|
||||||
self: Translation<N, D>, right: R, Output = Isometry<N, D, R>;
|
|
||||||
[val val] => Isometry::from_parts(self, right);
|
|
||||||
[ref val] => Isometry::from_parts(self.clone(), right);
|
|
||||||
[val ref] => Isometry::from_parts(self, right.clone());
|
|
||||||
[ref ref] => Isometry::from_parts(self.clone(), right.clone());
|
|
||||||
);
|
|
||||||
|
|
||||||
macro_rules! isometry_from_composition_impl(
|
macro_rules! isometry_from_composition_impl(
|
||||||
($Op: ident, $op: ident;
|
($Op: ident, $op: ident;
|
||||||
($R1: ty, $C1: ty),($R2: ty, $C2: ty) $(for $Dims: ident: $DimsBound: ident),*;
|
($R1: ty, $C1: ty),($R2: ty, $C2: ty) $(for $Dims: ident: $DimsBound: ident),*;
|
||||||
|
@ -422,3 +412,25 @@ isometry_from_composition_impl_all!(
|
||||||
[val ref] => self * right.inverse();
|
[val ref] => self * right.inverse();
|
||||||
[ref ref] => self * right.inverse();
|
[ref ref] => self * right.inverse();
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Translation × Rotation
|
||||||
|
isometry_from_composition_impl_all!(
|
||||||
|
Mul, mul;
|
||||||
|
(D, D), (D, U1) for D: DimName;
|
||||||
|
self: Translation<N, D>, right: Rotation<N, D>, Output = Isometry<N, D, Rotation<N, D>>;
|
||||||
|
[val val] => Isometry::from_parts(self, right);
|
||||||
|
[ref val] => Isometry::from_parts(self.clone(), right);
|
||||||
|
[val ref] => Isometry::from_parts(self, right.clone());
|
||||||
|
[ref ref] => Isometry::from_parts(self.clone(), right.clone());
|
||||||
|
);
|
||||||
|
|
||||||
|
// Translation × UnitQuaternion
|
||||||
|
isometry_from_composition_impl_all!(
|
||||||
|
Mul, mul;
|
||||||
|
(U4, U1), (U3, U1);
|
||||||
|
self: Translation<N, U3>, right: UnitQuaternion<N>, Output = Isometry<N, U3, UnitQuaternion<N>>;
|
||||||
|
[val val] => Isometry::from_parts(self, right);
|
||||||
|
[ref val] => Isometry::from_parts(self.clone(), right);
|
||||||
|
[val ref] => Isometry::from_parts(self, right.clone());
|
||||||
|
[ref ref] => Isometry::from_parts(self.clone(), right.clone());
|
||||||
|
);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
use std::ops::{Div, DivAssign, Mul, MulAssign};
|
use std::ops::{Div, DivAssign, Mul, MulAssign};
|
||||||
|
|
||||||
use alga::general::Real;
|
use alga::general::Real;
|
||||||
use core::{DefaultAllocator, Matrix, Unit, Vector, Vector2};
|
|
||||||
use core::dimension::{Dim, U1, U2};
|
|
||||||
use core::storage::{Storage, StorageMut};
|
|
||||||
use core::allocator::Allocator;
|
use core::allocator::Allocator;
|
||||||
use core::constraint::{DimEq, ShapeConstraint};
|
use core::constraint::{DimEq, ShapeConstraint};
|
||||||
|
use core::dimension::{Dim, U1, U2};
|
||||||
|
use core::storage::{Storage, StorageMut};
|
||||||
|
use core::{DefaultAllocator, Matrix, Unit, Vector, Vector2};
|
||||||
use geometry::{Isometry, Point2, Rotation, Similarity, Translation, UnitComplex};
|
use geometry::{Isometry, Point2, Rotation, Similarity, Translation, UnitComplex};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -288,6 +288,18 @@ complex_op_impl_all!(
|
||||||
[ref ref] => Isometry::from_parts(Translation::from_vector( self * &rhs.vector), self.clone());
|
[ref ref] => Isometry::from_parts(Translation::from_vector( self * &rhs.vector), self.clone());
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Translation × UnitComplex
|
||||||
|
complex_op_impl_all!(
|
||||||
|
Mul, mul;
|
||||||
|
(U2, U1);
|
||||||
|
self: Translation<N, U2>, right: UnitComplex<N>,
|
||||||
|
Output = Isometry<N, U2, UnitComplex<N>>;
|
||||||
|
[val val] => Isometry::from_parts(self, right);
|
||||||
|
[ref val] => Isometry::from_parts(self.clone(), right);
|
||||||
|
[val ref] => Isometry::from_parts(self, right.clone());
|
||||||
|
[ref ref] => Isometry::from_parts(self.clone(), right.clone());
|
||||||
|
);
|
||||||
|
|
||||||
// UnitComplex ×= UnitComplex
|
// UnitComplex ×= UnitComplex
|
||||||
impl<N: Real> MulAssign<UnitComplex<N>> for UnitComplex<N> {
|
impl<N: Real> MulAssign<UnitComplex<N>> for UnitComplex<N> {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Reference in New Issue