grid: use coord2d more consistently

This commit is contained in:
2024-12-21 21:01:06 -08:00
parent 13f61e3a2b
commit 02fc154547
6 changed files with 37 additions and 15 deletions

View File

@ -42,9 +42,9 @@ impl AntennaMap {
// permutations generates both pairs, ie. ((1,2),(2,1)) and ((2,1),(1,2)) so we don't need
// to consider the 'negative' side of the line, which will be generated by the other pair
let (a, b) = (pair[0], pair[1]);
let offset = (a.0 - b.0, a.1 - b.1);
let offset = (a.x - b.x, a.y - b.y);
for i in (start..).map_while(|i| if Some(i - start) != reps { Some(i as i64) } else { None }) {
let node_pos = (a.0 + i * offset.0, a.1 + i * offset.1);
let node_pos = (a.x + i * offset.0, a.y + i * offset.1);
if antinodes.set(&node_pos, true).is_none() {
// left the grid
break;