Skip to content

Commit

Permalink
Add missing impls for Rotation2D (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
staticintlucas authored May 24, 2024
1 parent 3a3e57f commit 66f44de
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/rotation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,25 @@ where
}
}

impl<T: fmt::Debug, Src, Dst> fmt::Debug for Rotation2D<T, Src, Dst> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Rotation({:?} rad)", self.angle)
}
}

impl<T, Src, Dst> ApproxEq<T> for Rotation2D<T, Src, Dst>
where
T: Copy + Neg<Output = T> + ApproxEq<T>,
{
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.
Expand Down

0 comments on commit 66f44de

Please sign in to comment.