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

Function getComponentsVerts

source/MRMesh/MRMeshComponents.cpp:429–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427}
428
429VertBitSet getComponentsVerts( const Mesh& mesh, const VertBitSet& seeds, const VertBitSet* region /*= nullptr */ )
430{
431 MR_TIMER;
432
433 VertBitSet res;
434 if ( seeds.none() )
435 return res;
436
437 auto unionFindStruct = getUnionFindStructureVerts( mesh, region );
438 const VertBitSet& vertRegion = mesh.topology.getVertIds( region );
439
440 VertId vertRoot;
441 for ( auto s : seeds )
442 {
443 if ( vertRoot < 0 )
444 vertRoot = unionFindStruct.find( s );
445 else
446 vertRoot = unionFindStruct.unite( vertRoot, s ).first;
447 }
448
449 if ( vertRoot )
450 {
451 const auto& allRoots = unionFindStruct.roots();
452 res.resize( allRoots.size() );
453 BitSetParallelFor( vertRegion, [&]( VertId v )
454 {
455 if ( allRoots[v] == vertRoot )
456 res.set( v );
457 } );
458 }
459 return res;
460}
461
462size_t getNumComponents( const MeshPart& meshPart, FaceIncidence incidence, const UndirectedEdgeBitSet * isCompBd )
463{

Callers

nothing calls this directly

Calls 8

BitSetParallelForFunction · 0.85
noneMethod · 0.80
uniteMethod · 0.80
findMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected