Commit c23cefb
authored
Refactor/validation hierarchy (#157)
* refactor(validation): reduce public validation API to canonical layer methods
- Make focused invariant validators internal; keep only `is_valid`/`validate` as the public entry points (plus `DelaunayTriangulation::validation_report` for cumulative diagnostics).
- Update docs/README and examples/benches to reflect the 4-level validation hierarchy and correct per-layer semantics.
- Adjust tests/proptests/benches to validate at the appropriate layer (e.g., Level 1–2 during bootstrap, Level 1–3 for topology) and avoid deprecated helpers.
- Fix commit-check/clippy issues (missing `# Errors` docs, similar-name locals, deprecated `is_delaunay`, private API usage in benches).
* refactor: split validation errors by layer (TDS/topology/Delaunay)
- Rename TDS validation error to `TdsValidationError` and update call sites across core/geometry
- Introduce topology-layer `TriangulationValidationError` with structured manifold + Euler variants
- Add `DelaunayTriangulationValidationError` and update `DelaunayTriangulation::{is_valid, validate}` signatures
- Update insertion/boundary/facet plumbing to use the correct layer error types
- Fix rustdoc links and cspell/markdownlint fallout from the refactor
* refactor: layer construction errors (TDS/Triangulation/Delaunay)
- Introduce layered construction errors: TdsConstructionError, TriangulationConstructionError, DelaunayTriangulationConstructionError
- Update DelaunayTriangulation constructors and insertion plumbing to propagate layered errors consistently
- Fix geometry helpers/tests to match wrapped construction error variants
- Refresh docs to match current validation hierarchy + error layering; mark superseded topology integration notes as historical
* Changed: Refactors validation error hierarchy internally
Consolidates and standardizes the validation error types
within the triangulation data structure (TDS) to improve
internal error handling and consistency. Replaces
`TriangulationValidationError` with `TdsValidationError`
where appropriate, streamlining the error reporting
across the library. Updates error propagation to maintain
semantic accuracy.
Refs: refactor/validation-hierarchy
* refactor: clarify validation hierarchy and expand core test coverage
- Make validation layering explicit (elements → TDS structure → topology) and expose a cumulative validation_report API
- Preserve underlying layer errors in TriangulationValidationReport; update docs/examples accordingly
- Add deterministic unit tests covering core error branches (Cell/TDS/util/incremental insertion), incl. overflow, missing keys, non-manifold cases, and serde failures
- Clarify facet-cache error semantics and plumb source errors through convex-hull boundary facet extraction
* Fixed: Improve TDS validation and Delaunay error handling
Improves triangulation data structure (TDS) validation by adding a
check for missing vertex keys in cells, preventing inconsistent state
and improving error diagnostics.
Enhances Delaunay validation to include cell keys in error messages,
aiding debugging.
These changes improve the overall robustness and diagnosability of
the triangulation process.
* Changed: Refactors triangulation validation for clarity
Refactors triangulation validation in `DelaunayTriangulation`
to improve clarity and correctness. It streamlines the
validation process, reusing the lower-layer report more
effectively and ensuring that Delaunay property violations
are handled correctly.
The `TdsValidationError` enum is also updated and a
`TdsMutationError` alias is created to provide clearer
semantics for mutation operations.
A deprecated function `is_delaunay` is updated to reference
`DelaunayTriangulation::is_valid()` and
`DelaunayTriangulation::validate()` methods.
Finally, the 3D insertion order robustness property test is
specialized to avoid nearly-coplanar tetrahedra and
co-spherical 5-tuples, focusing on pure insertion-order
robustness.
* Fixed: Correctly classify cavity boundary facets
Classifies cavity boundary facets by facet incidence within the
conflict region, ensuring accurate boundary detection during
incremental updates.
This avoids misclassification due to temporarily incomplete neighbor
pointers, preventing internal boundary components and Euler/topology
validation failures.
Also adds debug-only safety net to retry cavity-based insertions
with a conservative fallback (star-split) if Level 3 topology
validation fails. This ensures robust handling of degenerate cases
during incremental Delaunay triangulation construction.
Refs: refactor/validation-hierarchy
* Changed: Improves robustness of triangulation insertion
Enhances triangulation insertion robustness by adding
connectedness validation and preventing empty conflict
regions. It also introduces star-split fallback for
topology preservation and refactors boundary handling.
These changes ensure a more reliable triangulation
process.
* Changed: Refactors TDS validation and mutation errors
Refactors the `TdsValidationError` and `TdsMutationError` types to
improve clarity and future extensibility. Introduces a wrapper
struct for `TdsMutationError` to allow for independent evolution
while maintaining API compatibility. Also improves the error
handling during triangulation construction and modification.
Refs: refactor/validation-hierarchy
* perf: Adjust global validation checks
Now that we have a validation hierarchy, we want to run expensive global checks, which are often O(N*D^2), only when we have a suspicion that something has gone wrong. Like CGAL, we want to rely on local checks and only call is_valid() when necessary. So, introduce a ValidationPolicy with SuspicionFlags. Then we only call expensive checks when insertions wander off the happy path, or if the caller decides they want different guarantees (e.g. Never, Always, DebugOnly).
Also fix a bunch of other fixes related to code reviews.
* Fixed: Addresses potential triangulation validation failures
Fixes edge cases in triangulation validation and error handling,
particularly around star-split fallback scenarios. Improves
robustness by refining error messages and ensuring consistent
behavior across debug and release builds. Also fixes a potential
issue with duplicate points in triangulation.
Refs: refactor/validation-hierarchy
* Changed: Enhances topology validation and repair
Refactors topology validation to include connectedness checks
and provides more robust error reporting. Introduces automatic
validation policies for incremental insertions, balancing
performance and safety. Improves neighbor pointer repair
logic and adds validation against neighbor cycles.
These changes aim to improve the reliability of the triangulation
process by ensuring a valid topology and reducing the likelihood
of disconnected components and non-manifold facets.
(Internal change: improves validation and repair logic)
* Refactor: Improves triangulation validation and error reporting
Refactors triangulation validation by restructuring the error
hierarchy to avoid circular dependencies between TDS and
Triangulation validation errors.
This change also improves the documentation around the
validation levels and their performance implications, providing
better guidance for users.
Internally, the `remove_cells_by_keys` method in `Tds` is
enhanced to incrementally repair `incident_cell` pointers and
neighbor references, optimizing vertex removal operations. This
avoids global rebuilds.
Refs: refactor/validation-hierarchy
* Changed: Enhances triangulation validation and testing
Updates the triangulation validation process to use the
`validate()` method, providing more comprehensive checks
(Levels 1-4).
Also improves proptest to avoid pathological cases with
duplicate coordinates or points on a coordinate hyperplane,
leading to more robust and reliable tests. (Internal)
Refs: refactor/validation-hierarchy
* Removed: Deprecates global facet sharing fix
Removes the deprecated `fix_invalid_facet_sharing` methods from both
`DelaunayTriangulation` and `Triangulation`.
These methods performed a global O(N·D) scan and have been superseded
by the more efficient localized O(k·D)
`detect_local_facet_issues` + `repair_local_facet_issues` flow.
This change encourages the use of the localized repair approach, which
is more performant for incremental updates to the triangulation.
* Changed: Improves error reporting with cell UUIDs
Enhances error reporting in Delaunay triangulation validation by
including cell UUIDs in error messages. This allows for better
debugging and log correlation when issues arise during
validation. Introduces a helper function to avoid repetition.
Refs: refactor/validation-hierarchy
* Changed: Removes unused imports in tests (internal)
Removes unused imports from several test modules to improve
code cleanliness and reduce potential confusion. This change
is internal and does not affect the functionality of the code.
Refs: refactor/validation-hierarchy1 parent 5ab8086 commit c23cefb
41 files changed
Lines changed: 6260 additions & 1888 deletions
File tree
- benches
- docs
- examples
- src
- core
- algorithms
- traits
- geometry
- algorithms
- topology/traits
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | | - | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
| 252 | + | |
256 | 253 | | |
257 | 254 | | |
258 | 255 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
269 | 259 | | |
270 | 260 | | |
271 | 261 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
143 | 142 | | |
144 | 143 | | |
145 | 144 | | |
146 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
147 | 165 | | |
148 | 166 | | |
149 | 167 | | |
| |||
175 | 193 | | |
176 | 194 | | |
177 | 195 | | |
178 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
179 | 205 | | |
180 | | - | |
| 206 | + | |
181 | 207 | | |
182 | 208 | | |
183 | 209 | | |
184 | 210 | | |
185 | 211 | | |
186 | | - | |
| 212 | + | |
187 | 213 | | |
188 | | - | |
| 214 | + | |
189 | 215 | | |
190 | 216 | | |
191 | 217 | | |
192 | 218 | | |
193 | 219 | | |
194 | | - | |
195 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
196 | 227 | | |
197 | 228 | | |
198 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
362 | 363 | | |
363 | 364 | | |
364 | 365 | | |
| 366 | + | |
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
| 89 | + | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
233 | | - | |
| 232 | + | |
| 233 | + | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
515 | 514 | | |
516 | 515 | | |
517 | 516 | | |
518 | | - | |
519 | | - | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
520 | 522 | | |
521 | | - | |
522 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
523 | 527 | | |
524 | 528 | | |
525 | 529 | | |
| |||
547 | 551 | | |
548 | 552 | | |
549 | 553 | | |
550 | | - | |
551 | | - | |
| 554 | + | |
| 555 | + | |
552 | 556 | | |
553 | 557 | | |
554 | 558 | | |
555 | 559 | | |
556 | 560 | | |
557 | | - | |
| 561 | + | |
558 | 562 | | |
559 | 563 | | |
560 | 564 | | |
| |||
681 | 685 | | |
682 | 686 | | |
683 | 687 | | |
684 | | - | |
685 | | - | |
| 688 | + | |
| 689 | + | |
686 | 690 | | |
687 | 691 | | |
688 | 692 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments