void append_mapped_triangles(STLSolid solid, DMesh3Builder builder, int[] mapV) { int nTris = solid.Vertices.Count / 3; for (int ti = 0; ti < nTris; ++ti) { int a = mapV[3 * ti]; int b = mapV[3 * ti + 1]; int c = mapV[3 * ti + 2]; if (a == b || a == c || b == c) // don't try to add degenerate triangles { continue; } builder.AppendTriangle(a, b, c); } }