This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

✨ Region#outline

+22
+22
src/geometry/region.rs
··· 35 35 self.iter().filter(|Point(x, y)| x >= y) 36 36 } 37 37 38 + /// Iterates all points outlining the region, in clockwise order starting from top-left 39 + pub fn outline(&self) -> impl Iterator<Item = Point> { 40 + let top_edge = 41 + (self.start.0..=self.end.0).map(move |x| Point(x, self.start.1)); 42 + 43 + let right_edge = 44 + (self.start.1 + 1..=self.end.1).map(move |y| Point(self.end.0, y)); 45 + 46 + let bottom_edge = (self.start.0..self.end.0) 47 + .rev() 48 + .map(move |x| Point(x, self.end.1)); 49 + 50 + let left_edge = (self.start.1 + 1..self.end.1) 51 + .rev() 52 + .map(move |y| Point(self.start.0, y)); 53 + 54 + top_edge 55 + .chain(right_edge) 56 + .chain(bottom_edge) 57 + .chain(left_edge) 58 + } 59 + 38 60 pub fn is_empty(&self) -> bool { 39 61 self.width() == 0 || self.height() == 0 40 62 }