7
7
from math import factorial , sqrt
8
8
from typing import Any , Iterable , Iterator , List , Sequence , Tuple , Union
9
9
10
- import numpy as np
11
10
import scipy .spatial
12
11
from numpy import abs as np_abs
13
12
from numpy import (
28
27
from numpy .linalg import det as ndet
29
28
from numpy .linalg import matrix_rank , norm , slogdet , solve
30
29
30
+ from adaptive .types import Bool
31
+
31
32
try :
32
33
from typing import TypeAlias
33
34
except ImportError :
@@ -61,7 +62,7 @@ def fast_norm(v: tuple[float, ...] | ndarray) -> float:
61
62
62
63
def fast_2d_point_in_simplex (
63
64
point : Point , simplex : SimplexPoints , eps : float = 1e-8
64
- ) -> bool | np . bool_ :
65
+ ) -> Bool :
65
66
(p0x , p0y ), (p1x , p1y ), (p2x , p2y ) = simplex
66
67
px , py = point
67
68
@@ -75,9 +76,7 @@ def fast_2d_point_in_simplex(
75
76
return (t >= - eps ) and (s + t <= 1 + eps )
76
77
77
78
78
- def point_in_simplex (
79
- point : Point , simplex : SimplexPoints , eps : float = 1e-8
80
- ) -> bool | np .bool_ :
79
+ def point_in_simplex (point : Point , simplex : SimplexPoints , eps : float = 1e-8 ) -> Bool :
81
80
if len (point ) == 2 :
82
81
return fast_2d_point_in_simplex (point , simplex , eps )
83
82
@@ -424,7 +423,7 @@ def get_reduced_simplex(
424
423
425
424
def point_in_simplex (
426
425
self , point : Point , simplex : Simplex , eps : float = 1e-8
427
- ) -> bool | np . bool_ :
426
+ ) -> Bool :
428
427
vertices = self .get_vertices (simplex )
429
428
return point_in_simplex (point , vertices , eps )
430
429
@@ -533,7 +532,7 @@ def circumscribed_circle(
533
532
534
533
def point_in_cicumcircle (
535
534
self , pt_index : int , simplex : Simplex , transform : ndarray
536
- ) -> bool | np . bool_ :
535
+ ) -> Bool :
537
536
# return self.fast_point_in_circumcircle(pt_index, simplex, transform)
538
537
eps = 1e-8
539
538
@@ -611,7 +610,7 @@ def bowyer_watson(
611
610
new_triangles = self .vertex_to_simplices [pt_index ]
612
611
return bad_triangles - new_triangles , new_triangles - bad_triangles
613
612
614
- def _simplex_is_almost_flat (self , simplex : Simplex ) -> bool | np . bool_ :
613
+ def _simplex_is_almost_flat (self , simplex : Simplex ) -> Bool :
615
614
return self ._relative_volume (simplex ) < 1e-8
616
615
617
616
def _relative_volume (self , simplex : Simplex ) -> float :
0 commit comments