equal
deleted
inserted
replaced
3 use crate::{common::GearId, data::GearDataManager, grid::Grid}; |
3 use crate::{common::GearId, data::GearDataManager, grid::Grid}; |
4 |
4 |
5 use fpnum::*; |
5 use fpnum::*; |
6 use integral_geometry::{Point, PotSize}; |
6 use integral_geometry::{Point, PotSize}; |
7 use land2d::Land2D; |
7 use land2d::Land2D; |
8 |
|
9 pub fn fppoint_round(point: &FPPoint) -> Point { |
|
10 Point::new(point.x().round(), point.y().round()) |
|
11 } |
|
12 |
8 |
13 #[derive(PartialEq, Eq, Clone, Copy, Debug)] |
9 #[derive(PartialEq, Eq, Clone, Copy, Debug)] |
14 pub struct CircleBounds { |
10 pub struct CircleBounds { |
15 pub center: FPPoint, |
11 pub center: FPPoint, |
16 pub radius: FPNum, |
12 pub radius: FPNum, |
88 contact_gear_id1: GearId, |
84 contact_gear_id1: GearId, |
89 contact_gear_id2: Option<GearId>, |
85 contact_gear_id2: Option<GearId>, |
90 position: &FPPoint, |
86 position: &FPPoint, |
91 ) { |
87 ) { |
92 self.pairs.push((contact_gear_id1, contact_gear_id2)); |
88 self.pairs.push((contact_gear_id1, contact_gear_id2)); |
93 self.positions.push(fppoint_round(&position)); |
89 self.positions.push(Point::from_fppoint(&position)); |
94 } |
90 } |
95 |
91 |
96 pub fn clear(&mut self) { |
92 pub fn clear(&mut self) { |
97 self.pairs.clear(); |
93 self.pairs.clear(); |
98 self.positions.clear() |
94 self.positions.clear() |