Me902 — orient_triangle_soup_with_reference_triangle_soup orientation_flip_decision: t1 CW winding gives normal -Z; dot product with reference normal +Z is negative; t1 flipped (Branch 3)

§12.14 mesh defects (sub-class: inverted-normal / orientation-flip-decision)

topology

Sources

Description

Two adjacent query triangles sharing interior edge (p0,p2). t0=(p0,p1,p2) is CCW (normal +Z); t1=(p2,p0,p3) is CW (normal −Z) — winding is reversed relative to t0 and the reference. Reference soup has two matching CCW triangles (ref_t0, ref_t1) at z=−1. For t1 the dot product of its normal (−Z) with the nearest reference normal (+Z) is −1 < 0 → Branch 3 fires and t1 is flipped. Interior edge (p0,p2) n=2; four boundary edges n=1; Euler V=4, E=5, F=2, chi=1.

Reproducer recipe

p0=(0,0,0), p1=(2,0,0), p2=(1,1,0), p3=(0,2,0); r0=(0,0,-1), r1=(2,0,-1), r2=(1,1,-1), r3=(0,2,-1); t0=(p0,p1,p2), t1=(p2,p0,p3); ref_t0=(r0,r1,r2), ref_t1=(r0,r2,r3); assert_edge_shared(p0,p2,2); boundary edges n=1; assert_triangle_normal_z_negative(t1); assert_adjacent_triangles_inconsistent_winding(t0,t1); euler V=4,E=5,F=2,chi=1.

Expected kernel behavior

Branch 3 fires for t1; dot_product(t1_normal, ref_normal) = dot_product(-Z, +Z) = -1 < 0; t1 winding is reversed by the algorithm to align with the reference orientation.

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      1.0,
15      1.0,
16      0.0
17    ],
18    [
19      0.0,
20      2.0,
21      0.0
22    ],
23    [
24      0.0,
25      0.0,
26      -1.0
27    ],
28    [
29      2.0,
30      0.0,
31      -1.0
32    ],
33    [
34      1.0,
35      1.0,
36      -1.0
37    ],
38    [
39      0.0,
40      2.0,
41      -1.0
42    ]
43  ],
44  "triangles": [
45    [
46      0,
47      1,
48      2
49    ],
50    [
51      2,
52      0,
53      3
54    ],
55    [
56      4,
57      5,
58      6
59    ],
60    [
61      4,
62      6,
63      7
64    ]
65  ],
66  "metadata": {
67    "id": "Me902",
68    "schema_version": 0,
69    "defect_class": "inverted_normal",
70    "title": "orient_triangle_soup_with_reference_triangle_soup orientation_flip_decision: t1 CW winding gives normal -Z; dot product with reference normal +Z is negative; t1 flipped (Branch 3)",
71    "assertions": [
72      {
73        "kind": "edge_shared_by_n_triangles",
74        "edge": [
75          0,
76          2
77        ],
78        "n": 2
79      },
80      {
81        "kind": "edge_shared_by_n_triangles",
82        "edge": [
83          0,
84          1
85        ],
86        "n": 1
87      },
88      {
89        "kind": "edge_shared_by_n_triangles",
90        "edge": [
91          1,
92          2
93        ],
94        "n": 1
95      },
96      {
97        "kind": "edge_shared_by_n_triangles",
98        "edge": [
99          2,
100          3
101        ],
102        "n": 1
103      },
104      {
105        "kind": "edge_shared_by_n_triangles",
106        "edge": [
107          0,
108          3
109        ],
110        "n": 1
111      },
112      {
113        "kind": "triangle_normal_z_negative",
114        "triangle": 1
115      },
116      {
117        "kind": "adjacent_triangles_inconsistent_winding",
118        "triangles": [
119          0,
120          1
121        ]
122      },
123      {
124        "kind": "euler_characteristic",
125        "v": 4,
126        "e": 5,
127        "f": 2,
128        "chi": 1
129      }
130    ]
131  }
132}