Closed pbor closed 2 years ago
I'd welcome both having a way to iterate over the corners and over points (or sub-rectangles) inside the rectangle.
Something like:
/// Iterates over the corners in top-left (min), top-right, bottom-right (max), bottom-left order (matching CSS).
fn corners(&self) -> Corners2D<T, U> {
...
}
/// Iterates over sub-rects contained in this one, from left to right and top to bottom.
fn tiles(&self, origin: Point2D<T, U>, size: Size2D<T, U>) -> Tiles2D<T, U> {
...
}
Where Corners2D<T, U>
would implement Iterator<Item=Point<T, U>>
and and Tiles2D<T, U>
would implement Iterator<Item=Box2D<T, U>>
. The latter would be useful in WebRender, we can more or less move WebRender's implementation here.
It would be cool to be able iterate on points of a rectangle.