From: Taran Nathan Date: Fri, 22 May 2026 17:42:41 +0000 (-0700) Subject: works X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=0fec42083c21cb8e3bf846e136e1232ec3d45dcb;p=cart.git works --- diff --git a/roomy/src/main.rs b/roomy/src/main.rs index fd213c2..90f690a 100644 --- a/roomy/src/main.rs +++ b/roomy/src/main.rs @@ -22,7 +22,11 @@ fn main() -> Result<()> { points.push(record_to_point(&record)); } - dbg!(points); + dbg!(&points); + + let grid = points_to_grid(&points); + + dbg!(&grid); Ok(()) } @@ -31,18 +35,18 @@ fn record_to_point(record: &Record) -> Point2 { let cart_pos = Point2::new(record.cart_pos.0, record.cart_pos.1); let cart_rot = Rotation2::new(record.cart_rot); - let distance: Vector2 = (cart_rot * Vector2::new(0.0, 1.0)) * record.distance; + let distance: Vector2 = (cart_rot * Vector2::new(1.0, 0.0)) * record.distance; Point2::from(distance + Vector2::from(cart_pos.coords)) } fn points_to_grid(points: &Vec>) -> Grid { - let mut grid = Grid::new(0.1, HashMap::new()); + let mut grid = Grid::new(0.5, HashMap::new()); for point in points { let coords = ( - (point.x % grid.resolution) as i32, - (point.y % grid.resolution) as i32, + (point.x / grid.resolution) as i32, + (point.y / grid.resolution) as i32, ); grid.strengths.insert( coords,