public void FindOpMatches(ConwayPoly sourcePoly, string sourcePolyName, ConwayPoly targetPoly, string targetPolyName) { // int v = poly.Vertices.Count; // int e = poly.EdgeCount; // int f = poly.Faces.Count; // // // Compare predicted and actual v,e,f // Debug.Log($"{v} {e} {f} = {PolyHydraEnums.CalcVef(poly, op2)}"); // Loops through all Conway ops and records which ones // Result in matching Vertex, Edge and Face counts var matches = new Dictionary <int[], List <Ops> >(); // For all ops use: // var opCount = ((Ops[]) Enum.GetValues(typeof(Ops))).Length; // Just the conway ops var opCount = 34; var targetFaceTypes = targetPoly.GetFaceCountsByType(); for (var i = 1; i < 34; i++) { var o = new OpParams { valueA = 0.2f, valueB = 0.2f, facesel = FaceSelections.All }; var newPoly = sourcePoly.ApplyOp((Ops)i, o); var sourceFaceTypes = newPoly.GetFaceCountsByType(); if (!sourceFaceTypes.SequenceEqual(targetFaceTypes)) { continue; } if (!matches.ContainsKey(sourceFaceTypes)) { matches[sourceFaceTypes] = new List <Ops>(); } matches[sourceFaceTypes].Add((Ops)i); } if (matches.Count < 1) { return; } Debug.Log($"Matching {sourcePolyName} and {targetPolyName}: {matches.Count} matches"); foreach (var match in matches) { // if (match.Value.Count < 2) continue; var lst = string.Join(",", match.Value); Debug.Log($"{lst}"); } }