for (int i = 0; edges[i] != -1; i += 3) { // First edge lies between vertex e00 and vertex e01 int e00 = edgeConnections[edges[i]][0]; int e01 = edgeConnections[edges[i]][1];
// Second edge lies between vertex e10 and vertex e11 int e10 = edgeConnections[edges[i + 1]][0]; int e11 = edgeConnections[edges[i + 1]][1];
// Third edge lies between vertex e20 and vertex e21 int e20 = edgeConnections[edges[i + 2]][0]; int e21 = edgeConnections[edges[i + 2]][1]; Triangle tri; tri.a = interp(cornerOffsets[e00], cubeValues[e00], cornerOffsets[e01], cubeValues[e01]) + id; tri.b = interp(cornerOffsets[e10], cubeValues[e10], cornerOffsets[e11], cubeValues[e11]) + id; tri.c = interp(cornerOffsets[e20], cubeValues[e20], cornerOffsets[e21], cubeValues[e21]) + id; _Triangles.Append(tri); }