rust/hwphysics/src/physics.rs
changeset 15261 501dfa1c8deb
parent 15260 775d7efa4e5c
child 15266 b58f98bbc120
equal deleted inserted replaced
15260:775d7efa4e5c 15261:501dfa1c8deb
    91 
    91 
    92     pub fn push(&mut self, gear_id: GearId, old_position: &FPPoint, new_position: &FPPoint) {
    92     pub fn push(&mut self, gear_id: GearId, old_position: &FPPoint, new_position: &FPPoint) {
    93         self.gear_ids.push(gear_id);
    93         self.gear_ids.push(gear_id);
    94         self.shifts.push((*old_position, *new_position));
    94         self.shifts.push((*old_position, *new_position));
    95     }
    95     }
       
    96 
       
    97     pub fn iter(&self) -> impl Iterator<Item = (GearId, &FPPoint, &FPPoint)> {
       
    98         self.gear_ids
       
    99             .iter()
       
   100             .cloned()
       
   101             .zip(self.shifts.iter())
       
   102             .map(|(id, (from, to))| (id, from, to))
       
   103     }
    96 }
   104 }
    97 
   105 
    98 impl PhysicsProcessor {
   106 impl PhysicsProcessor {
    99     pub fn new() -> Self {
   107     pub fn new() -> Self {
   100         PhysicsProcessor {
   108         PhysicsProcessor {