diff --git a/src/rotation.rs b/src/rotation.rs index ebfad76..1be36c4 100644 --- a/src/rotation.rs +++ b/src/rotation.rs @@ -225,6 +225,25 @@ where } } +impl fmt::Debug for Rotation2D { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Rotation({:?} rad)", self.angle) + } +} + +impl ApproxEq for Rotation2D +where + T: Copy + Neg + ApproxEq, +{ + fn approx_epsilon() -> T { + T::approx_epsilon() + } + + fn approx_eq_eps(&self, other: &Self, eps: &T) -> bool { + self.angle.approx_eq_eps(&other.angle, eps) + } +} + /// A transform that can represent rotations in 3d, represented as a quaternion. /// /// Most methods expect the quaternion to be normalized.