Add Rect.corners

An iterator over the corners of the rectangle
This commit is contained in:
Eryn Wells 2023-02-18 22:51:19 -08:00
parent 306d6fd13f
commit 462eebd95c

View file

@ -186,6 +186,13 @@ class Rect:
'''A Point in the middle of the Rect'''
return Point(self.mid_x, self.mid_y)
@property
def corners(self) -> Iterator[Point]:
yield self.origin
yield self.origin + Vector(self.max_x, 0)
yield self.origin + Vector(self.max_x, self.max_y)
yield self.origin + Vector(0, self.max_y)
@property
def edges(self) -> Iterator[int]:
'''