mesh-examples/12-14-mesh/Me421.mesh.json
Sources
- MeshFix `checkAndRepair::removeOverlappingTriangles` Branch 2 (*SWAP_CREATES_DEGENERACY*: `else if (e->t1->isExactlyDegenerate() || e->t2->isExactlyDegenerate())`)
- `MESH_HEAL_COVERAGE.md`.
Description
Two coplanar triangles sharing edge (v0=(0,0,0), v1=(2,0,0)). t0 has apex v2=(0,2,0); t1 has apex v3=(0,1,0), which is inside t0 → overlap. Crucially v0, v2, and v3 are all on the y-axis (x=0): after swapping (v0,v1) to (v2,v3), the new triangle (v0,v2,v3) has all three vertices collinear (x=0) → zero area → exactly degenerate. Branch 2 detects this and undoes the swap via `e->swap(1)`.
Reproducer recipe
v0=(0,0,0), v1=(2,0,0), v2=(0,2,0), v3=(0,1,0); t0=(v0,v1,v2), t1=(v0,v1,v3); assert_edge_shared(v0,v1,2); assert_triangles_self_intersect(0,1); assert_vertex_on_edge(v3,v0,v2); assert_adjacent_triangles_normal_dot_gt(0,1,0.99).
Expected kernel behavior
Branch 2 fires; `e->t1->isExactlyDegenerate()` evaluates true for the post-swap triangle (v0,v2,v3) because v3 lies on segment v0–v2; swap is undone.
Expected validation
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes
1{ 2 "vertices": [ 3 [ 4 0.0, 5 0.0, 6 0.0 7 ], 8 [ 9 2.0, 10 0.0, 11 0.0 12 ], 13 [ 14 0.0, 15 2.0, 16 0.0 17 ], 18 [ 19 0.0, 20 1.0, 21 0.0 22 ] 23 ], 24 "triangles": [ 25 [ 26 0, 27 1, 28 2 29 ], 30 [ 31 0, 32 1, 33 3 34 ] 35 ], 36 "metadata": { 37 "id": "Me421", 38 "schema_version": 0, 39 "defect_class": "overlapping_triangles", 40 "title": "removeOverlappingTriangles SWAP_CREATES_DEGENERACY: post-swap triangle degenerate; undo swap (Branch 2)", 41 "assertions": [ 42 { 43 "kind": "edge_shared_by_n_triangles", 44 "edge": [ 45 0, 46 1 47 ], 48 "n": 2 49 }, 50 { 51 "kind": "triangles_self_intersect", 52 "triangles": [ 53 0, 54 1 55 ] 56 }, 57 { 58 "kind": "vertex_on_edge", 59 "vertex": 3, 60 "edge": [ 61 0, 62 2 63 ] 64 }, 65 { 66 "kind": "adjacent_triangles_normal_dot_gt", 67 "triangles": [ 68 0, 69 1 70 ], 71 "threshold": 0.99 72 } 73 ] 74 } 75}