Skip to content

v0.2.0

Choose a tag to compare

@basnijholt basnijholt released this 10 Jun 19:11
· 6 commits to main since this release
4ee0bf2

Performance, robustness, and drop-in completeness release. All changes keep the Python API drop-in compatible with adaptive.learner.triangulation; the 64 cross-validation tests against the reference pass unchanged throughout.

Performance (#5, #7)

  • Core data-structure overhaul: simplices are interned in a slab and referenced by integer ids; a facet-adjacency index makes point-location walks, the Bowyer-Watson cascade, and containing() single hash lookups; the convex hull is maintained incrementally (the old per-insertion full-face recount was O(n²) for hull-heavy workloads).
  • Incremental insertion is 40-291× faster than the pure-Python reference (2D-3D, 500-5000 points) and 2-8× faster than v0.1.0.
  • End-to-end LearnerND runs ~3.7× faster than with the Python triangulation (~7× vs Learner2D at 5K points).
  • numpy fast paths in the bindings; np.asarray(tri.vertices) snapshots are ~50× faster.

Robustness (#6) — behavior change on degenerate input

Insertions are now validated before any mutation: volume conservation is checked with adaptive-precision determinants, and the point must end up connected. Failing cavities are repaired — in 2D/3D by rebuilding them with Shewchuk's exact insphere predicates (via the robust crate) — and if even the repaired cavity fails, the insertion raises (AssertionError, or ValueError when the point cannot be connected) with the triangulation untouched, so callers can skip the point and continue.

Previously (like the Python reference still does) such insertions could corrupt the mesh: on mixed-coordinate-scale stress sweeps, corrupted end states drop from 99/400 runs to 0/400. Well-conditioned inputs never enter the repair path and behave identically to before. The full numerical policy is documented in src/tolerances.rs.

Drop-in API completeness (#7)

LearnerND with neighbor-aware losses (curvature_loss_function(), triangle_loss) now works; previously it crashed on missing methods. Added: get_vertex, get_neighbors_from_vertices, get_simplices_attached_to_points, get_opposing_vertices, get_face_sharing_neighbors, None pass-through in get_vertices, and set operators on the simplices proxy.

Internals & docs (#8, #9)

  • Readability refactor of the core and bindings (net −108 lines, provably behavior-identical).
  • README benchmarks re-measured and a Robustness section added.

Full changelog: v0.1.0...v0.2.0