Repository navigation
Commit 1f77f1b
committed
fix: scale-aware degeneracy filter and orphan-free insertion in 2D+
Two deliberate behavior divergences from the Python reference, in regimes
where the reference corrupts its own state. Cross-validation on
well-conditioned inputs is unaffected (all parity tests still pass).
- simplex_is_numerically_degenerate: drop a Bowyer-Watson candidate only
when its volume is negligible BOTH absolutely (the reference's
criterion, which keeps volume conservation safe) AND as scale-invariant
flatness. The absolute test alone silently emptied finely refined or
small-coordinate meshes (inserting into a [0, 1e-4]^2 mesh deleted
every simplex and orphaned all vertices); the flatness test alone
(briefly used here for 1D) deletes large-but-flat simplices the cavity
needs. The conjunction also subsumes the previous 1D special case.
- bowyer_watson now collects the cavity without mutating, and rejects the
insertion as 'Point already in triangulation.' when it would strand a
cavity vertex (a point within the circumcircle slack of every simplex
around an existing vertex - previously this silently orphaned the
vertex). add_point rolls back the pushed vertex/hull extension on these
pre-mutation rejections.
- New regression tests for both, plus a parametrized 2D/3D off-origin
small-scale insertion sweep (the class of test whose absence hid the
PR #3 bugs).
Known limitation, now documented in tolerances.rs: point sets mixing
widely separated coordinate scales in one triangulation create ~1e7
aspect-ratio slivers whose circumsphere tests are unreliable; the volume
conservation assertion catches this loudly. The Python reference fails
the same stress more often (41/50 runs vs 33/50 here); a real fix needs
exact geometric predicates.1 parent eea84c6 commit 1f77f1b
3 files changed
Lines changed: 212 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
14 | 29 | | |
15 | 30 | | |
16 | 31 | | |
| |||
27 | 42 | | |
28 | 43 | | |
29 | 44 | | |
30 | | - | |
31 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
32 | 50 | | |
33 | 51 | | |
34 | | - | |
35 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
36 | 58 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
41 | 64 | | |
42 | 65 | | |
43 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
968 | 968 | | |
969 | 969 | | |
970 | 970 | | |
| 971 | + | |
| 972 | + | |
971 | 973 | | |
972 | 974 | | |
973 | 975 | | |
| |||
980 | 982 | | |
981 | 983 | | |
982 | 984 | | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
983 | 988 | | |
984 | 989 | | |
985 | | - | |
986 | | - | |
| 990 | + | |
987 | 991 | | |
988 | 992 | | |
989 | 993 | | |
| |||
997 | 1001 | | |
998 | 1002 | | |
999 | 1003 | | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | 1004 | | |
1004 | 1005 | | |
1005 | 1006 | | |
1006 | 1007 | | |
1007 | 1008 | | |
1008 | | - | |
1009 | 1009 | | |
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
1013 | 1013 | | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | 1014 | | |
1018 | 1015 | | |
1019 | 1016 | | |
| |||
1024 | 1021 | | |
1025 | 1022 | | |
1026 | 1023 | | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | 1024 | | |
1031 | 1025 | | |
1032 | 1026 | | |
| |||
1044 | 1038 | | |
1045 | 1039 | | |
1046 | 1040 | | |
| 1041 | + | |
1047 | 1042 | | |
1048 | 1043 | | |
1049 | 1044 | | |
| |||
1055 | 1050 | | |
1056 | 1051 | | |
1057 | 1052 | | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1058 | 1080 | | |
1059 | 1081 | | |
1060 | 1082 | | |
| |||
1171 | 1193 | | |
1172 | 1194 | | |
1173 | 1195 | | |
1174 | | - | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
1175 | 1210 | | |
1176 | 1211 | | |
1177 | 1212 | | |
| |||
1202 | 1237 | | |
1203 | 1238 | | |
1204 | 1239 | | |
1205 | | - | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
1206 | 1250 | | |
1207 | 1251 | | |
1208 | 1252 | | |
| |||
1237 | 1281 | | |
1238 | 1282 | | |
1239 | 1283 | | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
1245 | 1294 | | |
1246 | 1295 | | |
1247 | 1296 | | |
| |||
1948 | 1997 | | |
1949 | 1998 | | |
1950 | 1999 | | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
1951 | 2049 | | |
1952 | 2050 | | |
1953 | 2051 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
280 | 344 | | |
281 | 345 | | |
282 | 346 | | |
| |||
0 commit comments