void ManifoldManager::addTetAndUpdateBoundary(Delaunay3::Cell_handle ¤tTet) { //add the current tetrahedron in the manifold set and add it to the boundary if needed currentTet->info().setKeptManifold(true); currentTet->info().setShrinked(false); std::vector<int> notManifoldNeigh; if (isInBoundary(currentTet, notManifoldNeigh)) { insertInBoundary(currentTet); } else { if (currentTet->info().isBoundary()) { removeFromBoundary(currentTet); } currentTet->info().setBoundary(false); } if (notManifoldNeigh.size() == 3) { for (int curV = 0; curV < 4; ++curV) { if (find(notManifoldNeigh.begin(), notManifoldNeigh.end(), curV) == notManifoldNeigh.end()) { currentTet->vertex(curV)->info().setUsed(1); } } } else if (notManifoldNeigh.size() == 4) { for (int curV = 0; curV < 4; ++curV) { currentTet->vertex(notManifoldNeigh[curV])->info().setUsed(1); } } if (notManifoldNeigh.size() == 1) { //when you fill a "hole" currentTet->vertex(notManifoldNeigh[0])->info().setNotUsed(false); } else if (notManifoldNeigh.size() == 0) { for (int curV = 0; curV < 4; ++curV) { currentTet->vertex(curV)->info().setNotUsed(false); } } //Check if the neigh of the added tetrahedron still belongs to the boundary for (int curNeighId = 0; curNeighId < 4; ++curNeighId) { Delaunay3::Cell_handle currNeigh = currentTet->neighbor(curNeighId); //if needed, remove the neighbor of currentTet from the boundary if no facet belongs to the manifold //note that isBoundary function returns the state flag of the tetrahedron, while //isInBoundary() check for the current real state of the tetrahedron inside the triangulation after // the new tetrahedron has been added if (currNeigh->info().isBoundary()) { //We nested this if since it is more efficient to test firstly // if the boundary state flag of the tetrahedron is set true if (!isInBoundary(currNeigh)) { removeFromBoundary(currNeigh); } } else { if (isInBoundary(currNeigh)) { insertInBoundary(currNeigh); } } } }
int GeometryGraph::determineBoundary(int boundaryCount) { return isInBoundary(boundaryCount)?Location::BOUNDARY : Location::INTERIOR; }
bool ManifoldManager::isInBoundary(Delaunay3::Cell_handle &cellToTest) { std::vector<int> toThrowAway; return isInBoundary(cellToTest, toThrowAway); }