MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / addTrianglesSeqCore

Function addTrianglesSeqCore

source/MRMesh/MRMeshBuilder.cpp:224–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224static size_t addTrianglesSeqCore( MeshTopology& res, const Triangulation & t, const BuildSettings & settings = {} )
225{
226 MR_TIMER;
227
228 FaceAdder fa;
229 // we will try to add these triangles in the current pass
230 FaceBitSet active = getLocalRegion( settings.region, t.size() );
231 // these are triangles that cannot be added even after other triangles
232 FaceBitSet bad;
233 size_t triAddedTotal = 0;
234 for (;;)
235 {
236 size_t triAddedOnThisPass = 0;
237 for ( FaceId f : active )
238 {
239 auto x = fa.add( res, f + settings.shiftFaceId, t[f].data(), t[f].data() + 3, settings.allowNonManifoldEdge );
240 if ( x == AddFaceResult::UnsafeTryLater )
241 continue;
242 active.reset( f );
243 if ( x != AddFaceResult::Success )
244 bad.autoResizeSet( f );
245 else
246 ++triAddedOnThisPass;
247 }
248
249 if ( triAddedOnThisPass == 0 )
250 break; // no single triangle added during the pass
251 triAddedTotal += triAddedOnThisPass;
252 }
253 if ( settings.region || settings.skippedFaceCount )
254 {
255 active |= bad;
256 if ( settings.skippedFaceCount )
257 *settings.skippedFaceCount = (int)active.count();
258 if ( settings.region )
259 *settings.region = std::move( active );
260 }
261 return triAddedTotal;
262}
263
264MeshTopology fromFaceSoup( const std::vector<VertId> & verts, const Vector<VertSpan, FaceId> & faces,
265 const BuildSettings & settings, ProgressCallback progressCb )

Callers 2

addTrianglesFunction · 0.85
fromDisjointMeshPiecesFunction · 0.85

Calls 7

getLocalRegionFunction · 0.85
countMethod · 0.80
sizeMethod · 0.45
addMethod · 0.45
dataMethod · 0.45
resetMethod · 0.45
autoResizeSetMethod · 0.45

Tested by

no test coverage detected