| 720 | } |
| 721 | |
| 722 | std::vector<UndirectedEdgeBitSet> getAllComponentsUndirectedEdges( const Mesh& mesh, const UndirectedEdgeBitSet& edges ) |
| 723 | { |
| 724 | MR_TIMER; |
| 725 | |
| 726 | auto unionFindStruct = getUnionFindStructureVerts( mesh, edges ); |
| 727 | |
| 728 | const auto& allRoots = unionFindStruct.roots(); |
| 729 | constexpr int InvalidRoot = -1; |
| 730 | std::vector<int> uniqueRootsMap( allRoots.size(), InvalidRoot ); |
| 731 | int k = 0; |
| 732 | |
| 733 | for ( auto ue : edges ) |
| 734 | { |
| 735 | const EdgeId e{ ue }; |
| 736 | int curRoot = allRoots[mesh.topology.org( e )]; |
| 737 | auto& uniqIndex = uniqueRootsMap[curRoot]; |
| 738 | if ( uniqIndex == InvalidRoot ) |
| 739 | { |
| 740 | uniqIndex = k; |
| 741 | ++k; |
| 742 | } |
| 743 | } |
| 744 | std::vector<UndirectedEdgeBitSet> res( k, UndirectedEdgeBitSet( edges.size() ) ); |
| 745 | for ( auto ue : edges ) |
| 746 | { |
| 747 | const EdgeId e{ ue }; |
| 748 | int curRoot = allRoots[mesh.topology.org( e )]; |
| 749 | res[uniqueRootsMap[curRoot]].set( ue ); |
| 750 | } |
| 751 | return res; |
| 752 | } |
| 753 | |
| 754 | bool hasFullySelectedComponent( const MeshTopology& topology, const VertBitSet & selection ) |
| 755 | { |
no test coverage detected