diff --git a/geom/src/angle.rs b/geom/src/angle.rs index 30982b46..7ae379a2 100644 --- a/geom/src/angle.rs +++ b/geom/src/angle.rs @@ -3,12 +3,12 @@ use serde::{Deserialize, Serialize}; use std::f32::consts::{PI, TAU}; use std::ops::{Add, AddAssign, Mul, Sub, SubAssign}; -#[derive(Serialize, Deserialize, Copy, Clone, PartialOrd, PartialEq, Default)] +#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialOrd, PartialEq, Default)] #[serde(from = "f32", into = "f32")] #[repr(transparent)] pub struct Degrees(pub f32); -#[derive(Serialize, Deserialize, Copy, Clone, PartialOrd, PartialEq, Default)] +#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialOrd, PartialEq, Default)] #[serde(from = "f32", into = "f32")] #[repr(transparent)] pub struct Radians(pub f32); @@ -17,6 +17,7 @@ impl Radians { pub const HALFPI: Self = Radians(std::f32::consts::FRAC_PI_2); pub const PI: Self = Radians(PI); pub const TAU: Self = Radians(TAU); + pub const ZERO: Self = Radians(0.0); pub fn vec2(self) -> Vec2 { Vec2 { diff --git a/geom/src/v2.rs b/geom/src/v2.rs index 115a3f02..69d329a3 100644 --- a/geom/src/v2.rs +++ b/geom/src/v2.rs @@ -1161,6 +1161,6 @@ mod tests { #[test] fn test_angle_cossin() { - assert_eq!(vec2(1.0, 0.0).angle_cossin(), 0.0); + assert_eq!(vec2(1.0, 0.0).angle_cossin(), Radians::ZERO); } }