| 128 | } |
| 129 | |
| 130 | VertBitSet 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 | |
| 152 | VertBitSet getLargeComponentVerts( const Mesh& mesh, int minVerts, const VertBitSet* region ) |
| 153 | { |