public static void SetCaseTable() { CaseTable = new FaceEdges[1 << 4]; for (int idx = 0; idx < 1 << 4; idx++) { int c1 = 0, c2 = 0; CaseTable[idx] = new FaceEdges(); for (int i = 0; i < 4; i++) { OrientedEdgeCorners(i, ref c1, ref c2); if ((idx & (1 << c1)) == 0 && (idx & (1 << c2)) != 0) { CaseTable[idx].Edges[CaseTable[idx].Count++].First = i; } } CaseTable[idx].Count = 0; for (int i = 0; i < 4; i++) { OrientedEdgeCorners(i, ref c1, ref c2); if ((idx & (1 << c1)) != 0 && (idx & (1 << c2)) == 0) { CaseTable[idx].Edges[CaseTable[idx].Count++].Second = i; } } } }
public static void PrintCaseTable() { SetCaseTable(); for (int idx = 0; idx < 1 << 4; idx++) { FaceEdges f = CaseTable[idx]; StringBuilder s = new StringBuilder(); s.Append(idx.ToString() + ": "); s.Append("Count=" + f.Count); s.Append(" Edges="); for (int i = 0; i < 2; i++) { s.Append(f.Edges[i].First); s.Append(", " + f.Edges[i].Second + (i == 0 ? ", " : "")); } Console.WriteLine(s.ToString()); } }
public static void SetCaseTable() { CaseTable = new FaceEdges[1 << 4]; for (int idx = 0; idx < 1 << 4; idx++) { int c1 = 0, c2 = 0; CaseTable[idx] = new FaceEdges(); for (int i = 0; i < 4; i++) { OrientedEdgeCorners(i, ref c1, ref c2); if ((idx & (1 << c1)) == 0 && (idx & (1 << c2)) != 0) CaseTable[idx].Edges[CaseTable[idx].Count++].First = i; } CaseTable[idx].Count = 0; for (int i = 0; i < 4; i++) { OrientedEdgeCorners(i, ref c1, ref c2); if ((idx & (1 << c1)) != 0 && (idx & (1 << c2)) == 0) CaseTable[idx].Edges[CaseTable[idx].Count++].Second = i; } } }