- pub fn mirror(&self, incidence: Radians) -> Radians {
- Radians((std::f64::consts::PI + self.0 * 2.0 - incidence.0) % std::f64::consts::TAU)
+ pub fn mirror(&self, incidence: Angle) -> Angle {
+ Angle((std::f64::consts::PI + self.0 * 2.0 - incidence.0) % std::f64::consts::TAU)
+ }
+}
+
+impl PartialEq for Angle {
+ fn eq(&self, rhs: &Angle) -> bool {
+ self.0 % std::f64::consts::TAU == rhs.0 % std::f64::consts::TAU
+ }
+}
+
+// addition and subtraction of angles
+
+impl Add<Angle> for Angle {
+ type Output = Self;
+
+ fn add(self, rhs: Angle) -> Self {
+ Angle(self.0 + rhs.0)
+ }
+}
+
+impl AddAssign<Angle> for Angle {
+ fn add_assign(&mut self, rhs: Angle) {
+ self.0 += rhs.0;
+ }
+}
+
+impl Sub<Angle> for Angle {
+ type Output = Self;
+
+ fn sub(self, rhs: Angle) -> Self {
+ Angle(self.0 - rhs.0)
+ }
+}
+
+impl SubAssign<Angle> for Angle {
+ fn sub_assign(&mut self, rhs: Angle) {
+ self.0 -= rhs.0;