2021-06-18 15:45:37 +08:00
|
|
|
|
// The macros break if the references are taken out, for some reason.
|
|
|
|
|
#![allow(clippy::op_ref)]
|
|
|
|
|
|
2018-02-02 19:26:35 +08:00
|
|
|
|
use std::ops::{Div, DivAssign, Mul, MulAssign};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
2019-03-23 21:29:07 +08:00
|
|
|
|
use crate::base::storage::Storage;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
use crate::base::{Const, Unit, Vector, Vector2};
|
2019-03-23 21:29:07 +08:00
|
|
|
|
use crate::geometry::{Isometry, Point2, Rotation, Similarity, Translation, UnitComplex};
|
2020-03-22 06:22:55 +08:00
|
|
|
|
use simba::simd::SimdRealField;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This file provides:
|
|
|
|
|
* ===================
|
|
|
|
|
*
|
|
|
|
|
* UnitComplex × UnitComplex
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* UnitComplex × Rotation -> UnitComplex
|
|
|
|
|
* Rotation × UnitComplex -> UnitComplex
|
2016-12-05 05:44:42 +08:00
|
|
|
|
*
|
|
|
|
|
* UnitComplex ÷ UnitComplex
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* UnitComplex ÷ Rotation -> UnitComplex
|
|
|
|
|
* Rotation ÷ UnitComplex -> UnitComplex
|
2016-12-05 05:44:42 +08:00
|
|
|
|
*
|
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* UnitComplex × Point
|
|
|
|
|
* UnitComplex × Vector
|
2016-12-05 05:44:42 +08:00
|
|
|
|
* UnitComplex × Unit<T>
|
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* UnitComplex × Isometry<UnitComplex>
|
|
|
|
|
* UnitComplex × Similarity<UnitComplex>
|
|
|
|
|
* UnitComplex × Translation -> Isometry<UnitComplex>
|
2016-12-05 05:44:42 +08:00
|
|
|
|
*
|
|
|
|
|
* (Assignment Operators)
|
|
|
|
|
*
|
|
|
|
|
* UnitComplex ×= UnitComplex
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* UnitComplex ×= Rotation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
*
|
|
|
|
|
* UnitComplex ÷= UnitComplex
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* UnitComplex ÷= Rotation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
|
* Rotation ×= UnitComplex
|
|
|
|
|
* Rotation ÷= UnitComplex
|
2016-12-05 05:44:42 +08:00
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// UnitComplex × UnitComplex
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<T: SimdRealField> Mul<Self> for UnitComplex<T> {
|
2019-02-17 05:29:41 +08:00
|
|
|
|
type Output = Self;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
#[inline]
|
2019-02-17 05:29:41 +08:00
|
|
|
|
fn mul(self, rhs: Self) -> Self {
|
2018-12-10 04:08:14 +08:00
|
|
|
|
Unit::new_unchecked(self.into_inner() * rhs.into_inner())
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'a, T: SimdRealField> Mul<UnitComplex<T>> for &'a UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2021-04-11 17:00:38 +08:00
|
|
|
|
type Output = UnitComplex<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul(self, rhs: UnitComplex<T>) -> Self::Output {
|
2018-12-10 04:08:14 +08:00
|
|
|
|
Unit::new_unchecked(self.complex() * rhs.into_inner())
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'b, T: SimdRealField> Mul<&'b UnitComplex<T>> for UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2019-02-17 05:29:41 +08:00
|
|
|
|
type Output = Self;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul(self, rhs: &'b UnitComplex<T>) -> Self::Output {
|
2020-03-22 06:22:55 +08:00
|
|
|
|
Unit::new_unchecked(self.into_inner() * rhs.as_ref())
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'a, 'b, T: SimdRealField> Mul<&'b UnitComplex<T>> for &'a UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2021-04-11 17:00:38 +08:00
|
|
|
|
type Output = UnitComplex<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul(self, rhs: &'b UnitComplex<T>) -> Self::Output {
|
2020-03-22 06:22:55 +08:00
|
|
|
|
Unit::new_unchecked(self.complex() * rhs.as_ref())
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UnitComplex ÷ UnitComplex
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<T: SimdRealField> Div<Self> for UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2019-02-17 05:29:41 +08:00
|
|
|
|
type Output = Self;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
#[inline]
|
2019-02-17 05:29:41 +08:00
|
|
|
|
fn div(self, rhs: Self) -> Self::Output {
|
2020-10-26 01:23:24 +08:00
|
|
|
|
#[allow(clippy::suspicious_arithmetic_impl)]
|
2018-12-10 04:08:14 +08:00
|
|
|
|
Unit::new_unchecked(self.into_inner() * rhs.conjugate().into_inner())
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'a, T: SimdRealField> Div<UnitComplex<T>> for &'a UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2021-04-11 17:00:38 +08:00
|
|
|
|
type Output = UnitComplex<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div(self, rhs: UnitComplex<T>) -> Self::Output {
|
2020-10-26 01:23:24 +08:00
|
|
|
|
#[allow(clippy::suspicious_arithmetic_impl)]
|
2018-12-10 04:08:14 +08:00
|
|
|
|
Unit::new_unchecked(self.complex() * rhs.conjugate().into_inner())
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'b, T: SimdRealField> Div<&'b UnitComplex<T>> for UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2019-02-17 05:29:41 +08:00
|
|
|
|
type Output = Self;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div(self, rhs: &'b UnitComplex<T>) -> Self::Output {
|
2020-10-26 01:23:24 +08:00
|
|
|
|
#[allow(clippy::suspicious_arithmetic_impl)]
|
2018-12-10 04:08:14 +08:00
|
|
|
|
Unit::new_unchecked(self.into_inner() * rhs.conjugate().into_inner())
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'a, 'b, T: SimdRealField> Div<&'b UnitComplex<T>> for &'a UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2021-04-11 17:00:38 +08:00
|
|
|
|
type Output = UnitComplex<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div(self, rhs: &'b UnitComplex<T>) -> Self::Output {
|
2020-10-26 01:23:24 +08:00
|
|
|
|
#[allow(clippy::suspicious_arithmetic_impl)]
|
2018-12-10 04:08:14 +08:00
|
|
|
|
Unit::new_unchecked(self.complex() * rhs.conjugate().into_inner())
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
macro_rules! complex_op_impl(
|
|
|
|
|
($Op: ident, $op: ident;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
$($Storage: ident: $StoragesBound: ident $(<$($BoundParam: ty),*>)*),*;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
$lhs: ident: $Lhs: ty, $rhs: ident: $Rhs: ty, Output = $Result: ty;
|
|
|
|
|
$action: expr; $($lives: tt),*) => {
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<$($lives ,)* T: SimdRealField $(, $Storage: $StoragesBound $(<$($BoundParam),*>)*)*> $Op<$Rhs> for $Lhs
|
|
|
|
|
where T::Element: SimdRealField {
|
2016-12-05 05:44:42 +08:00
|
|
|
|
type Output = $Result;
|
|
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
|
fn $op($lhs, $rhs: $Rhs) -> Self::Output {
|
|
|
|
|
$action
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
macro_rules! complex_op_impl_all(
|
|
|
|
|
($Op: ident, $op: ident;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
$($Storage: ident: $StoragesBound: ident $(<$($BoundParam: ty),*>)*),*;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
$lhs: ident: $Lhs: ty, $rhs: ident: $Rhs: ty, Output = $Result: ty;
|
|
|
|
|
[val val] => $action_val_val: expr;
|
|
|
|
|
[ref val] => $action_ref_val: expr;
|
|
|
|
|
[val ref] => $action_val_ref: expr;
|
|
|
|
|
[ref ref] => $action_ref_ref: expr;) => {
|
|
|
|
|
|
|
|
|
|
complex_op_impl!($Op, $op;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
$($Storage: $StoragesBound $(<$($BoundParam),*>)*),*;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
$lhs: $Lhs, $rhs: $Rhs, Output = $Result;
|
|
|
|
|
$action_val_val; );
|
|
|
|
|
|
|
|
|
|
complex_op_impl!($Op, $op;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
$($Storage: $StoragesBound $(<$($BoundParam),*>)*),*;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
$lhs: &'a $Lhs, $rhs: $Rhs, Output = $Result;
|
|
|
|
|
$action_ref_val; 'a);
|
|
|
|
|
|
|
|
|
|
complex_op_impl!($Op, $op;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
$($Storage: $StoragesBound $(<$($BoundParam),*>)*),*;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
$lhs: $Lhs, $rhs: &'b $Rhs, Output = $Result;
|
|
|
|
|
$action_val_ref; 'b);
|
|
|
|
|
|
|
|
|
|
complex_op_impl!($Op, $op;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
$($Storage: $StoragesBound $(<$($BoundParam),*>)*),*;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
$lhs: &'a $Lhs, $rhs: &'b $Rhs, Output = $Result;
|
|
|
|
|
$action_ref_ref; 'a, 'b);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex × Rotation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: UnitComplex<T>, rhs: Rotation<T, 2>, Output = UnitComplex<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
|
|
|
|
[ref ref] => self * UnitComplex::from_rotation_matrix(rhs);
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex ÷ Rotation
|
2016-12-05 05:44:42 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Div, div;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: UnitComplex<T>, rhs: Rotation<T, 2>, Output = UnitComplex<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self / &rhs;
|
|
|
|
|
[ref val] => self / &rhs;
|
|
|
|
|
[val ref] => &self / rhs;
|
2020-10-26 01:23:24 +08:00
|
|
|
|
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { self * UnitComplex::from_rotation_matrix(rhs).inverse() };
|
2016-12-05 05:44:42 +08:00
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Rotation × UnitComplex
|
2016-12-05 05:44:42 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: Rotation<T, 2>, rhs: UnitComplex<T>, Output = UnitComplex<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
|
|
|
|
[ref ref] => UnitComplex::from_rotation_matrix(self) * rhs;
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Rotation ÷ UnitComplex
|
2016-12-05 05:44:42 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Div, div;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: Rotation<T, 2>, rhs: UnitComplex<T>, Output = UnitComplex<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self / &rhs;
|
|
|
|
|
[ref val] => self / &rhs;
|
|
|
|
|
[val ref] => &self / rhs;
|
2020-10-26 01:23:24 +08:00
|
|
|
|
[ref ref] => #[allow(clippy::suspicious_arithmetic_impl)] { UnitComplex::from_rotation_matrix(self) * rhs.inverse() };
|
2016-12-05 05:44:42 +08:00
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex × Point
|
2016-12-05 05:44:42 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: UnitComplex<T>, rhs: Point2<T>, Output = Point2<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
2018-10-24 02:47:42 +08:00
|
|
|
|
[ref ref] => Point2::from(self * &rhs.coords);
|
2016-12-05 05:44:42 +08:00
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex × Vector
|
2016-12-05 05:44:42 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
S: Storage<T, Const<2>>;
|
|
|
|
|
self: UnitComplex<T>, rhs: Vector<T, Const<2>, S>, Output = Vector2<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
|
|
|
|
[ref ref] => {
|
|
|
|
|
let i = self.as_ref().im;
|
|
|
|
|
let r = self.as_ref().re;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
Vector2::new(r * rhs[0] - i * rhs[1], i * rhs[0] + r * rhs[1])
|
2016-12-05 05:44:42 +08:00
|
|
|
|
};
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// UnitComplex × Unit<Vector>
|
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
S: Storage<T, Const<2>>;
|
|
|
|
|
self: UnitComplex<T>, rhs: Unit<Vector<T, Const<2>, S>>, Output = Unit<Vector2<T>>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
|
|
|
|
[ref ref] => Unit::new_unchecked(self * rhs.as_ref());
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex × Isometry<UnitComplex>
|
2017-02-13 01:17:09 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: UnitComplex<T>, rhs: Isometry<T, UnitComplex<T>, 2>,
|
|
|
|
|
Output = Isometry<T, UnitComplex<T>, 2>;
|
2017-02-13 01:17:09 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
|
|
|
|
[ref ref] => {
|
|
|
|
|
let shift = self * &rhs.translation.vector;
|
2018-10-28 14:33:39 +08:00
|
|
|
|
Isometry::from_parts(Translation::from(shift), self * &rhs.rotation)
|
2017-02-13 01:17:09 +08:00
|
|
|
|
};
|
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex × Similarity<UnitComplex>
|
2017-02-13 01:17:09 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: UnitComplex<T>, rhs: Similarity<T, UnitComplex<T>, 2>,
|
|
|
|
|
Output = Similarity<T, UnitComplex<T>, 2>;
|
2017-02-13 01:17:09 +08:00
|
|
|
|
[val val] => &self * &rhs;
|
|
|
|
|
[ref val] => self * &rhs;
|
|
|
|
|
[val ref] => &self * rhs;
|
2017-08-03 01:37:44 +08:00
|
|
|
|
[ref ref] => Similarity::from_isometry(self * &rhs.isometry, rhs.scaling());
|
2017-02-13 01:17:09 +08:00
|
|
|
|
);
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex × Translation
|
2017-02-13 01:17:09 +08:00
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: UnitComplex<T>, rhs: Translation<T, 2>,
|
|
|
|
|
Output = Isometry<T, UnitComplex<T>, 2>;
|
2018-10-28 14:33:39 +08:00
|
|
|
|
[val val] => Isometry::from_parts(Translation::from(&self * rhs.vector), self);
|
2020-11-19 19:55:15 +08:00
|
|
|
|
[ref val] => Isometry::from_parts(Translation::from( self * rhs.vector), *self);
|
2018-10-28 14:33:39 +08:00
|
|
|
|
[val ref] => Isometry::from_parts(Translation::from(&self * &rhs.vector), self);
|
2020-11-19 19:55:15 +08:00
|
|
|
|
[ref ref] => Isometry::from_parts(Translation::from( self * &rhs.vector), *self);
|
2017-02-13 01:17:09 +08:00
|
|
|
|
);
|
|
|
|
|
|
2018-04-27 13:52:41 +08:00
|
|
|
|
// Translation × UnitComplex
|
|
|
|
|
complex_op_impl_all!(
|
|
|
|
|
Mul, mul;
|
2021-04-08 17:53:01 +08:00
|
|
|
|
;
|
2021-04-11 17:00:38 +08:00
|
|
|
|
self: Translation<T, 2>, right: UnitComplex<T>,
|
|
|
|
|
Output = Isometry<T, UnitComplex<T>, 2>;
|
2021-06-18 15:45:37 +08:00
|
|
|
|
[val val] => Isometry::from_parts(self, right);
|
|
|
|
|
[ref val] => Isometry::from_parts(*self, right);
|
|
|
|
|
[val ref] => Isometry::from_parts(self, *right);
|
|
|
|
|
[ref ref] => Isometry::from_parts(*self, *right);
|
2018-04-27 13:52:41 +08:00
|
|
|
|
);
|
|
|
|
|
|
2016-12-05 05:44:42 +08:00
|
|
|
|
// UnitComplex ×= UnitComplex
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<T: SimdRealField> MulAssign<UnitComplex<T>> for UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul_assign(&mut self, rhs: UnitComplex<T>) {
|
2021-06-18 15:45:37 +08:00
|
|
|
|
*self = *self * rhs
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'b, T: SimdRealField> MulAssign<&'b UnitComplex<T>> for UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul_assign(&mut self, rhs: &'b UnitComplex<T>) {
|
2021-06-18 15:45:37 +08:00
|
|
|
|
*self = *self * rhs
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UnitComplex /= UnitComplex
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<T: SimdRealField> DivAssign<UnitComplex<T>> for UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div_assign(&mut self, rhs: UnitComplex<T>) {
|
2021-06-18 15:45:37 +08:00
|
|
|
|
*self = *self / rhs
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'b, T: SimdRealField> DivAssign<&'b UnitComplex<T>> for UnitComplex<T>
|
2020-04-05 23:15:43 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2020-03-22 06:22:55 +08:00
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div_assign(&mut self, rhs: &'b UnitComplex<T>) {
|
2021-06-18 15:45:37 +08:00
|
|
|
|
*self = *self / rhs
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex ×= Rotation
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<T: SimdRealField> MulAssign<Rotation<T, 2>> for UnitComplex<T>
|
2020-03-22 06:22:55 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2018-02-02 19:26:35 +08:00
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul_assign(&mut self, rhs: Rotation<T, 2>) {
|
2021-06-18 15:45:37 +08:00
|
|
|
|
*self = *self * rhs
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'b, T: SimdRealField> MulAssign<&'b Rotation<T, 2>> for UnitComplex<T>
|
2020-03-22 06:22:55 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2018-02-02 19:26:35 +08:00
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul_assign(&mut self, rhs: &'b Rotation<T, 2>) {
|
2021-06-18 15:45:37 +08:00
|
|
|
|
*self = *self * rhs
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// UnitComplex ÷= Rotation
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<T: SimdRealField> DivAssign<Rotation<T, 2>> for UnitComplex<T>
|
2020-03-22 06:22:55 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2018-02-02 19:26:35 +08:00
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div_assign(&mut self, rhs: Rotation<T, 2>) {
|
2021-06-18 15:45:37 +08:00
|
|
|
|
*self = *self / rhs
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'b, T: SimdRealField> DivAssign<&'b Rotation<T, 2>> for UnitComplex<T>
|
2020-03-22 06:22:55 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2018-02-02 19:26:35 +08:00
|
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div_assign(&mut self, rhs: &'b Rotation<T, 2>) {
|
2021-06-18 15:45:37 +08:00
|
|
|
|
*self = *self / rhs
|
2016-12-05 05:44:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-13 01:17:09 +08:00
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Rotation ×= UnitComplex
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<T: SimdRealField> MulAssign<UnitComplex<T>> for Rotation<T, 2>
|
2020-03-22 06:22:55 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2018-02-02 19:26:35 +08:00
|
|
|
|
{
|
2017-02-13 01:17:09 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul_assign(&mut self, rhs: UnitComplex<T>) {
|
2017-02-13 01:17:09 +08:00
|
|
|
|
self.mul_assign(rhs.to_rotation_matrix())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'b, T: SimdRealField> MulAssign<&'b UnitComplex<T>> for Rotation<T, 2>
|
2020-03-22 06:22:55 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2018-02-02 19:26:35 +08:00
|
|
|
|
{
|
2017-02-13 01:17:09 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn mul_assign(&mut self, rhs: &'b UnitComplex<T>) {
|
2017-02-13 01:17:09 +08:00
|
|
|
|
self.mul_assign(rhs.to_rotation_matrix())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
|
// Rotation ÷= UnitComplex
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<T: SimdRealField> DivAssign<UnitComplex<T>> for Rotation<T, 2>
|
2020-03-22 06:22:55 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2018-02-02 19:26:35 +08:00
|
|
|
|
{
|
2017-02-13 01:17:09 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div_assign(&mut self, rhs: UnitComplex<T>) {
|
2017-02-13 01:17:09 +08:00
|
|
|
|
self.div_assign(rhs.to_rotation_matrix())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
|
impl<'b, T: SimdRealField> DivAssign<&'b UnitComplex<T>> for Rotation<T, 2>
|
2020-03-22 06:22:55 +08:00
|
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
|
T::Element: SimdRealField,
|
2018-02-02 19:26:35 +08:00
|
|
|
|
{
|
2017-02-13 01:17:09 +08:00
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
|
fn div_assign(&mut self, rhs: &'b UnitComplex<T>) {
|
2017-02-13 01:17:09 +08:00
|
|
|
|
self.div_assign(rhs.to_rotation_matrix())
|
|
|
|
|
}
|
2020-03-21 19:16:46 +08:00
|
|
|
|
}
|