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

Function getAllComponentsEdges

source/MRMesh/MRMeshComponents.cpp:691–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691std::vector<EdgeBitSet> getAllComponentsEdges( const Mesh& mesh, const EdgeBitSet & edges )
692{
693 MR_TIMER;
694 auto unionFindStruct = getUnionFindStructureVerts( mesh, edges );
695
696 const auto& allRoots = unionFindStruct.roots();
697 constexpr int InvalidRoot = -1;
698 std::vector<int> uniqueRootsMap( allRoots.size(), InvalidRoot );
699 int k = 0;
700 EdgeId eMax;
701 for ( auto e : edges )
702 {
703 if ( eMax < e )
704 eMax = e;
705 int curRoot = allRoots[ mesh.topology.org( e ) ];
706 auto& uniqIndex = uniqueRootsMap[curRoot];
707 if ( uniqIndex == InvalidRoot )
708 {
709 uniqIndex = k;
710 ++k;
711 }
712 }
713 std::vector<EdgeBitSet> res( k, EdgeBitSet( eMax + 1 ) );
714 for ( auto e : edges )
715 {
716 int curRoot = allRoots[ mesh.topology.org( e ) ];
717 res[uniqueRootsMap[curRoot]].set( e );
718 }
719 return res;
720}
721
722std::vector<UndirectedEdgeBitSet> getAllComponentsUndirectedEdges( const Mesh& mesh, const UndirectedEdgeBitSet& edges )
723{

Callers 1

TESTFunction · 0.85

Calls 4

sizeMethod · 0.45
orgMethod · 0.45
setMethod · 0.45

Tested by 1

TESTFunction · 0.68