mesh-examples/12-14-mesh/Me1103.mesh.json
Sources
- MeshFix `Basic_TMesh.CreateTriangleFromVertices` Branch 4 (*DEGENERATE_TRIANGLE*) @ line 270 (`if ((t=CreateUnorientedTriangle(e1,e2,e3)) == NULL) { ... }`)
- `MESH_HEAL_COVERAGE.md`.
Description
triangle td=(v0,v1,v2) has three collinear vertices on the X axis — area exactly zero. CreateUnorientedTriangle returns NULL → Branch 4 fires the primary null-check guard. All three edges e1=(v0,v1), e2=(v1,v2), e3=(v0,v2) of td are freshly created with no incident triangles (unlinked). Two valid control triangles tc0=(va,v0,vb) and tc1=(va,vb,v2) share no edges with td. Branch 4 detects e3->t1==NULL && e3->t2==NULL and frees e3; the cascade continues through Branches 5 and 6 to free e2 and e1.
Reproducer recipe
v0=(0,0,0), v1=(1,0,0), v2=(2,0,0), va=(1,2,0), vb=(3,1,0); tc0=(va,v0,vb), tc1=(va,vb,v2); td=(v0,v1,v2) collinear; area_lt(td,1e-12); edges (v0,v1),(v1,v2),(v0,v2) all n=1; (va,vb) n=2 (shared by tc0 and tc1).
Expected kernel behavior
CreateUnorientedTriangle returns NULL; e3->t1==NULL && e3->t2==NULL → freeNode(e3); cascade frees e2 (Branch 5) and e1 (Branch 6); vertex edge-list refs cleared.
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 1.0, 10 0.0, 11 0.0 12 ], 13 [ 14 2.0, 15 0.0, 16 0.0 17 ], 18 [ 19 1.0, 20 2.0, 21 0.0 22 ], 23 [ 24 3.0, 25 1.0, 26 0.0 27 ] 28 ], 29 "triangles": [ 30 [ 31 3, 32 0, 33 4 34 ], 35 [ 36 3, 37 4, 38 2 39 ], 40 [ 41 0, 42 1, 43 2 44 ] 45 ], 46 "metadata": { 47 "id": "Me1103", 48 "schema_version": 0, 49 "defect_class": "degenerate_triangle", 50 "title": "CreateTriangleFromVertices_degenerate_triangle: collinear v0-v1-v2; all edges unlinked; Branch 4 null-guard frees e3=(v1\u2192v2\u2192v0)", 51 "assertions": [ 52 { 53 "kind": "triangle_area_lt", 54 "triangle": 2, 55 "lt": 1e-12 56 }, 57 { 58 "kind": "edge_shared_by_n_triangles", 59 "edge": [ 60 0, 61 1 62 ], 63 "n": 1 64 }, 65 { 66 "kind": "edge_shared_by_n_triangles", 67 "edge": [ 68 1, 69 2 70 ], 71 "n": 1 72 }, 73 { 74 "kind": "edge_shared_by_n_triangles", 75 "edge": [ 76 0, 77 2 78 ], 79 "n": 1 80 }, 81 { 82 "kind": "edge_shared_by_n_triangles", 83 "edge": [ 84 0, 85 3 86 ], 87 "n": 1 88 }, 89 { 90 "kind": "edge_shared_by_n_triangles", 91 "edge": [ 92 0, 93 4 94 ], 95 "n": 1 96 }, 97 { 98 "kind": "edge_shared_by_n_triangles", 99 "edge": [ 100 3, 101 4 102 ], 103 "n": 2 104 }, 105 { 106 "kind": "edge_shared_by_n_triangles", 107 "edge": [ 108 2, 109 4 110 ], 111 "n": 1 112 }, 113 { 114 "kind": "edge_shared_by_n_triangles", 115 "edge": [ 116 2, 117 3 118 ], 119 "n": 1 120 } 121 ] 122 } 123}