@@ -1657,37 +1657,6 @@ def get_corners(self):
1657
1657
def _calculate_length_between_points (self , x0 , y0 , x1 , y1 ):
1658
1658
return np .sqrt ((x1 - x0 )** 2 + (y1 - y0 )** 2 )
1659
1659
1660
- def _calculate_vertices_coordinates (self , return_major : bool = True ):
1661
- # calculate the vertices of width axis
1662
- w_x0 = self ._center [0 ] - self ._width / 2 * np .cos (np .deg2rad (self ._angle ))
1663
- w_y0 = self ._center [1 ] - self ._width / 2 * np .sin (np .deg2rad (self ._angle ))
1664
- w_x1 = self ._center [0 ] + self ._width / 2 * np .cos (np .deg2rad (self ._angle ))
1665
- w_y1 = self ._center [1 ] + self ._width / 2 * np .sin (np .deg2rad (self ._angle ))
1666
-
1667
- # calculate the vertices of height axis
1668
- h_x0 = self ._center [0 ] - self ._height / 2 * np .sin (np .deg2rad (self ._angle ))
1669
- h_y0 = self ._center [1 ] + self ._height / 2 * np .cos (np .deg2rad (self ._angle ))
1670
- h_x1 = self ._center [0 ] + self ._height / 2 * np .sin (np .deg2rad (self ._angle ))
1671
- h_y1 = self ._center [1 ] - self ._height / 2 * np .cos (np .deg2rad (self ._angle ))
1672
-
1673
- if self ._calculate_length_between_points (
1674
- w_x0 , w_y0 , w_x1 , w_y1
1675
- ) >= self ._calculate_length_between_points (
1676
- h_x0 , h_y0 , h_x1 , h_y1
1677
- ): # width is major
1678
- major = [(w_x0 , w_y0 ), (w_x1 , w_y1 )]
1679
- minor = [(h_x0 , h_y0 ), (h_x1 , h_y1 )]
1680
- else : # minor
1681
- major = [(h_x0 , h_y0 ), (h_x1 , h_y1 )]
1682
- minor = [(w_x0 , w_y0 ), (w_x1 , w_y1 )]
1683
-
1684
- if return_major :
1685
- coordinates = major
1686
- else :
1687
- coordinates = minor
1688
-
1689
- return coordinates
1690
-
1691
1660
def get_vertices (self ):
1692
1661
"""
1693
1662
Return the vertices coordinates of the ellipse.
@@ -1696,7 +1665,11 @@ def get_vertices(self):
1696
1665
1697
1666
.. versionadded:: 3.8
1698
1667
"""
1699
- return self ._calculate_vertices_coordinates ()
1668
+ if self .width < self .height :
1669
+ ret = self .get_patch_transform ().transform ([(0 , 1 ), (0 , - 1 )])
1670
+ else :
1671
+ ret = self .get_patch_transform ().transform ([(1 , 0 ), (- 1 , 0 )])
1672
+ return [tuple (x ) for x in ret ]
1700
1673
1701
1674
def get_co_vertices (self ):
1702
1675
"""
@@ -1706,7 +1679,11 @@ def get_co_vertices(self):
1706
1679
1707
1680
.. versionadded:: 3.8
1708
1681
"""
1709
- return self ._calculate_vertices_coordinates (return_major = False )
1682
+ if self .width < self .height :
1683
+ ret = self .get_patch_transform ().transform ([(1 , 0 ), (- 1 , 0 )])
1684
+ else :
1685
+ ret = self .get_patch_transform ().transform ([(0 , 1 ), (0 , - 1 )])
1686
+ return [tuple (x ) for x in ret ]
1710
1687
1711
1688
1712
1689
class Annulus (Patch ):
0 commit comments