Add Rect.corners
An iterator over the corners of the rectangle
This commit is contained in:
parent
306d6fd13f
commit
462eebd95c
1 changed files with 7 additions and 0 deletions
|
@ -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]:
|
||||
'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue