@@ -806,6 +806,24 @@ def get_xy(self):
806
806
"""Return the left and bottom coords of the rectangle as a tuple."""
807
807
return self ._x0 , self ._y0
808
808
809
+ def get_edge_midpoints (self ):
810
+ """
811
+ Return the edge midpoints of the rectangle, moving clockwise from the
812
+ center of the left-hand edge.
813
+ """
814
+ return self .get_patch_transform ().transform (
815
+ [(0 , 0.5 ), (0.5 , 1 ), (1 , 0.5 ), (0.5 , 0 )])
816
+
817
+ def get_corners (self ):
818
+ """
819
+ Return the corners of the rectangle, moving clockwise from (x, y).
820
+ """
821
+ return self .get_patch_transform ().transform (
822
+ [(0 , 0 ), (1 , 0 ), (1 , 1 ), (0 , 1 )])
823
+
824
+ def get_center (self ):
825
+ return self .get_patch_transform ().transform ((0.5 , 0.5 ))
826
+
809
827
def get_width (self ):
810
828
"""Return the width of the rectangle."""
811
829
return self ._width
@@ -1657,6 +1675,20 @@ def get_angle(self):
1657
1675
1658
1676
angle = property (get_angle , set_angle )
1659
1677
1678
+ def get_corners (self ):
1679
+ """
1680
+ Return the corners of the rectangle, moving clockwise from (x0, y0).
1681
+ """
1682
+ return self .get_patch_transform ().transform (
1683
+ [(- 1 , - 1 ), (1 , - 1 ), (1 , 1 ), (- 1 , 1 )])
1684
+
1685
+ def get_edge_midpoints (self ):
1686
+ """
1687
+ Return the corners of the rectangle, moving clockwise from (x, y).
1688
+ """
1689
+ return self .get_patch_transform ().transform (
1690
+ [(0 , - 1 ), (1 , 0 ), (0 , 1 ), (- 1 , 0 )])
1691
+
1660
1692
1661
1693
class Annulus (Patch ):
1662
1694
"""
0 commit comments