2929 R3 ,
3030 R4 ,
3131)
32- from typing import Self
32+ from typing import Self , Iterator , cast
3333
3434_eps = np .finfo (np .float64 ).eps
3535
@@ -93,7 +93,7 @@ def General(cls, m, c) -> Self:
9393 """
9494 return cls ([m , - 1 , c ])
9595
96- def general (self ) -> Tuple [float , float ]:
96+ def general (self ) -> tuple [float , float ]:
9797 r"""
9898 Parameters of general line
9999
@@ -480,7 +480,7 @@ def animate(self, T, **kwargs) -> None:
480480 self .patch = PathPatch (self .path , ** self .kwargs )
481481 self .ax .add_patch (self .patch )
482482
483- def contains (self , p : ArrayLike2 , radius : float = 0.0 ) -> Union [ bool , List [bool ] ]:
483+ def contains (self , p : ArrayLike2 , radius : float = 0.0 ) -> bool | list [bool ]:
484484 """
485485 Test if point is inside polygon
486486
@@ -564,7 +564,7 @@ def radius(self) -> float:
564564 return dmax
565565
566566 def intersects (
567- self , other : Union [ Polygon2 , Line2 , List [Polygon2 ], List [Line2 ] ]
567+ self , other : Polygon2 | Line2 | list [Polygon2 ] | list [Line2 ]
568568 ) -> bool :
569569 """
570570 Test for intersection
@@ -590,12 +590,12 @@ def intersects(
590590 return True
591591 return False
592592 elif smb .islistof (other , Polygon2 ):
593- for polygon in cast (List [Polygon2 ], other ):
593+ for polygon in cast (list [Polygon2 ], other ):
594594 if self .path .intersects_path (polygon .path , filled = True ):
595595 return True
596596 return False
597597 elif smb .islistof (other , Line2 ):
598- for line in cast (List [Line2 ], other ):
598+ for line in cast (list [Line2 ], other ):
599599 for p1 , p2 in self .edges ():
600600 # test each edge segment against the line
601601 if line .intersect_segment (p1 , p2 ):
@@ -960,7 +960,7 @@ def theta(self) -> float:
960960 """
961961 e , x = np .linalg .eigh (self .E )
962962 # major axis is second column
963- return np .arctan (x [1 , 1 ] / x [0 , 1 ])
963+ return np .atan2 (x [1 , 1 ], x [0 , 1 ]) % ( np . pi )
964964
965965 @property
966966 def area (self ) -> float :
0 commit comments