1use std::ops::{Div, DivAssign, Mul, MulAssign};
2
3use simba::scalar::{ClosedAddAssign, ClosedSubAssign};
4
5use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
6use crate::base::dimension::U1;
7use crate::base::{Const, Scalar};
8
9use crate::geometry::{Point, Translation};
10
11add_sub_impl!(Mul, mul, ClosedAddAssign;
13 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
14 const D; for; where;
15 self: &'a Translation<T, D>, right: &'b Translation<T, D>, Output = Translation<T, D>;
16 #[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector + &right.vector) };
17 'a, 'b);
18
19add_sub_impl!(Mul, mul, ClosedAddAssign;
20 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
21 const D; for; where;
22 self: &'a Translation<T, D>, right: Translation<T, D>, Output = Translation<T, D>;
23 #[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector + right.vector) };
24 'a);
25
26add_sub_impl!(Mul, mul, ClosedAddAssign;
27 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
28 const D; for; where;
29 self: Translation<T, D>, right: &'b Translation<T, D>, Output = Translation<T, D>;
30 #[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector + &right.vector) };
31 'b);
32
33add_sub_impl!(Mul, mul, ClosedAddAssign;
34 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
35 const D; for; where;
36 self: Translation<T, D>, right: Translation<T, D>, Output = Translation<T, D>;
37 #[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector + right.vector) }; );
38
39add_sub_impl!(Div, div, ClosedSubAssign;
42 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
43 const D; for; where;
44 self: &'a Translation<T, D>, right: &'b Translation<T, D>, Output = Translation<T, D>;
45 #[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector - &right.vector) };
46 'a, 'b);
47
48add_sub_impl!(Div, div, ClosedSubAssign;
49 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
50 const D; for; where;
51 self: &'a Translation<T, D>, right: Translation<T, D>, Output = Translation<T, D>;
52 #[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector - right.vector) };
53 'a);
54
55add_sub_impl!(Div, div, ClosedSubAssign;
56 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
57 const D; for; where;
58 self: Translation<T, D>, right: &'b Translation<T, D>, Output = Translation<T, D>;
59 #[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector - &right.vector) };
60 'b);
61
62add_sub_impl!(Div, div, ClosedSubAssign;
63 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
64 const D; for; where;
65 self: Translation<T, D>, right: Translation<T, D>, Output = Translation<T, D>;
66 #[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector - right.vector) }; );
67
68add_sub_impl!(Mul, mul, ClosedAddAssign;
72 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
73 const D; for; where;
74 self: &'a Translation<T, D>, right: &'b Point<T, D>, Output = Point<T, D>;
75 #[allow(clippy::suspicious_arithmetic_impl)] { right + &self.vector };
76 'a, 'b);
77
78add_sub_impl!(Mul, mul, ClosedAddAssign;
79 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
80 const D; for; where;
81 self: &'a Translation<T, D>, right: Point<T, D>, Output = Point<T, D>;
82 #[allow(clippy::suspicious_arithmetic_impl)] { right + &self.vector };
83 'a);
84
85add_sub_impl!(Mul, mul, ClosedAddAssign;
86 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
87 const D; for; where;
88 self: Translation<T, D>, right: &'b Point<T, D>, Output = Point<T, D>;
89 #[allow(clippy::suspicious_arithmetic_impl)] { right + self.vector };
90 'b);
91
92add_sub_impl!(Mul, mul, ClosedAddAssign;
93 (Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
94 const D; for; where;
95 self: Translation<T, D>, right: Point<T, D>, Output = Point<T, D>;
96 #[allow(clippy::suspicious_arithmetic_impl)] { right + self.vector }; );
97
98add_sub_assign_impl!(MulAssign, mul_assign, ClosedAddAssign;
100 const D;
101 self: Translation<T, D>, right: &'b Translation<T, D>;
102 #[allow(clippy::suspicious_op_assign_impl)] { self.vector += &right.vector };
103 'b);
104
105add_sub_assign_impl!(MulAssign, mul_assign, ClosedAddAssign;
106 const D;
107 self: Translation<T, D>, right: Translation<T, D>;
108 #[allow(clippy::suspicious_op_assign_impl)] { self.vector += right.vector }; );
109
110add_sub_assign_impl!(DivAssign, div_assign, ClosedSubAssign;
111 const D;
112 self: Translation<T, D>, right: &'b Translation<T, D>;
113 #[allow(clippy::suspicious_op_assign_impl)] { self.vector -= &right.vector };
114 'b);
115
116add_sub_assign_impl!(DivAssign, div_assign, ClosedSubAssign;
117 const D;
118 self: Translation<T, D>, right: Translation<T, D>;
119 #[allow(clippy::suspicious_op_assign_impl)] { self.vector -= right.vector }; );