public void Generate() { poly = JohnsonPoly.Build(JohnsonPolyType, sides); if (ApplyOp) { var o1 = new OpParams { valueA = op1Amount1, valueB = op1Amount2, facesel = op1Facesel }; poly = poly.ApplyOp(op1, o1); } // Find and remove the edge loop var face = poly.Faces[ConwayPoly.ActualMod(StartingFace, poly.Faces.Count)]; var edges = face.GetHalfedges(); var startingEdge = edges[ConwayPoly.ActualMod(StartingEdge, edges.Count)]; loop = poly.GetFaceLoop(startingEdge); var faceIndices = loop.Select(x => x.Item1).ToList(); if (LoopAction == LoopActions.Remove) { poly = poly.FaceRemove(false, faceIndices); } else if (LoopAction == LoopActions.Keep) { poly = poly.FaceRemove(true, faceIndices); } else if (LoopAction == LoopActions.SplitFaces) { poly = poly.SplitLoop(loop); } else if (LoopAction == LoopActions.Split) { ConwayPoly otherPoly; (otherPoly, poly) = poly.Split(new OpParams(x => faceIndices.Contains(x.index))); poly.FaceRoles = Enumerable.Repeat(ConwayPoly.Roles.Existing, poly.Faces.Count).ToList(); poly.VertexRoles = Enumerable.Repeat(ConwayPoly.Roles.Existing, poly.Vertices.Count).ToList(); otherPoly.FaceRoles = Enumerable.Repeat(ConwayPoly.Roles.New, otherPoly.Faces.Count).ToList(); otherPoly.VertexRoles = Enumerable.Repeat(ConwayPoly.Roles.New, otherPoly.Vertices.Count).ToList(); poly.Append(otherPoly); } else if (LoopAction == LoopActions.SetRole) { var faceRoles = new List <ConwayPoly.Roles>(); for (var faceIndex = 0; faceIndex < poly.Faces.Count; faceIndex++) { faceRoles.Add(faceIndices.Contains(faceIndex) ? ConwayPoly.Roles.Existing : ConwayPoly.Roles.New); } poly.FaceRoles = faceRoles; } if (ApplyOp) { var o2 = new OpParams { valueA = op2Amount1, valueB = op2Amount2, facesel = op2Facesel }; poly = poly.ApplyOp(op2, o2); } if (Canonicalize) { poly = poly.Canonicalize(0.1, 0.1); } poly = poly.Transform(Position, Rotation, Scale); var mesh = PolyMeshBuilder.BuildMeshFromConwayPoly(poly, false, null, ColorMethod); GetComponent <MeshFilter>().mesh = mesh; }