private static void BuildNeighborsLists(AdjacencySets adjSets, List <Vector3> neighbors, List <int> neighborIndices, int i, Vector3[] vertices) { HashSet <int> aSet = adjSets.GetAdjacencySet(i); foreach (int index in aSet) { if (i != index) { neighbors.Add(vertices[index]); neighborIndices.Add(index); } } }
private static bool IsInsideVertex(List <Vector3> neighbors, List <int> nIndices, AdjacencySets aSets) { int nbNeighbors; // number of neighbors that each neighbor possesses HashSet <int> aSet; // First we iterate over every neighbor of the "central" vertex we consider for (int nIndex = 0; nIndex < neighbors.Count; nIndex++) { // We then get the adjacency set containing *its* neighbors aSet = aSets.GetAdjacencySet(nIndices[nIndex]); nbNeighbors = 0; // We now iterate over this set. If any value in it is also in the nIndices list, // i.e. in the list of neighbors of our "central" vertex, we increment the number // of neighbors. foreach (int a in aSet) { if (nIndices.Contains(a)) { nbNeighbors++; } } // If this number is less than two, this means one of the neighbors of the central // vertex has less than two neighbors that are also a neighbor of the central vertex. // In other words, the central vertex is on an edge of the mesh. if (nbNeighbors < 2) { return(false); } } // If the function has never returned false, then the vertex is not on an edge. // It can be moved. return(true); }