diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/angle.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/src/angle.rs b/core/src/angle.rs index 30ddad83..dc3c0e93 100644 --- a/core/src/angle.rs +++ b/core/src/angle.rs @@ -7,6 +7,18 @@ use std::ops::{Add, AddAssign, Div, Mul, RangeInclusive, Sub, SubAssign}; #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)] pub struct Degrees(pub f32); +impl PartialEq<f32> for Degrees { + fn eq(&self, other: &f32) -> bool { + self.0.eq(other) + } +} + +impl PartialOrd<f32> for Degrees { + fn partial_cmp(&self, other: &f32) -> Option<std::cmp::Ordering> { + self.0.partial_cmp(other) + } +} + /// Radians #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)] pub struct Radians(pub f32); @@ -140,3 +152,15 @@ impl Div for Radians { Self(self.0 / rhs.0) } } + +impl PartialEq<f32> for Radians { + fn eq(&self, other: &f32) -> bool { + self.0.eq(other) + } +} + +impl PartialOrd<f32> for Radians { + fn partial_cmp(&self, other: &f32) -> Option<std::cmp::Ordering> { + self.0.partial_cmp(other) + } +} |