1#![deny(unsafe_code, warnings, clippy::all)]
2
3use crate::{Vector3, Vector3Coordinate};
4
5impl<T: Vector3Coordinate> std::ops::Add<Vector3<T>> for Vector3<T> {
6 type Output = Self;
7 fn add(self, rhs: Vector3<T>) -> Self::Output {
8 Vector3 {
9 x: self.x + rhs.x,
10 y: self.y + rhs.y,
11 z: self.z + rhs.z,
12 }
13 }
14}
15
16impl<T: Vector3Coordinate> std::ops::AddAssign<Vector3<T>> for Vector3<T> {
17 fn add_assign(&mut self, rhs: Self) {
18 self.x += rhs.x;
19 self.y += rhs.y;
20 self.z += rhs.z;
21 }
22}
23
24impl<T: Vector3Coordinate> std::ops::Sub<Vector3<T>> for Vector3<T> {
25 type Output = Self;
26 fn sub(self, rhs: Vector3<T>) -> Self::Output {
27 Vector3 {
28 x: self.x - rhs.x,
29 y: self.y - rhs.y,
30 z: self.z - rhs.z,
31 }
32 }
33}
34
35impl<T: Vector3Coordinate> std::ops::SubAssign<Vector3<T>> for Vector3<T> {
36 fn sub_assign(&mut self, rhs: Vector3<T>) {
37 self.x -= rhs.x;
38 self.y -= rhs.y;
39 self.z -= rhs.z;
40 }
41}
42
43impl<T: Vector3Coordinate> std::ops::Mul<T> for Vector3<T> {
44 type Output = Self;
45 fn mul(self, rhs: T) -> Self::Output {
46 Vector3 {
47 x: self.x * rhs,
48 y: self.y * rhs,
49 z: self.z * rhs,
50 }
51 }
52}
53
54impl<T: Vector3Coordinate> std::ops::Mul<Vector3<T>> for Vector3<T> {
55 type Output = Self;
56 fn mul(self, rhs: Vector3<T>) -> Self::Output {
57 Vector3 {
58 x: self.x * rhs.x,
59 y: self.y * rhs.y,
60 z: self.z * rhs.z,
61 }
62 }
63}
64
65impl<T: Vector3Coordinate> std::ops::MulAssign<T> for Vector3<T> {
66 fn mul_assign(&mut self, rhs: T) {
67 self.x *= rhs;
68 self.y *= rhs;
69 self.z *= rhs;
70 }
71}
72
73impl<T: Vector3Coordinate> std::ops::MulAssign<Vector3<T>> for Vector3<T> {
74 fn mul_assign(&mut self, rhs: Vector3<T>) {
75 self.x *= rhs.x;
76 self.y *= rhs.y;
77 self.z *= rhs.z;
78 }
79}
80
81impl<T: Vector3Coordinate> std::ops::Div<T> for Vector3<T> {
82 type Output = Self;
83 fn div(self, rhs: T) -> Self::Output {
84 Vector3 {
85 x: self.x / rhs,
86 y: self.y / rhs,
87 z: self.z / rhs,
88 }
89 }
90}
91
92impl<T: Vector3Coordinate> std::ops::Div<Vector3<T>> for Vector3<T> {
93 type Output = Self;
94 fn div(self, rhs: Vector3<T>) -> Self::Output {
95 Vector3 {
96 x: self.x / rhs.x,
97 y: self.y / rhs.y,
98 z: self.z / rhs.z,
99 }
100 }
101}
102
103impl<T: Vector3Coordinate> std::ops::DivAssign<T> for Vector3<T> {
104 fn div_assign(&mut self, rhs: T) {
105 self.x /= rhs;
106 self.y /= rhs;
107 self.z /= rhs;
108 }
109}
110
111impl<T: Vector3Coordinate> std::ops::DivAssign<Vector3<T>> for Vector3<T> {
112 fn div_assign(&mut self, rhs: Vector3<T>) {
113 self.x /= rhs.x;
114 self.y /= rhs.y;
115 self.z /= rhs.z;
116 }
117}