public Region[] GetRegion(Dictionary <TriMesh.Vertex, int> vertexDict) { List <List <TriMesh.Face> > partition = TriMeshUtil.RetrieveFacePatchBySelectedEdge(mesh); List <Region> list = new List <Region>(); foreach (var part in partition) { bool[] regionFlags = new bool[this.mesh.Faces.Count]; foreach (var face in part) { regionFlags[face.Index] = true; } TriMesh.Vertex center = null; foreach (var max in morseVertice.MaxList) { foreach (var face in max.Faces) { if (regionFlags[face.Index]) { center = max; } } } TriMesh.HalfEdge[] boundary = TriMeshUtil.RetrieveRegionBoundaryHalfEdge(this.mesh, regionFlags); List <TriMesh.Vertex> round = new List <HalfEdgeMesh.Vertex>(); foreach (var hf in boundary) { if (vertexDict.ContainsKey(hf.ToVertex)) { round.Add(hf.ToVertex); } hf.Edge.Traits.SelectedFlag = 1; hf.Edge.Traits.Color = Color4.Red; } list.Add(new Region { Center = center, Round = round.ToArray() }); } return(list.ToArray()); }