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
✨ Canvas#debug_grid, Region#corners
author
Gwenn Le Bihan
date
7 months ago
(Oct 30, 2025, 11:00 PM +0100)
commit
066b2242
066b22421ebfa909d6ce7181df2a19c45a643207
parent
2a10660f
2a10660f84001553e09235ac63ae224febbb7a3a
+38
2 changed files
Expand all
Collapse all
Unified
Split
src
geometry
region.rs
graphics
canvas.rs
+13
src/geometry/region.rs
Reviewed
···
57
57
.chain(left_edge)
58
58
}
59
59
60
60
+
/// Corners of the region's outline
61
61
+
/// Does _not_ match .bottomright() etc., since
62
62
+
/// this method takes into account that the region is inclusive
63
63
+
/// topleft, topright, bottomright, bottomleft
64
64
+
pub fn corners(&self) -> [Point; 4] {
65
65
+
[
66
66
+
self.topleft(),
67
67
+
self.topright().translated(1, 0),
68
68
+
self.bottomright().translated(1, 1),
69
69
+
self.bottomleft().translated(0, 1),
70
70
+
]
71
71
+
}
72
72
+
60
73
pub fn is_empty(&self) -> bool {
61
74
self.width() == 0 || self.height() == 0
62
75
}
+25
src/graphics/canvas.rs
Reviewed
···
341
341
)
342
342
}
343
343
344
344
+
pub fn debug_grid(&mut self, color: Color) {
345
345
+
let world = self.world_region.clone();
346
346
+
let layer = self.layer_or_empty("debug_plane");
347
347
+
348
348
+
let ymax = world.end.1 + 1;
349
349
+
let xmax = world.end.0 + 1;
350
350
+
351
351
+
// Vertical lines
352
352
+
for Point(x, y) in world.iter() {
353
353
+
layer.set(
354
354
+
format!("grid_vertical_{x}"),
355
355
+
Object::Line(Point(x, 0), Point(x, ymax), 1.0)
356
356
+
.colored(color)
357
357
+
.opacified(0.25),
358
358
+
);
359
359
+
360
360
+
layer.set(
361
361
+
format!("grid_horizontal_{y}"),
362
362
+
Object::Line(Point(0, y), Point(xmax, y), 1.0)
363
363
+
.colored(color)
364
364
+
.opacified(0.25),
365
365
+
);
366
366
+
}
367
367
+
}
368
368
+
344
369
pub fn dimensions<T: From<usize>>(&self) -> (T, T) {
345
370
(self.width().into(), self.height().into())
346
371
}