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

Function getLargeByVolumeComponents

source/MRMesh/MRMeshComponents.cpp:208–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208FaceBitSet getLargeByVolumeComponents( const MeshPart& mp, float minVolume )
209{
210 if ( !mp.mesh.topology.isClosed( mp.region ) )
211 {
212 assert( !"getLargeByVolumeComponents: require closed mesh part" );
213 return {};
214 }
215 auto mapAndNum = MeshComponents::getAllComponentsMap( mp );
216 Vector<double, RegionId> volumes( mapAndNum.second, 0.0 );
217 auto region = mp.mesh.topology.getFaceIds( mp.region );
218 for ( auto f : region )
219 {
220 auto fp = mp.mesh.getTriPoints( f );
221 volumes[mapAndNum.first[f]] += mixed( Vector3d( fp[0] ), Vector3d( fp[1] ), Vector3d( fp[2] ) );
222 }
223 BitSetParallelFor( region, [&] ( FaceId f )
224 {
225 if ( std::abs( volumes[mapAndNum.first[f]] ) < minVolume )
226 region.reset( f );
227 } );
228 return region;
229}
230
231Expected<FaceBitSet> expandToComponents( const MeshPart& mp, const FaceBitSet& seeds, const ExpandToComponentsParams& params /*= {} */ )
232{

Callers

nothing calls this directly

Calls 7

getAllComponentsMapFunction · 0.85
mixedFunction · 0.85
BitSetParallelForFunction · 0.85
absFunction · 0.85
getTriPointsMethod · 0.80
isClosedMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected