public ConwayPoly Cylinderize(OpParams o) { var vertexPoints = new List <Vector3>(); var faceIndices = ListFacesByVertexIndices(); for (var vertexIndex = 0; vertexIndex < Vertices.Count; vertexIndex++) { float amount = o.GetValueA(this, vertexIndex); var vertex = Vertices[vertexIndex]; if (IncludeVertex(vertexIndex, o.facesel, o.TagListFromString(), o.filterFunc)) { var normalized = new Vector2(vertex.Position.x, vertex.Position.z).normalized; var result = new Vector3(normalized.x, vertex.Position.y, normalized.y); vertexPoints.Add(Vector3.LerpUnclamped(vertex.Position, result, amount)); VertexRoles[vertexIndex] = Roles.Existing; } else { vertexPoints.Add(vertex.Position); VertexRoles[vertexIndex] = Roles.Ignored; } } var conway = new ConwayPoly(vertexPoints, faceIndices, FaceRoles, VertexRoles, FaceTags); return(conway); }
public List <Vector3> GetFaceCentroids(OpParams o) { var centroids = new List <Vector3>(); for (var faceIndex = 0; faceIndex < Faces.Count; faceIndex++) { if (!IncludeFace(faceIndex, o.facesel, o.TagListFromString(), o.filterFunc)) { continue; } centroids.Add(Faces[faceIndex].Centroid); } return(centroids); }
public void TagFaces(string tags, FaceSelections facesel = FaceSelections.All, Func <FilterParams, bool> filter = null, bool introvert = false) { if (FaceTags == null || FaceTags.Count == 0) { InitTags(); } var newTagList = OpParams.TagListFromString(tags, introvert); int counter = 0; for (var i = 0; i < Faces.Count; i++) { if (IncludeFace(i, facesel, null, filter)) { var existingTagSet = FaceTags[i]; existingTagSet.UnionWith(newTagList); FaceTags[i] = existingTagSet; counter++; } } }