#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct Coord(pub i64);
impl Coord {
pub const ZERO: Self = Self(0);
pub fn from_mm(mm: f64) -> Self {
Self((mm * 1_000_000.0).round() as i64)
}
pub fn to_mm(self) -> f64 {
self.0 as f64 / 1_000_000.0
}
pub fn format_gerber(self) -> String {
self.0.to_string()
}
pub fn format_drill(self) -> String {
format!("{:.4}", self.to_mm())
}
}