From aa6779ff4baccd44100c335e7b41fcb13dcb744b Mon Sep 17 00:00:00 2001 From: numzero Date: Sun, 9 Jun 2024 23:30:37 +0300 Subject: [PATCH] Cleanup --- src/bin/flat.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bin/flat.rs b/src/bin/flat.rs index 14c26e7..bd06bf6 100644 --- a/src/bin/flat.rs +++ b/src/bin/flat.rs @@ -97,6 +97,7 @@ pub fn main() { }); } +#[derive(Copy, Clone, Debug)] struct Location { /// Положение в основной СК pos: Vec2, @@ -104,6 +105,7 @@ struct Location { rot: Mat2, } +#[derive(Copy, Clone, Debug)] struct Object { id: i32, loc: Location, @@ -587,9 +589,9 @@ fn test_rect() { impl Metric for Rect { fn sqrt_at(&self, pos: Vec2) -> Decomp2 { - let x = pos.y.abs(); + let y = pos.y.abs(); let sx = ((pos.x.abs() - self.inner_radius) / (self.outer_radius - self.inner_radius)).clamp(0.0, 1.0); - let sy = if x <= self.external_halflength { 1.0 / self.root(x) } else { 1.0 }; + let sy = if y <= self.external_halflength { 1.0 / self.root(y) } else { 1.0 }; assert!(sx.is_finite()); assert!(sy.is_finite()); assert!(sy > 0.0);