commit
224b5629e3
|
@ -149,6 +149,7 @@ isometry_binop_impl_all!(
|
|||
[ref ref] => {
|
||||
let shift = self.rotation.transform_vector(&rhs.translation.vector);
|
||||
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
Isometry::from_parts(Translation::from(&self.translation.vector + shift),
|
||||
self.rotation.clone() * rhs.rotation.clone()) // FIXME: too bad we have to clone.
|
||||
};
|
||||
|
@ -157,10 +158,10 @@ isometry_binop_impl_all!(
|
|||
isometry_binop_impl_all!(
|
||||
Div, div;
|
||||
self: Isometry<N, D, R>, rhs: Isometry<N, D, R>, Output = Isometry<N, D, R>;
|
||||
[val val] => self * rhs.inverse();
|
||||
[ref val] => self * rhs.inverse();
|
||||
[val ref] => self * rhs.inverse();
|
||||
[ref ref] => self * rhs.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
);
|
||||
|
||||
// Isometry ×= Translation
|
||||
|
@ -289,6 +290,7 @@ isometry_binop_impl_all!(
|
|||
[ref val] => self * &right;
|
||||
[val ref] => &self * right;
|
||||
[ref ref] => {
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
let new_tr = &self.translation.vector + self.rotation.transform_vector(&right.vector);
|
||||
Isometry::from_parts(Translation::from(new_tr), self.rotation.clone())
|
||||
};
|
||||
|
@ -427,10 +429,10 @@ isometry_from_composition_impl_all!(
|
|||
self: Rotation<N, D>, right: Isometry<N, D, Rotation<N, D>>,
|
||||
Output = Isometry<N, D, Rotation<N, D>>;
|
||||
// FIXME: don't call inverse explicitly?
|
||||
[val val] => self * right.inverse();
|
||||
[ref val] => self * right.inverse();
|
||||
[val ref] => self * right.inverse();
|
||||
[ref ref] => self * right.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
);
|
||||
|
||||
// Isometry × UnitQuaternion
|
||||
|
@ -479,10 +481,10 @@ isometry_from_composition_impl_all!(
|
|||
self: UnitQuaternion<N>, right: Isometry<N, U3, UnitQuaternion<N>>,
|
||||
Output = Isometry<N, U3, UnitQuaternion<N>>;
|
||||
// FIXME: don't call inverse explicitly?
|
||||
[val val] => self * right.inverse();
|
||||
[ref val] => self * right.inverse();
|
||||
[val ref] => self * right.inverse();
|
||||
[ref ref] => self * right.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
);
|
||||
|
||||
// Translation × Rotation
|
||||
|
|
|
@ -389,6 +389,7 @@ where
|
|||
/// ```
|
||||
#[inline]
|
||||
pub fn outer(&self, other: &Self) -> Self {
|
||||
#[allow(clippy::eq_op)]
|
||||
(self * other - other * self).half()
|
||||
}
|
||||
|
||||
|
|
|
@ -121,11 +121,10 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Add, add;
|
||||
(U4, U1), (U4, U1);
|
||||
self: Quaternion<N>, rhs: Quaternion<N>, Output = Quaternion<N>;
|
||||
Quaternion::from(self.coords + rhs.coords);
|
||||
);
|
||||
Add, add;
|
||||
(U4, U1), (U4, U1);
|
||||
self: Quaternion<N>, rhs: Quaternion<N>, Output = Quaternion<N>;
|
||||
Quaternion::from(self.coords + rhs.coords); );
|
||||
|
||||
// Quaternion - Quaternion
|
||||
quaternion_op_impl!(
|
||||
|
@ -150,11 +149,10 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Sub, sub;
|
||||
(U4, U1), (U4, U1);
|
||||
self: Quaternion<N>, rhs: Quaternion<N>, Output = Quaternion<N>;
|
||||
Quaternion::from(self.coords - rhs.coords);
|
||||
);
|
||||
Sub, sub;
|
||||
(U4, U1), (U4, U1);
|
||||
self: Quaternion<N>, rhs: Quaternion<N>, Output = Quaternion<N>;
|
||||
Quaternion::from(self.coords - rhs.coords); );
|
||||
|
||||
// Quaternion × Quaternion
|
||||
quaternion_op_impl!(
|
||||
|
@ -183,11 +181,10 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Mul, mul;
|
||||
(U4, U1), (U4, U1);
|
||||
self: Quaternion<N>, rhs: Quaternion<N>, Output = Quaternion<N>;
|
||||
&self * &rhs;
|
||||
);
|
||||
Mul, mul;
|
||||
(U4, U1), (U4, U1);
|
||||
self: Quaternion<N>, rhs: Quaternion<N>, Output = Quaternion<N>;
|
||||
&self * &rhs; );
|
||||
|
||||
// UnitQuaternion × UnitQuaternion
|
||||
quaternion_op_impl!(
|
||||
|
@ -212,18 +209,17 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Mul, mul;
|
||||
(U4, U1), (U4, U1);
|
||||
self: UnitQuaternion<N>, rhs: UnitQuaternion<N>, Output = UnitQuaternion<N>;
|
||||
&self * &rhs;
|
||||
);
|
||||
Mul, mul;
|
||||
(U4, U1), (U4, U1);
|
||||
self: UnitQuaternion<N>, rhs: UnitQuaternion<N>, Output = UnitQuaternion<N>;
|
||||
&self * &rhs; );
|
||||
|
||||
// UnitQuaternion ÷ UnitQuaternion
|
||||
quaternion_op_impl!(
|
||||
Div, div;
|
||||
(U4, U1), (U4, U1);
|
||||
self: &'a UnitQuaternion<N>, rhs: &'b UnitQuaternion<N>, Output = UnitQuaternion<N>;
|
||||
self * rhs.inverse();
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
'a, 'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
|
@ -241,11 +237,10 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Div, div;
|
||||
(U4, U1), (U4, U1);
|
||||
self: UnitQuaternion<N>, rhs: UnitQuaternion<N>, Output = UnitQuaternion<N>;
|
||||
&self / &rhs;
|
||||
);
|
||||
Div, div;
|
||||
(U4, U1), (U4, U1);
|
||||
self: UnitQuaternion<N>, rhs: UnitQuaternion<N>, Output = UnitQuaternion<N>;
|
||||
&self / &rhs; );
|
||||
|
||||
// UnitQuaternion × Rotation
|
||||
quaternion_op_impl!(
|
||||
|
@ -274,12 +269,11 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Mul, mul;
|
||||
(U4, U1), (U3, U3);
|
||||
self: UnitQuaternion<N>, rhs: Rotation<N, U3>,
|
||||
Output = UnitQuaternion<N> => U3, U3;
|
||||
self * UnitQuaternion::<N>::from_rotation_matrix(&rhs);
|
||||
);
|
||||
Mul, mul;
|
||||
(U4, U1), (U3, U3);
|
||||
self: UnitQuaternion<N>, rhs: Rotation<N, U3>,
|
||||
Output = UnitQuaternion<N> => U3, U3;
|
||||
self * UnitQuaternion::<N>::from_rotation_matrix(&rhs); );
|
||||
|
||||
// UnitQuaternion ÷ Rotation
|
||||
quaternion_op_impl!(
|
||||
|
@ -308,12 +302,11 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Div, div;
|
||||
(U4, U1), (U3, U3);
|
||||
self: UnitQuaternion<N>, rhs: Rotation<N, U3>,
|
||||
Output = UnitQuaternion<N> => U3, U3;
|
||||
self / UnitQuaternion::<N>::from_rotation_matrix(&rhs);
|
||||
);
|
||||
Div, div;
|
||||
(U4, U1), (U3, U3);
|
||||
self: UnitQuaternion<N>, rhs: Rotation<N, U3>,
|
||||
Output = UnitQuaternion<N> => U3, U3;
|
||||
self / UnitQuaternion::<N>::from_rotation_matrix(&rhs); );
|
||||
|
||||
// Rotation × UnitQuaternion
|
||||
quaternion_op_impl!(
|
||||
|
@ -342,12 +335,11 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Mul, mul;
|
||||
(U3, U3), (U4, U1);
|
||||
self: Rotation<N, U3>, rhs: UnitQuaternion<N>,
|
||||
Output = UnitQuaternion<N> => U3, U3;
|
||||
UnitQuaternion::<N>::from_rotation_matrix(&self) * rhs;
|
||||
);
|
||||
Mul, mul;
|
||||
(U3, U3), (U4, U1);
|
||||
self: Rotation<N, U3>, rhs: UnitQuaternion<N>,
|
||||
Output = UnitQuaternion<N> => U3, U3;
|
||||
UnitQuaternion::<N>::from_rotation_matrix(&self) * rhs; );
|
||||
|
||||
// Rotation ÷ UnitQuaternion
|
||||
quaternion_op_impl!(
|
||||
|
@ -376,12 +368,11 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Div, div;
|
||||
(U3, U3), (U4, U1);
|
||||
self: Rotation<N, U3>, rhs: UnitQuaternion<N>,
|
||||
Output = UnitQuaternion<N> => U3, U3;
|
||||
UnitQuaternion::<N>::from_rotation_matrix(&self) / rhs;
|
||||
);
|
||||
Div, div;
|
||||
(U3, U3), (U4, U1);
|
||||
self: Rotation<N, U3>, rhs: UnitQuaternion<N>,
|
||||
Output = UnitQuaternion<N> => U3, U3;
|
||||
UnitQuaternion::<N>::from_rotation_matrix(&self) / rhs; );
|
||||
|
||||
// UnitQuaternion × Vector
|
||||
quaternion_op_impl!(
|
||||
|
@ -415,12 +406,11 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Mul, mul;
|
||||
(U4, U1), (U3, U1) for SB: Storage<N, U3> ;
|
||||
self: UnitQuaternion<N>, rhs: Vector<N, U3, SB>,
|
||||
Output = Vector3<N> => U3, U4;
|
||||
&self * &rhs;
|
||||
);
|
||||
Mul, mul;
|
||||
(U4, U1), (U3, U1) for SB: Storage<N, U3> ;
|
||||
self: UnitQuaternion<N>, rhs: Vector<N, U3, SB>,
|
||||
Output = Vector3<N> => U3, U4;
|
||||
&self * &rhs; );
|
||||
|
||||
// UnitQuaternion × Point
|
||||
quaternion_op_impl!(
|
||||
|
@ -448,12 +438,11 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Mul, mul;
|
||||
(U4, U1), (U3, U1);
|
||||
self: UnitQuaternion<N>, rhs: Point3<N>,
|
||||
Output = Point3<N> => U3, U4;
|
||||
Point3::from(self * rhs.coords);
|
||||
);
|
||||
Mul, mul;
|
||||
(U4, U1), (U3, U1);
|
||||
self: UnitQuaternion<N>, rhs: Point3<N>,
|
||||
Output = Point3<N> => U3, U4;
|
||||
Point3::from(self * rhs.coords); );
|
||||
|
||||
// UnitQuaternion × Unit<Vector>
|
||||
quaternion_op_impl!(
|
||||
|
@ -481,12 +470,11 @@ quaternion_op_impl!(
|
|||
'b);
|
||||
|
||||
quaternion_op_impl!(
|
||||
Mul, mul;
|
||||
(U4, U1), (U3, U1) for SB: Storage<N, U3> ;
|
||||
self: UnitQuaternion<N>, rhs: Unit<Vector<N, U3, SB>>,
|
||||
Output = Unit<Vector3<N>> => U3, U4;
|
||||
Unit::new_unchecked(self * rhs.into_inner());
|
||||
);
|
||||
Mul, mul;
|
||||
(U4, U1), (U3, U1) for SB: Storage<N, U3> ;
|
||||
self: UnitQuaternion<N>, rhs: Unit<Vector<N, U3, SB>>,
|
||||
Output = Unit<Vector3<N>> => U3, U4;
|
||||
Unit::new_unchecked(self * rhs.into_inner()); );
|
||||
|
||||
macro_rules! scalar_op_impl(
|
||||
($($Op: ident, $op: ident, $OpAssign: ident, $op_assign: ident);* $(;)*) => {$(
|
||||
|
|
|
@ -59,10 +59,10 @@ md_impl_all!(
|
|||
Div, div;
|
||||
(D, D), (D, D) for D: DimName;
|
||||
self: Rotation<N, D>, right: Rotation<N, D>, Output = Rotation<N, D>;
|
||||
[val val] => self * right.inverse();
|
||||
[ref val] => self * right.inverse();
|
||||
[val ref] => self * right.inverse();
|
||||
[ref ref] => self * right.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
);
|
||||
|
||||
// Rotation × Matrix
|
||||
|
@ -98,10 +98,10 @@ md_impl_all!(
|
|||
where DefaultAllocator: Allocator<N, R1, D2>
|
||||
where ShapeConstraint: AreMultipliable<R1, C1, D2, D2>;
|
||||
self: Matrix<N, R1, C1, SA>, right: Rotation<N, D2>, Output = MatrixMN<N, R1, D2>;
|
||||
[val val] => self * right.inverse();
|
||||
[ref val] => self * right.inverse();
|
||||
[val ref] => self * right.inverse();
|
||||
[ref ref] => self * right.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
);
|
||||
|
||||
// Rotation × Point
|
||||
|
|
|
@ -158,15 +158,14 @@ similarity_binop_impl_all!(
|
|||
similarity_binop_impl_all!(
|
||||
Div, div;
|
||||
self: Similarity<N, D, R>, rhs: Similarity<N, D, R>, Output = Similarity<N, D, R>;
|
||||
[val val] => self * rhs.inverse();
|
||||
[ref val] => self * rhs.inverse();
|
||||
[val ref] => self * rhs.inverse();
|
||||
[ref ref] => self * rhs.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
);
|
||||
|
||||
// Similarity ×= Translation
|
||||
similarity_binop_assign_impl_all!(
|
||||
|
||||
MulAssign, mul_assign;
|
||||
self: Similarity<N, D, R>, rhs: Translation<N, D>;
|
||||
[val] => *self *= &rhs;
|
||||
|
@ -281,6 +280,7 @@ similarity_binop_impl_all!(
|
|||
[ref ref] => {
|
||||
let shift = self.isometry.rotation.transform_vector(&rhs.translation.vector) * self.scaling();
|
||||
Similarity::from_parts(
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
Translation::from(&self.isometry.translation.vector + shift),
|
||||
self.isometry.rotation.clone() * rhs.rotation.clone(),
|
||||
self.scaling())
|
||||
|
@ -290,10 +290,10 @@ similarity_binop_impl_all!(
|
|||
similarity_binop_impl_all!(
|
||||
Div, div;
|
||||
self: Similarity<N, D, R>, rhs: Isometry<N, D, R>, Output = Similarity<N, D, R>;
|
||||
[val val] => self * rhs.inverse();
|
||||
[ref val] => self * rhs.inverse();
|
||||
[val ref] => self * rhs.inverse();
|
||||
[ref ref] => self * rhs.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
);
|
||||
|
||||
// Isometry × Similarity
|
||||
|
@ -322,10 +322,10 @@ similarity_binop_impl_all!(
|
|||
similarity_binop_impl_all!(
|
||||
Div, div;
|
||||
self: Isometry<N, D, R>, rhs: Similarity<N, D, R>, Output = Similarity<N, D, R>;
|
||||
[val val] => self * rhs.inverse();
|
||||
[ref val] => self * rhs.inverse();
|
||||
[val ref] => self * rhs.inverse();
|
||||
[ref ref] => self * rhs.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
);
|
||||
|
||||
// Similarity × Point
|
||||
|
@ -364,6 +364,7 @@ similarity_binop_impl_all!(
|
|||
[ref ref] => {
|
||||
let shift = self.isometry.rotation.transform_vector(&right.vector) * self.scaling();
|
||||
Similarity::from_parts(
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
Translation::from(&self.isometry.translation.vector + shift),
|
||||
self.isometry.rotation.clone(),
|
||||
self.scaling())
|
||||
|
@ -495,10 +496,10 @@ similarity_from_composition_impl_all!(
|
|||
self: Rotation<N, D>, right: Similarity<N, D, Rotation<N, D>>,
|
||||
Output = Similarity<N, D, Rotation<N, D>>;
|
||||
// FIXME: don't call inverse explicitly?
|
||||
[val val] => self * right.inverse();
|
||||
[ref val] => self * right.inverse();
|
||||
[val ref] => self * right.inverse();
|
||||
[ref ref] => self * right.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
);
|
||||
|
||||
// Similarity × UnitQuaternion
|
||||
|
@ -556,10 +557,10 @@ similarity_from_composition_impl_all!(
|
|||
self: UnitQuaternion<N>, right: Similarity<N, U3, UnitQuaternion<N>>,
|
||||
Output = Similarity<N, U3, UnitQuaternion<N>>;
|
||||
// FIXME: don't call inverse explicitly?
|
||||
[val val] => self * right.inverse();
|
||||
[ref val] => self * right.inverse();
|
||||
[val ref] => self * right.inverse();
|
||||
[ref ref] => self * right.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * right.inverse() };
|
||||
);
|
||||
|
||||
// Similarity × UnitComplex
|
||||
|
|
|
@ -143,6 +143,7 @@ md_impl_all!(
|
|||
|
||||
if C::has_normalizer() {
|
||||
let normalizer = self.matrix().fixed_slice::<U1, D>(D::dim(), 0);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
let n = normalizer.tr_dot(&rhs.coords) + unsafe { *self.matrix().get_unchecked((D::dim(), D::dim())) };
|
||||
|
||||
if !n.is_zero() {
|
||||
|
@ -293,10 +294,10 @@ md_impl_all!(
|
|||
Div, div where N: RealField;
|
||||
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>) for D: DimNameAdd<U1>, CA: TCategoryMul<CB>, CB: SubTCategoryOf<TProjective>;
|
||||
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>, Output = Transform<N, D, CA::Representative>;
|
||||
[val val] => self * rhs.inverse();
|
||||
[ref val] => self * rhs.inverse();
|
||||
[val ref] => self * rhs.clone().inverse();
|
||||
[ref ref] => self * rhs.clone().inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.clone().inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.clone().inverse() };
|
||||
);
|
||||
|
||||
// Transform ÷ Rotation
|
||||
|
@ -304,10 +305,10 @@ md_impl_all!(
|
|||
Div, div where N: RealField;
|
||||
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, D) for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>;
|
||||
self: Transform<N, D, C>, rhs: Rotation<N, D>, Output = Transform<N, D, C::Representative>;
|
||||
[val val] => self * rhs.inverse();
|
||||
[ref val] => self * rhs.inverse();
|
||||
[val ref] => self * rhs.inverse();
|
||||
[ref ref] => self * rhs.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
);
|
||||
|
||||
// Rotation ÷ Transform
|
||||
|
@ -315,10 +316,10 @@ md_impl_all!(
|
|||
Div, div where N: RealField;
|
||||
(D, D), (DimNameSum<D, U1>, DimNameSum<D, U1>) for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>;
|
||||
self: Rotation<N, D>, rhs: Transform<N, D, C>, Output = Transform<N, D, C::Representative>;
|
||||
[val val] => self.inverse() * rhs;
|
||||
[ref val] => self.inverse() * rhs;
|
||||
[val ref] => self.inverse() * rhs;
|
||||
[ref ref] => self.inverse() * rhs;
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
);
|
||||
|
||||
// Transform ÷ UnitQuaternion
|
||||
|
@ -326,10 +327,10 @@ md_impl_all!(
|
|||
Div, div where N: RealField;
|
||||
(U4, U4), (U4, U1) for C: TCategoryMul<TAffine>;
|
||||
self: Transform<N, U3, C>, rhs: UnitQuaternion<N>, Output = Transform<N, U3, C::Representative>;
|
||||
[val val] => self * rhs.inverse();
|
||||
[ref val] => self * rhs.inverse();
|
||||
[val ref] => self * rhs.inverse();
|
||||
[ref ref] => self * rhs.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
);
|
||||
|
||||
// UnitQuaternion ÷ Transform
|
||||
|
@ -337,10 +338,10 @@ md_impl_all!(
|
|||
Div, div where N: RealField;
|
||||
(U4, U1), (U4, U4) for C: TCategoryMul<TAffine>;
|
||||
self: UnitQuaternion<N>, rhs: Transform<N, U3, C>, Output = Transform<N, U3, C::Representative>;
|
||||
[val val] => self.inverse() * rhs;
|
||||
[ref val] => self.inverse() * rhs;
|
||||
[val ref] => self.inverse() * rhs;
|
||||
[ref ref] => self.inverse() * rhs;
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
);
|
||||
|
||||
// // Transform ÷ Isometry
|
||||
|
@ -402,10 +403,10 @@ md_impl_all!(
|
|||
Div, div where N: RealField;
|
||||
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1) for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>;
|
||||
self: Transform<N, D, C>, rhs: Translation<N, D>, Output = Transform<N, D, C::Representative>;
|
||||
[val val] => self * rhs.inverse();
|
||||
[ref val] => self * rhs.inverse();
|
||||
[val ref] => self * rhs.inverse();
|
||||
[ref ref] => self * rhs.inverse();
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * rhs.inverse() };
|
||||
);
|
||||
|
||||
// Translation ÷ Transform
|
||||
|
@ -414,10 +415,10 @@ md_impl_all!(
|
|||
(D, U1), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
||||
for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>;
|
||||
self: Translation<N, D>, rhs: Transform<N, D, C>, Output = Transform<N, D, C::Representative>;
|
||||
[val val] => self.inverse() * rhs;
|
||||
[ref val] => self.inverse() * rhs;
|
||||
[val ref] => self.inverse() * rhs;
|
||||
[ref ref] => self.inverse() * rhs;
|
||||
[val val] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[ref val] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[val ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self.inverse() * rhs };
|
||||
);
|
||||
|
||||
// Transform ×= Transform
|
||||
|
|
|
@ -13,44 +13,50 @@ use crate::geometry::{Point, Translation};
|
|||
add_sub_impl!(Mul, mul, ClosedAdd;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: &'a Translation<N, D>, right: &'b Translation<N, D>, Output = Translation<N, D>;
|
||||
Translation::from(&self.vector + &right.vector); 'a, 'b);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector + &right.vector) };
|
||||
'a, 'b);
|
||||
|
||||
add_sub_impl!(Mul, mul, ClosedAdd;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: &'a Translation<N, D>, right: Translation<N, D>, Output = Translation<N, D>;
|
||||
Translation::from(&self.vector + right.vector); 'a);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector + right.vector) };
|
||||
'a);
|
||||
|
||||
add_sub_impl!(Mul, mul, ClosedAdd;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: Translation<N, D>, right: &'b Translation<N, D>, Output = Translation<N, D>;
|
||||
Translation::from(self.vector + &right.vector); 'b);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector + &right.vector) };
|
||||
'b);
|
||||
|
||||
add_sub_impl!(Mul, mul, ClosedAdd;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: Translation<N, D>, right: Translation<N, D>, Output = Translation<N, D>;
|
||||
Translation::from(self.vector + right.vector); );
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector + right.vector) }; );
|
||||
|
||||
// Translation ÷ Translation
|
||||
// FIXME: instead of calling inverse explicitly, could we just add a `mul_tr` or `mul_inv` method?
|
||||
add_sub_impl!(Div, div, ClosedSub;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: &'a Translation<N, D>, right: &'b Translation<N, D>, Output = Translation<N, D>;
|
||||
Translation::from(&self.vector - &right.vector); 'a, 'b);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector - &right.vector) };
|
||||
'a, 'b);
|
||||
|
||||
add_sub_impl!(Div, div, ClosedSub;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: &'a Translation<N, D>, right: Translation<N, D>, Output = Translation<N, D>;
|
||||
Translation::from(&self.vector - right.vector); 'a);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector - right.vector) };
|
||||
'a);
|
||||
|
||||
add_sub_impl!(Div, div, ClosedSub;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: Translation<N, D>, right: &'b Translation<N, D>, Output = Translation<N, D>;
|
||||
Translation::from(self.vector - &right.vector); 'b);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector - &right.vector) };
|
||||
'b);
|
||||
|
||||
add_sub_impl!(Div, div, ClosedSub;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: Translation<N, D>, right: Translation<N, D>, Output = Translation<N, D>;
|
||||
Translation::from(self.vector - right.vector); );
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector - right.vector) }; );
|
||||
|
||||
// Translation × Point
|
||||
// FIXME: we don't handle properly non-zero origins here. Do we want this to be the intended
|
||||
|
@ -58,107 +64,45 @@ add_sub_impl!(Div, div, ClosedSub;
|
|||
add_sub_impl!(Mul, mul, ClosedAdd;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: &'a Translation<N, D>, right: &'b Point<N, D>, Output = Point<N, D>;
|
||||
right + &self.vector; 'a, 'b);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { right + &self.vector };
|
||||
'a, 'b);
|
||||
|
||||
add_sub_impl!(Mul, mul, ClosedAdd;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: &'a Translation<N, D>, right: Point<N, D>, Output = Point<N, D>;
|
||||
right + &self.vector; 'a);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { right + &self.vector };
|
||||
'a);
|
||||
|
||||
add_sub_impl!(Mul, mul, ClosedAdd;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: Translation<N, D>, right: &'b Point<N, D>, Output = Point<N, D>;
|
||||
right + self.vector; 'b);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { right + self.vector };
|
||||
'b);
|
||||
|
||||
add_sub_impl!(Mul, mul, ClosedAdd;
|
||||
(D, U1), (D, U1) -> (D) for D: DimName;
|
||||
self: Translation<N, D>, right: Point<N, D>, Output = Point<N, D>;
|
||||
right + self.vector; );
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { right + self.vector }; );
|
||||
|
||||
// Translation *= Translation
|
||||
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd;
|
||||
(D, U1), (D, U1) for D: DimName;
|
||||
self: Translation<N, D>, right: &'b Translation<N, D>;
|
||||
self.vector += &right.vector; 'b);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { self.vector += &right.vector };
|
||||
'b);
|
||||
|
||||
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd;
|
||||
(D, U1), (D, U1) for D: DimName;
|
||||
self: Translation<N, D>, right: Translation<N, D>;
|
||||
self.vector += right.vector; );
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { self.vector += right.vector }; );
|
||||
|
||||
add_sub_assign_impl!(DivAssign, div_assign, ClosedSub;
|
||||
(D, U1), (D, U1) for D: DimName;
|
||||
self: Translation<N, D>, right: &'b Translation<N, D>;
|
||||
self.vector -= &right.vector; 'b);
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { self.vector -= &right.vector };
|
||||
'b);
|
||||
|
||||
add_sub_assign_impl!(DivAssign, div_assign, ClosedSub;
|
||||
(D, U1), (D, U1) for D: DimName;
|
||||
self: Translation<N, D>, right: Translation<N, D>;
|
||||
self.vector -= right.vector; );
|
||||
|
||||
/*
|
||||
// Translation × Matrix
|
||||
add_sub_impl!(Mul, mul;
|
||||
(D1, D1), (R2, C2) for D1, R2, C2;
|
||||
self: &'a Translation<N, D1>, right: &'b Matrix<N, R2, C2>, Output = MatrixMN<N, D1, C2>;
|
||||
self.vector() * right; 'a, 'b);
|
||||
|
||||
add_sub_impl!(Mul, mul;
|
||||
(D1, D1), (R2, C2) for D1, R2, C2;
|
||||
self: &'a Translation<N, D1>, right: Matrix<N, R2, C2>, Output = MatrixMN<N, D1, C2>;
|
||||
self.vector() * right; 'a);
|
||||
|
||||
add_sub_impl!(Mul, mul;
|
||||
(D1, D1), (R2, C2) for D1, R2, C2;
|
||||
self: Translation<N, D1>, right: &'b Matrix<N, R2, C2>, Output = MatrixMN<N, D1, C2>;
|
||||
self.unwrap() * right; 'b);
|
||||
|
||||
add_sub_impl!(Mul, mul;
|
||||
(D1, D1), (R2, C2) for D1, R2, C2;
|
||||
self: Translation<N, D1>, right: Matrix<N, R2, C2>, Output = MatrixMN<N, D1, C2>;
|
||||
self.unwrap() * right; );
|
||||
|
||||
// Matrix × Translation
|
||||
add_sub_impl!(Mul, mul;
|
||||
(R1, C1), (D2, D2) for R1, C1, D2;
|
||||
self: &'a Matrix<N, R1, C1>, right: &'b Translation<N, D2>, Output = MatrixMN<N, R1, D2>;
|
||||
self * right.vector(); 'a, 'b);
|
||||
|
||||
add_sub_impl!(Mul, mul;
|
||||
(R1, C1), (D2, D2) for R1, C1, D2;
|
||||
self: &'a Matrix<N, R1, C1>, right: Translation<N, D2>, Output = MatrixMN<N, R1, D2>;
|
||||
self * right.unwrap(); 'a);
|
||||
|
||||
add_sub_impl!(Mul, mul;
|
||||
(R1, C1), (D2, D2) for R1, C1, D2;
|
||||
self: Matrix<N, R1, C1>, right: &'b Translation<N, D2>, Output = MatrixMN<N, R1, D2>;
|
||||
self * right.vector(); 'b);
|
||||
|
||||
|
||||
add_sub_impl!(Mul, mul;
|
||||
(R1, C1), (D2, D2) for R1, C1, D2;
|
||||
self: Matrix<N, R1, C1>, right: Translation<N, D2>, Output = MatrixMN<N, R1, D2>;
|
||||
self * right.unwrap(); );
|
||||
|
||||
// Matrix *= Translation
|
||||
md_assign_impl!(MulAssign, mul_assign;
|
||||
(R1, C1), (C1, C1) for R1, C1;
|
||||
self: Matrix<N, R1, C1>, right: &'b Translation<N, C1>;
|
||||
self.mul_assign(right.vector()); 'b);
|
||||
|
||||
md_assign_impl!(MulAssign, mul_assign;
|
||||
(R1, C1), (C1, C1) for R1, C1;
|
||||
self: Matrix<N, R1, C1>, right: Translation<N, C1>;
|
||||
self.mul_assign(right.unwrap()); );
|
||||
|
||||
|
||||
md_assign_impl!(DivAssign, div_assign;
|
||||
(R1, C1), (C1, C1) for R1, C1;
|
||||
self: Matrix<N, R1, C1>, right: &'b Translation<N, C1>;
|
||||
self.mul_assign(right.inverse().vector()); 'b);
|
||||
|
||||
md_assign_impl!(DivAssign, div_assign;
|
||||
(R1, C1), (C1, C1) for R1, C1;
|
||||
self: Matrix<N, R1, C1>, right: Translation<N, C1>;
|
||||
self.mul_assign(right.inverse().unwrap()); );
|
||||
*/
|
||||
#[allow(clippy::suspicious_arithmetic_impl)] { self.vector -= right.vector }; );
|
||||
|
|
|
@ -96,6 +96,7 @@ where
|
|||
|
||||
#[inline]
|
||||
fn div(self, rhs: Self) -> Self::Output {
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
Unit::new_unchecked(self.into_inner() * rhs.conjugate().into_inner())
|
||||
}
|
||||
}
|
||||
|
@ -108,6 +109,7 @@ where
|
|||
|
||||
#[inline]
|
||||
fn div(self, rhs: UnitComplex<N>) -> Self::Output {
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
Unit::new_unchecked(self.complex() * rhs.conjugate().into_inner())
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +122,7 @@ where
|
|||
|
||||
#[inline]
|
||||
fn div(self, rhs: &'b UnitComplex<N>) -> Self::Output {
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
Unit::new_unchecked(self.into_inner() * rhs.conjugate().into_inner())
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +135,7 @@ where
|
|||
|
||||
#[inline]
|
||||
fn div(self, rhs: &'b UnitComplex<N>) -> Self::Output {
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
Unit::new_unchecked(self.complex() * rhs.conjugate().into_inner())
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +210,7 @@ complex_op_impl_all!(
|
|||
[val val] => &self / &rhs;
|
||||
[ref val] => self / &rhs;
|
||||
[val ref] => &self / rhs;
|
||||
[ref ref] => self * UnitComplex::from_rotation_matrix(rhs).inverse();
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * UnitComplex::from_rotation_matrix(rhs).inverse() };
|
||||
);
|
||||
|
||||
// Rotation × UnitComplex
|
||||
|
@ -228,7 +232,7 @@ complex_op_impl_all!(
|
|||
[val val] => &self / &rhs;
|
||||
[ref val] => self / &rhs;
|
||||
[val ref] => &self / rhs;
|
||||
[ref ref] => UnitComplex::from_rotation_matrix(self) * rhs.inverse();
|
||||
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { UnitComplex::from_rotation_matrix(self) * rhs.inverse() };
|
||||
);
|
||||
|
||||
// UnitComplex × Point
|
||||
|
|
Loading…
Reference in New Issue