1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use super::Radius;

impl Radius {
    pub const ZERO: Self = Self::new(0.0);
    pub const ONE: Self = Self::new(1.0);

    #[inline]
    pub const fn new(r: f32) -> Self {
        Self(r)
    }
}

impl From<f32> for Radius {
    #[inline]
    fn from(r: f32) -> Self {
        Self::new(r)
    }
}

impl std::fmt::Display for Radius {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{:.prec$}", self.0, prec = crate::DISPLAY_PRECISION,)
    }
}