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

Function getUnionFindStructure

source/MRMesh/MRPolylineComponents.cpp:123–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123UnionFind<MR::UndirectedEdgeId> getUnionFindStructure( const PolylineTopology& topology )
124{
125 MR_TIMER;
126
127 auto size = topology.undirectedEdgeSize();
128
129 UnionFind<UndirectedEdgeId> unionFindStructure( size );
130 for ( auto u0 : undirectedEdges( topology ) )
131 {
132 auto u1 = topology.next( u0 );
133 auto u2 = topology.next( EdgeId( u0 ).sym() );
134 if ( u1.valid() && u1.undirected() != u0 )
135 unionFindStructure.unite( u0, u1.undirected() );
136 if ( u2.valid() && u2.undirected() != u0 )
137 unionFindStructure.unite( u0, u2.undirected() );
138 }
139 return unionFindStructure;
140}
141
142template <typename V>
143std::vector<UndirectedEdgeBitSet> getNLargeByLengthComponents( const Polyline<V>& polyline, const LargeByLengthComponentsSettings& settings )

Callers 5

getNumComponentsFunction · 0.85
getComponentFunction · 0.85
getAllComponentsFunction · 0.85
getLargestComponentFunction · 0.85

Calls 7

undirectedMethod · 0.80
uniteMethod · 0.80
undirectedEdgesFunction · 0.70
undirectedEdgeSizeMethod · 0.45
nextMethod · 0.45
symMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected