Corrected documentation, optimized a boundary check.
philippeitis authored on 17/12/2019 00:15:39 • Joseph Weston committed on 05/05/2020 19:10:25... | ... |
@@ -57,7 +57,6 @@ def fast_2d_point_in_simplex(point, simplex, eps=1e-8): |
57 | 57 |
|
58 | 58 |
|
59 | 59 |
def point_in_simplex(point, simplex, eps=1e-8): |
60 |
- # simplex is list |
|
61 | 60 |
if len(point) == 2: |
62 | 61 |
return fast_2d_point_in_simplex(point, simplex, eps) |
63 | 62 |
|
... | ... |
@@ -79,7 +78,7 @@ def fast_2d_circumcircle(points): |
79 | 78 |
Returns |
80 | 79 |
------- |
81 | 80 |
tuple |
82 |
- (center point : tuple(int), radius: int) |
|
81 |
+ (center point : tuple(float), radius: float) |
|
83 | 82 |
""" |
84 | 83 |
points = array(points) |
85 | 84 |
# transform to relative coordinates |
... | ... |
@@ -115,7 +114,7 @@ def fast_3d_circumcircle(points): |
115 | 114 |
Returns |
116 | 115 |
------- |
117 | 116 |
tuple |
118 |
- (center point : tuple(int), radius: int) |
|
117 |
+ (center point : tuple(float), radius: float) |
|
119 | 118 |
""" |
120 | 119 |
points = array(points) |
121 | 120 |
pts = points[1:] - points[0] |
... | ... |
@@ -258,7 +257,7 @@ def simplex_volume_in_embedding(vertices) -> float: |
258 | 257 |
vol_square = fast_det(sq_dists_mat) / coeff |
259 | 258 |
|
260 | 259 |
if vol_square < 0: |
261 |
- if abs(vol_square) < 1e-15: |
|
260 |
+ if -1e-15 < vol_square < 1e-15: |
|
262 | 261 |
return 0 |
263 | 262 |
raise ValueError("Provided vertices do not form a simplex") |
264 | 263 |
|