Repository navigation
Commit cf1b37d
authored
Add 1D triangulation support (#3)
* feat: add 1d rust triangulation support
* refactor: clarify 1d simplex filtering
* refactor: consolidate 1d triangulation tests
* docs: summarize issue-095 cleanup
* Remove cleanup reports and fix pre-commit
* fix: make 1D triangulation numerically robust
Three related fixes for failures found on small intervals away from the
origin (e.g. Triangulation(np.linspace(100, 100.001, 50).reshape(-1, 1))
crashed with an AssertionError from the volume-conservation check):
- circumsphere: solve in coordinates relative to the first vertex. The
generic path computed |x_i|^2 - |x_0|^2, which cancels catastrophically
when a simplex is small compared to its distance from the origin
(center error ~1e-11 for a 1e-6 interval at x=0.5, vs the 5e-15
circumcircle tolerance). 1D always uses this path; dims >= 4 had the
same latent inaccuracy.
- point_in_circumcircle: short-circuit to true when the point is a vertex
of the simplex, so rounding in the circumcenter cannot flip the answer
bowyer_watson relies on after extend_hull.
- bowyer_watson: skip the circumcircle cascade in 1D. Splitting an
interval never invalidates neighbouring intervals, and cascading on the
(1 + eps) tolerance could delete a neighbour the point is strictly
outside of, orphaning the shared vertex and leaving overlapping
segments.
Also fixes clippy lints from newer toolchains and renames a test that now
asserts a deliberate divergence from the reference.
* perf: construct 1D triangulations from sorted adjacency
1D Delaunay triangulation is just the chain of adjacent points in sorted
order, so build it directly instead of running O(n^2) incremental
insertion (full-face scans in extend_hull made constructing 2000 sorted
points take ~860 ms; now 50k points build in ~17 ms). Exact duplicates
keep the first occurrence, matching the incremental path's behaviour.1 parent 4a16a9d commit cf1b37d
3 files changed
Lines changed: 444 additions & 59 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
291 | 294 | | |
292 | | - | |
293 | 295 | | |
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
301 | 303 | | |
302 | 304 | | |
303 | 305 | | |
304 | | - | |
| 306 | + | |
305 | 307 | | |
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 314 | + | |
| 315 | + | |
319 | 316 | | |
320 | 317 | | |
321 | 318 | | |
| |||
424 | 421 | | |
425 | 422 | | |
426 | 423 | | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
431 | 430 | | |
432 | 431 | | |
433 | 432 | | |
| |||
465 | 464 | | |
466 | 465 | | |
467 | 466 | | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
0 commit comments