# HG changeset patch # User unC0Rr # Date 1696617291 -7200 # Node ID 5ba4d3a0c3ebc54f65c6776b41c6f1362dbbf227 # Parent 39ae4ed7de6e5e0a2c1bd72ad62055170274dd3b Add some cosmetic/consistency fixes diff -r 39ae4ed7de6e -r 5ba4d3a0c3eb rust/hwphysics/src/collision.rs --- a/rust/hwphysics/src/collision.rs Tue Oct 03 21:13:41 2023 +0200 +++ b/rust/hwphysics/src/collision.rs Fri Oct 06 20:34:51 2023 +0200 @@ -6,10 +6,6 @@ use integral_geometry::{Point, PotSize}; use land2d::Land2D; -pub fn fppoint_round(point: &FPPoint) -> Point { - Point::new(point.x().round(), point.y().round()) -} - #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct CircleBounds { pub center: FPPoint, @@ -90,7 +86,7 @@ position: &FPPoint, ) { self.pairs.push((contact_gear_id1, contact_gear_id2)); - self.positions.push(fppoint_round(&position)); + self.positions.push(Point::from_fppoint(&position)); } pub fn clear(&mut self) { diff -r 39ae4ed7de6e -r 5ba4d3a0c3eb rust/hwphysics/src/grid.rs --- a/rust/hwphysics/src/grid.rs Tue Oct 03 21:13:41 2023 +0200 +++ b/rust/hwphysics/src/grid.rs Fri Oct 06 20:34:51 2023 +0200 @@ -1,5 +1,5 @@ use crate::{ - collision::{fppoint_round, CircleBounds, DetectedCollisions}, + collision::{CircleBounds, DetectedCollisions}, common::GearId, }; @@ -63,7 +63,7 @@ } fn bin_index(&self, position: &FPPoint) -> Point { - self.index.map(fppoint_round(position)) + self.index.map(Point::from_fppoint(position)) } fn get_bin(&mut self, index: Point) -> &mut GridBin { diff -r 39ae4ed7de6e -r 5ba4d3a0c3eb rust/integral-geometry/src/lib.rs --- a/rust/integral-geometry/src/lib.rs Tue Oct 03 21:13:41 2023 +0200 +++ b/rust/integral-geometry/src/lib.rs Fri Oct 06 20:34:51 2023 +0200 @@ -59,7 +59,7 @@ #[inline] pub const fn rotate90(self) -> Self { - Point::new(self.y, -self.x) + Self::new(self.y, -self.x) } #[inline] @@ -68,8 +68,8 @@ } #[inline] - pub fn clamp(self, rect: &Rect) -> Point { - Point::new(rect.x_range().clamp(self.x), rect.y_range().clamp(self.y)) + pub fn clamp(self, rect: &Rect) -> Self { + Self::new(rect.x_range().clamp(self.x), rect.y_range().clamp(self.y)) } #[inline]