MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / removeTriangles

Method removeTriangles

include/CDT/include/Triangulation.hpp:144–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142
143template <typename T, typename TNearPointLocator>
144void Triangulation<T, TNearPointLocator>::removeTriangles(
145 const TriIndUSet& removedTriangles)
146{
147 if(removedTriangles.empty())
148 return;
149 // remove triangles and calculate triangle index mapping
150 TriIndUMap triIndMap;
151 for(TriInd iT(0), iTnew(0); iT < TriInd(triangles.size()); ++iT)
152 {
153 if(removedTriangles.count(iT))
154 continue;
155 triIndMap[iT] = iTnew;
156 triangles[iTnew] = triangles[iT];
157 iTnew++;
158 }
159 triangles.erase(triangles.end() - removedTriangles.size(), triangles.end());
160 // adjust triangles' neighbors
161 for(TriInd iT(0); iT < triangles.size(); ++iT)
162 {
163 Triangle& t = triangles[iT];
164 // update neighbors to account for removed triangles
165 NeighborsArr3& nn = t.neighbors;
166 for(NeighborsArr3::iterator n = nn.begin(); n != nn.end(); ++n)
167 {
168 if(removedTriangles.count(*n))
169 {
170 *n = noNeighbor;
171 }
172 else if(*n != noNeighbor)
173 {
174 *n = triIndMap[*n];
175 }
176 }
177 }
178}
179
180template <typename T, typename TNearPointLocator>
181TriIndVec& Triangulation<T, TNearPointLocator>::VertTrisInternal()

Callers

nothing calls this directly

Calls 6

emptyMethod · 0.45
sizeMethod · 0.45
countMethod · 0.45
eraseMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected