equal
deleted
inserted
replaced
1 use crate::{ |
1 use crate::{ |
2 collision::{fppoint_round, CircleBounds, DetectedCollisions}, |
2 collision::{CircleBounds, DetectedCollisions}, |
3 common::GearId, |
3 common::GearId, |
4 }; |
4 }; |
5 |
5 |
6 use fpnum::FPPoint; |
6 use fpnum::FPPoint; |
7 use integral_geometry::{GridIndex, Point, PotSize}; |
7 use integral_geometry::{GridIndex, Point, PotSize}; |
61 self.bins_count |
61 self.bins_count |
62 .linear_index(index.x as usize, index.y as usize) |
62 .linear_index(index.x as usize, index.y as usize) |
63 } |
63 } |
64 |
64 |
65 fn bin_index(&self, position: &FPPoint) -> Point { |
65 fn bin_index(&self, position: &FPPoint) -> Point { |
66 self.index.map(fppoint_round(position)) |
66 self.index.map(Point::from_fppoint(position)) |
67 } |
67 } |
68 |
68 |
69 fn get_bin(&mut self, index: Point) -> &mut GridBin { |
69 fn get_bin(&mut self, index: Point) -> &mut GridBin { |
70 let index = self.linear_bin_index(index); |
70 let index = self.linear_bin_index(index); |
71 &mut self.bins[index] |
71 &mut self.bins[index] |