2018-02-02 19:26:35 +08:00
|
|
|
|
use num::{One, Zero};
|
|
|
|
|
use std::ops::{Div, DivAssign, Index, IndexMut, Mul, MulAssign};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
2018-02-02 19:26:35 +08:00
|
|
|
|
use alga::general::{ClosedAdd, ClosedMul, Real, SubsetOf};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
2019-03-23 21:29:07 +08:00
|
|
|
|
use crate::base::allocator::Allocator;
|
|
|
|
|
use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U3, U4};
|
|
|
|
|
use crate::base::{DefaultAllocator, MatrixN, Scalar, VectorN};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
2019-03-23 21:29:07 +08:00
|
|
|
|
use crate::geometry::{
|
2018-10-22 13:00:10 +08:00
|
|
|
|
Isometry, Point, Rotation, Similarity, SubTCategoryOf, SuperTCategoryOf, TAffine, TCategory,
|
|
|
|
|
TCategoryMul, TGeneral, TProjective, Transform, Translation, UnitQuaternion,
|
|
|
|
|
};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
2017-02-13 01:17:09 +08:00
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* In the following, we provide:
|
|
|
|
|
* =========================
|
|
|
|
|
*
|
|
|
|
|
* Index<(usize, usize)>
|
|
|
|
|
* IndexMut<(usize, usize)> (where TCategory == TGeneral)
|
|
|
|
|
*
|
|
|
|
|
* (Operators)
|
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* Transform × Isometry
|
|
|
|
|
* Transform × Rotation
|
|
|
|
|
* Transform × Similarity
|
|
|
|
|
* Transform × Transform
|
|
|
|
|
* Transform × UnitQuaternion
|
|
|
|
|
* FIXME: Transform × UnitComplex
|
|
|
|
|
* Transform × Translation
|
|
|
|
|
* Transform × Vector
|
|
|
|
|
* Transform × Point
|
2017-02-13 01:17:09 +08:00
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* Isometry × Transform
|
|
|
|
|
* Rotation × Transform
|
|
|
|
|
* Similarity × Transform
|
|
|
|
|
* Translation × Transform
|
|
|
|
|
* UnitQuaternion × Transform
|
|
|
|
|
* FIXME: UnitComplex × Transform
|
2017-02-13 01:17:09 +08:00
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* FIXME: Transform ÷ Isometry
|
|
|
|
|
* Transform ÷ Rotation
|
|
|
|
|
* FIXME: Transform ÷ Similarity
|
|
|
|
|
* Transform ÷ Transform
|
|
|
|
|
* Transform ÷ UnitQuaternion
|
|
|
|
|
* Transform ÷ Translation
|
2017-02-13 01:17:09 +08:00
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* FIXME: Isometry ÷ Transform
|
|
|
|
|
* Rotation ÷ Transform
|
|
|
|
|
* FIXME: Similarity ÷ Transform
|
|
|
|
|
* Translation ÷ Transform
|
|
|
|
|
* UnitQuaternion ÷ Transform
|
|
|
|
|
* FIXME: UnitComplex ÷ Transform
|
2017-02-13 01:17:09 +08:00
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* (Assignment Operators)
|
|
|
|
|
*
|
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* Transform ×= Transform
|
|
|
|
|
* Transform ×= Similarity
|
|
|
|
|
* Transform ×= Isometry
|
|
|
|
|
* Transform ×= Rotation
|
|
|
|
|
* Transform ×= UnitQuaternion
|
|
|
|
|
* FIXME: Transform ×= UnitComplex
|
|
|
|
|
* Transform ×= Translation
|
2017-02-13 01:17:09 +08:00
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* Transform ÷= Transform
|
|
|
|
|
* FIXME: Transform ÷= Similarity
|
|
|
|
|
* FIXME: Transform ÷= Isometry
|
|
|
|
|
* Transform ÷= Rotation
|
|
|
|
|
* Transform ÷= UnitQuaternion
|
|
|
|
|
* FIXME: Transform ÷= UnitComplex
|
2017-02-13 01:17:09 +08:00
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2016-12-05 05:44:42 +08:00
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* Indexing.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2017-08-03 01:37:44 +08:00
|
|
|
|
impl<N: Real, D, C: TCategory> Index<(usize, usize)> for Transform<N, D, C>
|
2018-02-02 19:26:35 +08:00
|
|
|
|
where
|
|
|
|
|
D: DimName + DimNameAdd<U1>,
|
|
|
|
|
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
|
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
type Output = N;
|
|
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
|
fn index(&self, ij: (usize, usize)) -> &N {
|
|
|
|
|
self.matrix().index(ij)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Only general transformations are mutably indexable.
|
2017-08-03 01:37:44 +08:00
|
|
|
|
impl<N: Real, D> IndexMut<(usize, usize)> for Transform<N, D, TGeneral>
|
2018-02-02 19:26:35 +08:00
|
|
|
|
where
|
|
|
|
|
D: DimName + DimNameAdd<U1>,
|
|
|
|
|
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
|
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
|
|
|
|
fn index_mut(&mut self, ij: (usize, usize)) -> &mut N {
|
|
|
|
|
self.matrix_mut().index_mut(ij)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform × Vector
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Mul, mul where N: Real;
|
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1) for D: DimNameAdd<U1>, C: TCategory;
|
|
|
|
|
self: Transform<N, D, C>, rhs: VectorN<N, D>, Output = VectorN<N, D>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
|
|
|
|
[ref ref] => {
|
|
|
|
|
let transform = self.matrix().fixed_slice::<D, D>(0, 0);
|
|
|
|
|
|
|
|
|
|
if C::has_normalizer() {
|
|
|
|
|
let normalizer = self.matrix().fixed_slice::<U1, D>(D::dim(), 0);
|
|
|
|
|
let n = normalizer.tr_dot(&rhs);
|
|
|
|
|
|
|
|
|
|
if !n.is_zero() {
|
|
|
|
|
return transform * (rhs / n);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
transform * rhs
|
|
|
|
|
};
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform × Point
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Mul, mul where N: Real;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1) for D: DimNameAdd<U1>, C: TCategory
|
2017-08-03 01:37:44 +08:00
|
|
|
|
where DefaultAllocator: Allocator<N, D, D>;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Point<N, D>, Output = Point<N, D>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
|
|
|
|
[ref ref] => {
|
|
|
|
|
let transform = self.matrix().fixed_slice::<D, D>(0, 0);
|
|
|
|
|
let translation = self.matrix().fixed_slice::<D, U1>(0, D::dim());
|
|
|
|
|
|
|
|
|
|
if C::has_normalizer() {
|
|
|
|
|
let normalizer = self.matrix().fixed_slice::<U1, D>(D::dim(), 0);
|
2018-12-03 04:00:08 +08:00
|
|
|
|
let n = normalizer.tr_dot(&rhs.coords) + unsafe { *self.matrix().get_unchecked((D::dim(), D::dim())) };
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
if !n.is_zero() {
|
2018-09-21 02:01:48 +08:00
|
|
|
|
return (transform * rhs + translation) / n;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
transform * rhs + translation
|
|
|
|
|
};
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform × Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Mul, mul where N: Real;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>) for D: DimNameAdd<U1>, CA: TCategoryMul<CB>, CB: TCategory;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>, Output = Transform<N, D, CA::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.into_inner());
|
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.into_inner());
|
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.matrix());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.matrix());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform × Rotation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Mul, mul where N: Real;
|
|
|
|
|
(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>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Rotation × Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Mul, mul where N: Real;
|
|
|
|
|
(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>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform × UnitQuaternion
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Mul, mul where N: Real;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
(U4, U4), (U4, U1) for C: TCategoryMul<TAffine>;
|
|
|
|
|
self: Transform<N, U3, C>, rhs: UnitQuaternion<N>, Output = Transform<N, U3, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitQuaternion × Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Mul, mul where N: Real;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
(U4, U1), (U4, U4) for C: TCategoryMul<TAffine>;
|
|
|
|
|
self: UnitQuaternion<N>, rhs: Transform<N, U3, C>, Output = Transform<N, U3, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform × Isometry
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Mul, mul where N: Real;
|
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Isometry<N, D, R>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Isometry × Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Mul, mul where N: Real;
|
|
|
|
|
(D, U1), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >;
|
|
|
|
|
self: Isometry<N, D, R>, rhs: Transform<N, D, C>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform × Similarity
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Mul, mul where N: Real;
|
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Similarity<N, D, R>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Similarity × Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Mul, mul where N: Real;
|
|
|
|
|
(D, U1), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >;
|
|
|
|
|
self: Similarity<N, D, R>, rhs: Transform<N, D, C>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* FIXME: don't explicitly build the homogeneous translation matrix.
|
|
|
|
|
* Directly apply the translation, just as in `Matrix::{append,prepend}_translation`. This has not
|
|
|
|
|
* been done yet because of the `DimNameDiff` requirement (which is not automatically deduced from
|
|
|
|
|
* `DimNameAdd` requirement).
|
|
|
|
|
*
|
|
|
|
|
*/
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform × Translation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Mul, mul where N: Real;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
(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>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Translation × Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Mul, mul where N: Real;
|
|
|
|
|
(D, U1), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>;
|
|
|
|
|
self: Translation<N, D>, rhs: Transform<N, D, C>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
|
|
|
|
[ref val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
[ref ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ÷ Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Div, div where N: Real;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>) for D: DimNameAdd<U1>, CA: TCategoryMul<CB>, CB: SubTCategoryOf<TProjective>;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>, Output = Transform<N, D, CA::Representative>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => self * rhs.inverse();
|
|
|
|
|
[ref val] => self * rhs.inverse();
|
2017-08-14 01:53:02 +08:00
|
|
|
|
[val ref] => self * rhs.clone().inverse();
|
|
|
|
|
[ref ref] => self * rhs.clone().inverse();
|
2016-12-05 05:44:42 +08:00
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ÷ Rotation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Div, div where N: Real;
|
|
|
|
|
(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>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => self * rhs.inverse();
|
|
|
|
|
[ref val] => self * rhs.inverse();
|
|
|
|
|
[val ref] => self * rhs.inverse();
|
|
|
|
|
[ref ref] => self * rhs.inverse();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Rotation ÷ Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Div, div where N: Real;
|
|
|
|
|
(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>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => self.inverse() * rhs;
|
|
|
|
|
[ref val] => self.inverse() * rhs;
|
|
|
|
|
[val ref] => self.inverse() * rhs;
|
|
|
|
|
[ref ref] => self.inverse() * rhs;
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ÷ UnitQuaternion
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Div, div where N: Real;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
(U4, U4), (U4, U1) for C: TCategoryMul<TAffine>;
|
|
|
|
|
self: Transform<N, U3, C>, rhs: UnitQuaternion<N>, Output = Transform<N, U3, C::Representative>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => self * rhs.inverse();
|
|
|
|
|
[ref val] => self * rhs.inverse();
|
|
|
|
|
[val ref] => self * rhs.inverse();
|
|
|
|
|
[ref ref] => self * rhs.inverse();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitQuaternion ÷ Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Div, div where N: Real;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
(U4, U1), (U4, U4) for C: TCategoryMul<TAffine>;
|
|
|
|
|
self: UnitQuaternion<N>, rhs: Transform<N, U3, C>, Output = Transform<N, U3, C::Representative>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => self.inverse() * rhs;
|
|
|
|
|
[ref val] => self.inverse() * rhs;
|
|
|
|
|
[val ref] => self.inverse() * rhs;
|
|
|
|
|
[ref ref] => self.inverse() * rhs;
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// // Transform ÷ Isometry
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// md_impl_all!(
|
|
|
|
|
// Div, div where N: Real;
|
|
|
|
|
// (DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// where SB::Alloc: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1> >;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// self: Transform<N, D, C>, rhs: Isometry<N, D, R>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
// [val val] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.inverse().to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// [ref val] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.inverse().to_homogeneous());
|
2018-12-10 04:24:08 +08:00
|
|
|
|
// [val ref] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.inverse().to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// [ref ref] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.inverse().to_homogeneous());
|
|
|
|
|
// );
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// // Isometry ÷ Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// md_impl_all!(
|
|
|
|
|
// Div, div where N: Real;
|
|
|
|
|
// (D, U1), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// where SA::Alloc: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1> >;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// self: Isometry<N, D, R>, rhs: Transform<N, D, C>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
// [val val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
|
|
|
|
// [ref val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// [val ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
// [ref ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
// );
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// // Transform ÷ Similarity
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// md_impl_all!(
|
|
|
|
|
// Div, div where N: Real;
|
|
|
|
|
// (DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// where SB::Alloc: Allocator<N, D, D >
|
|
|
|
|
// where SB::Alloc: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1> >;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// self: Transform<N, D, C>, rhs: Similarity<N, D, R>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
// [val val] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// [ref val] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
2018-12-10 04:24:08 +08:00
|
|
|
|
// [val ref] => Self::Output::from_matrix_unchecked(self.into_inner() * rhs.to_homogeneous());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// [ref ref] => Self::Output::from_matrix_unchecked(self.matrix() * rhs.to_homogeneous());
|
|
|
|
|
// );
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// // Similarity ÷ Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// md_impl_all!(
|
|
|
|
|
// Div, div where N: Real;
|
|
|
|
|
// (D, U1), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// where SA::Alloc: Allocator<N, D, D >
|
|
|
|
|
// where SA::Alloc: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1> >;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// self: Similarity<N, D, R>, rhs: Transform<N, D, C>, Output = Transform<N, D, C::Representative>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
// [val val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
|
|
|
|
// [ref val] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.into_inner());
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// [val ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
// [ref ref] => Self::Output::from_matrix_unchecked(self.to_homogeneous() * rhs.matrix());
|
|
|
|
|
// );
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ÷ Translation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Div, div where N: Real;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
(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>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => self * rhs.inverse();
|
|
|
|
|
[ref val] => self * rhs.inverse();
|
|
|
|
|
[val ref] => self * rhs.inverse();
|
|
|
|
|
[ref ref] => self * rhs.inverse();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Translation ÷ Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_impl_all!(
|
|
|
|
|
Div, div where N: Real;
|
|
|
|
|
(D, U1), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
for D: DimNameAdd<U1>, C: TCategoryMul<TAffine>;
|
|
|
|
|
self: Translation<N, D>, rhs: Transform<N, D, C>, Output = Transform<N, D, C::Representative>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => self.inverse() * rhs;
|
|
|
|
|
[ref val] => self.inverse() * rhs;
|
|
|
|
|
[val ref] => self.inverse() * rhs;
|
|
|
|
|
[ref ref] => self.inverse() * rhs;
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ×= Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
MulAssign, mul_assign where N: Real;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>) for D: DimNameAdd<U1>, CA: TCategory, CB: SubTCategoryOf<CA>;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>;
|
2018-12-10 04:24:08 +08:00
|
|
|
|
[val] => *self.matrix_mut_unchecked() *= rhs.into_inner();
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[ref] => *self.matrix_mut_unchecked() *= rhs.matrix();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ×= Similarity
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
MulAssign, mul_assign where N: Real;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
for D: DimNameAdd<U1>, C: TCategory, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Similarity<N, D, R>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
[ref] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ×= Isometry
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
MulAssign, mul_assign where N: Real;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
for D: DimNameAdd<U1>, C: TCategory, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Isometry<N, D, R>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
[ref] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* FIXME: don't explicitly build the homogeneous translation matrix.
|
|
|
|
|
* Directly apply the translation, just as in `Matrix::{append,prepend}_translation`. This has not
|
|
|
|
|
* been done yet because of the `DimNameDiff` requirement (which is not automatically deduced from
|
|
|
|
|
* `DimNameAdd` requirement).
|
|
|
|
|
*
|
|
|
|
|
*/
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ×= Translation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
MulAssign, mul_assign where N: Real;
|
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1) for D: DimNameAdd<U1>, C: TCategory;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Translation<N, D>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
[ref] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ×= Rotation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
MulAssign, mul_assign where N: Real;
|
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, D) for D: DimNameAdd<U1>, C: TCategory;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Rotation<N, D>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
[ref] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ×= UnitQuaternion
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
|
|
|
|
MulAssign, mul_assign where N: Real;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
(U4, U4), (U4, U1) for C: TCategory;
|
|
|
|
|
self: Transform<N, U3, C>, rhs: UnitQuaternion<N>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
[ref] => *self.matrix_mut_unchecked() *= rhs.to_homogeneous();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ÷= Transform
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
DivAssign, div_assign where N: Real;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (DimNameSum<D, U1>, DimNameSum<D, U1>)
|
|
|
|
|
for D: DimNameAdd<U1>, CA: SuperTCategoryOf<CB>, CB: SubTCategoryOf<TProjective>;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
self: Transform<N, D, CA>, rhs: Transform<N, D, CB>;
|
2017-08-14 01:53:02 +08:00
|
|
|
|
[val] => *self *= rhs.inverse();
|
|
|
|
|
[ref] => *self *= rhs.clone().inverse();
|
2016-12-05 05:44:42 +08:00
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// // Transform ÷= Similarity
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// md_assign_impl_all!(
|
|
|
|
|
// DivAssign, div_assign;
|
|
|
|
|
// (DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// for D: DimNameAdd<U1>, C: TCategory, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >;
|
|
|
|
|
// self: Transform<N, D, C>, rhs: Similarity<N, D, R>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// [val] => *self *= rhs.inverse();
|
|
|
|
|
// [ref] => *self *= rhs.inverse();
|
|
|
|
|
// );
|
2018-02-02 19:26:35 +08:00
|
|
|
|
//
|
|
|
|
|
//
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// // Transform ÷= Isometry
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// md_assign_impl_all!(
|
|
|
|
|
// DivAssign, div_assign;
|
|
|
|
|
// (DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1)
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// for D: DimNameAdd<U1>, C: TCategory, R: SubsetOf<MatrixN<N, DimNameSum<D, U1>> >;
|
|
|
|
|
// self: Transform<N, D, C>, rhs: Isometry<N, D, R>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// [val] => *self *= rhs.inverse();
|
|
|
|
|
// [ref] => *self *= rhs.inverse();
|
|
|
|
|
// );
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ÷= Translation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
DivAssign, div_assign where N: Real;
|
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, U1) for D: DimNameAdd<U1>, C: TCategory;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Translation<N, D>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val] => *self *= rhs.inverse();
|
|
|
|
|
[ref] => *self *= rhs.inverse();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ÷= Rotation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
2017-08-03 01:37:44 +08:00
|
|
|
|
DivAssign, div_assign where N: Real;
|
|
|
|
|
(DimNameSum<D, U1>, DimNameSum<D, U1>), (D, D) for D: DimNameAdd<U1>, C: TCategory;
|
|
|
|
|
self: Transform<N, D, C>, rhs: Rotation<N, D>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val] => *self *= rhs.inverse();
|
|
|
|
|
[ref] => *self *= rhs.inverse();
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Transform ÷= UnitQuaternion
|
2016-12-05 05:44:42 +08:00
|
|
|
|
md_assign_impl_all!(
|
|
|
|
|
DivAssign, div_assign where N: Real;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
(U4, U4), (U4, U1) for C: TCategory;
|
|
|
|
|
self: Transform<N, U3, C>, rhs: UnitQuaternion<N>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val] => *self *= rhs.inverse();
|
|
|
|
|
[ref] => *self *= rhs.inverse();
|
|
|
|
|
);
|