rust/hwphysics/src/collision.rs
changeset 15850 44b49f255e31
parent 15849 64b0a5cead86
child 16010 5ba4d3a0c3eb
equal deleted inserted replaced
15849:64b0a5cead86 15850:44b49f255e31
     1 use std::ops::RangeInclusive;
     1 use std::ops::RangeInclusive;
     2 
     2 
     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, Size};
     6 use integral_geometry::{Point, PotSize};
     7 use land2d::Land2D;
     7 use land2d::Land2D;
     8 
     8 
     9 pub fn fppoint_round(point: &FPPoint) -> Point {
     9 pub fn fppoint_round(point: &FPPoint) -> Point {
    10     Point::new(point.x().round(), point.y().round())
    10     Point::new(point.x().round(), point.y().round())
    11 }
    11 }
   103     pub fn register_components(data: &mut GearDataManager) {
   103     pub fn register_components(data: &mut GearDataManager) {
   104         data.register::<CollisionData>();
   104         data.register::<CollisionData>();
   105         data.register::<ContactData>();
   105         data.register::<ContactData>();
   106     }
   106     }
   107 
   107 
   108     pub fn new(size: Size) -> Self {
   108     pub fn new(size: PotSize) -> Self {
   109         Self {
   109         Self {
   110             grid: Grid::new(size),
   110             grid: Grid::new(size),
   111             enabled_collisions: EnabledCollisionsCollection::new(),
   111             enabled_collisions: EnabledCollisionsCollection::new(),
   112             detected_collisions: DetectedCollisions::new(0),
   112             detected_collisions: DetectedCollisions::new(0),
   113         }
   113         }