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

Function getLargestComponentVerts

source/MRMesh/MRMeshComponents.cpp:130–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130VertBitSet getLargestComponentVerts( const Mesh& mesh, const VertBitSet* region /*= nullptr */ )
131{
132 MR_TIMER;
133
134 auto unionFindStruct = getUnionFindStructureVerts( mesh, region );
135
136 VertId largestRoot;
137 int largestNumVerts = 0;
138 for ( auto r : findRootsBitSet( unionFindStruct, region ) )
139 {
140 if ( !largestRoot || largestNumVerts < unionFindStruct.sizeOfComp( r ) )
141 {
142 largestRoot = r;
143 largestNumVerts = unionFindStruct.sizeOfComp( r );
144 }
145 }
146 if ( !largestRoot )
147 return {}; // e.g. empty region
148
149 return findComponentBitSet( unionFindStruct, largestRoot, region );
150}
151
152VertBitSet getLargeComponentVerts( const Mesh& mesh, int minVerts, const VertBitSet* region )
153{

Callers 1

TESTFunction · 0.85

Calls 4

findRootsBitSetFunction · 0.85
findComponentBitSetFunction · 0.85
sizeOfCompMethod · 0.80

Tested by 1

TESTFunction · 0.68