alpha
Login
or
Join now
gwen.works
/
shapemaker
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
✨ Region#outline
author
Gwenn Le Bihan
date
7 months ago
(Oct 29, 2025, 11:26 PM +0100)
commit
c0b82674
c0b82674b06886119bd31ed5eb7f61046f18aac7
parent
cacf4a58
cacf4a58256a72e2b5f9d159d7843440205868d1
+22
1 changed file
Expand all
Collapse all
Unified
Split
src
geometry
region.rs
+22
src/geometry/region.rs
Reviewed
···
35
35
self.iter().filter(|Point(x, y)| x >= y)
36
36
}
37
37
38
38
+
/// Iterates all points outlining the region, in clockwise order starting from top-left
39
39
+
pub fn outline(&self) -> impl Iterator<Item = Point> {
40
40
+
let top_edge =
41
41
+
(self.start.0..=self.end.0).map(move |x| Point(x, self.start.1));
42
42
+
43
43
+
let right_edge =
44
44
+
(self.start.1 + 1..=self.end.1).map(move |y| Point(self.end.0, y));
45
45
+
46
46
+
let bottom_edge = (self.start.0..self.end.0)
47
47
+
.rev()
48
48
+
.map(move |x| Point(x, self.end.1));
49
49
+
50
50
+
let left_edge = (self.start.1 + 1..self.end.1)
51
51
+
.rev()
52
52
+
.map(move |y| Point(self.start.0, y));
53
53
+
54
54
+
top_edge
55
55
+
.chain(right_edge)
56
56
+
.chain(bottom_edge)
57
57
+
.chain(left_edge)
58
58
+
}
59
59
+
38
60
pub fn is_empty(&self) -> bool {
39
61
self.width() == 0 || self.height() == 0
40
62
}