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

Function getUniqueRootIds

source/MRMesh/MRPolylineComponents.cpp:20–36  ·  view source on GitHub ↗

returns 1. the mapping: FaceId -> Root ID in [0, 1, 2, ...) 2. the total number of roots

Source from the content-addressed store, hash-verified

18/// 1. the mapping: FaceId -> Root ID in [0, 1, 2, ...)
19/// 2. the total number of roots
20static std::pair<UndirectedEdge2RegionMap, int> getUniqueRootIds( const UndirectedEdgeMap& allRoots, const UndirectedEdgeBitSet& region )
21{
22 MR_TIMER;
23 UndirectedEdge2RegionMap uniqueRootsMap( allRoots.size() );
24 int k = 0;
25 for ( auto ue : region )
26 {
27 auto& uniqIndex = uniqueRootsMap[allRoots[ue]];
28 if ( uniqIndex < 0 )
29 {
30 uniqIndex = RegionId( k );
31 ++k;
32 }
33 uniqueRootsMap[ue] = uniqIndex;
34 }
35 return { std::move( uniqueRootsMap ), k };
36}
37
38}
39

Callers 2

getAllComponentsFunction · 0.70
getLargestComponentFunction · 0.70

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected