rust/landgen/src/outline.rs
changeset 14118 400864ecb954
parent 14116 b2feb190e4bc
child 14121 4d22be35cfa2
equal deleted inserted replaced
14117:133f648c5fbd 14118:400864ecb954
   191             index: 0,
   191             index: 0,
   192         }
   192         }
   193     }
   193     }
   194 
   194 
   195     pub fn mirror(&mut self) {
   195     pub fn mirror(&mut self) {
       
   196         let width = self.size.width as i32;
   196         self.iter_mut()
   197         self.iter_mut()
   197             .for_each(|p| p.x = self.size.width() - 1 - p.x);
   198             .for_each(|p| p.x = width - 1 - p.x);
   198     }
   199     }
   199 
   200 
   200     pub fn flip(&mut self) {
   201     pub fn flip(&mut self) {
   201         points
   202         let height = self.size.height as i32;
   202             .iter_mut()
   203         self.iter_mut()
   203             .for_each(|p| p.y = self.size.height() - 1 - p.y);
   204             .for_each(|p| p.y = height - 1 - p.y);
   204     }
   205     }
   205 }
   206 }
   206 
   207 
   207 struct OutlineSegmentsIterator<'a> {
   208 struct OutlineSegmentsIterator<'a> {
   208     outline: &'a OutlinePoints,
   209     outline: &'a OutlinePoints,