internal PlanningSurface(PrimitiveSurfaceType SurfaceType, params FaceWithScores[] Faces) { this.SurfaceType = SurfaceType; this.Faces = new List <FaceWithScores>(Faces); foreach (var polygonalFace in Faces) { Area += polygonalFace.Face.Area; } }
private static void EdgesLeadToDesiredFaceCatFinder(FaceWithScores face, PrimitiveSurfaceType p, List <List <int> > faceRules) { // This function takes a face and a possible category and returns // edges which lead to that category // We need to define some rules. for example, if the p is F, with // combination of F F SE, then return edges of F and F. //eltc = [faceRules[4][i],faceRules[5][i],faceRules[6][i]]; var edges = new List <Edge>(); var com = face.CatToCom[p]; var edgesFD = new Edge[3]; ///////////////////////////////////////////////////////////////////// // Checking the equality of 2 arrays: com and comb foreach (var comb in face.ComToEdge.Keys) { var counter = 0; var list = new List <int>(); for (var m = 0; m < 3; m++) { for (var n = 0; n < 3; n++) { if (!list.Contains(n)) { if (com[m] == comb[n]) { counter++; list.Add(n); break; } } } } bool equals = counter == 3; if (@equals) { for (int i = 0; i < 3; i++) { edgesFD[i] = face.ComToEdge[comb][i]; } } } ///////////////////////////////////////////////////////////////////// for (var i = 0; i < faceRules[0].Count; i++) { var arrayOfRule = new[] { faceRules[0][i], faceRules[1][i], faceRules[2][i] }; /*var q = from a in com * join b in arrayOfRule on a equals b * select a; * bool equals = com.Length == arrayOfRule.Length && q.Count() == com.Length;*/ // Checking the equality of 2 arrays:com and arrayOfRules var counter = 0; var list = new List <int>(); for (var m = 0; m < 3; m++) { for (var n = 0; n < 3; n++) { if (!list.Contains(n)) { if (com[m] == arrayOfRule[n]) { counter++; list.Add(n); break; } } } } bool equals = counter == 3; arrayOfRule.OrderBy(n => n).ToArray(); if (@equals) { var EdgesLead = new[] { faceRules[4][i], faceRules[5][i], faceRules[6][i] }; var SortedEL = EdgesLead.OrderBy(n => n).ToArray(); for (var t = 0; t < 3; t++) //foreach (var EL in SortedEL.Where(a => a != 1000)) { if (SortedEL[t] == 1000) { continue; } //var index = Array.IndexOf(SortedEL, EL); edges.Add(edgesFD[t]); } break; //return edges; } } face.CatToELDC.Add(p, edges); //return null; }