MeshLib C++ Docs
Loading...
Searching...
No Matches
MRPolylineComponents.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRUnionFind.h"
4
5namespace MR
6{
9
10
11namespace PolylineComponents
12{
13
15[[nodiscard]] MRMESH_API size_t getNumComponents( const PolylineTopology& topology);
16
20MRMESH_API UndirectedEdgeBitSet getComponent( const PolylineTopology& topology, UndirectedEdgeId id );
21
22
26MRMESH_API std::vector<UndirectedEdgeBitSet> getAllComponents( const PolylineTopology& topology );
27
33MRMESH_API std::pair<std::vector<UndirectedEdgeBitSet>, int> getAllComponents( const PolylineTopology& topology, int maxComponentCount );
34
36{
39
41 int* numSmallerComponents = nullptr;
42
44 float minLength = 0;
45};
46
49template<typename V>
50std::vector<UndirectedEdgeBitSet> getNLargeByLengthComponents( const Polyline<V>& polyline, const LargeByLengthComponentsSettings& settings );
51
52MR_BIND_TEMPLATE( std::vector<UndirectedEdgeBitSet> getNLargeByLengthComponents( const Polyline2& polyline, const LargeByLengthComponentsSettings& settings ) )
53MR_BIND_TEMPLATE( std::vector<UndirectedEdgeBitSet> getNLargeByLengthComponents( const Polyline3& polyline, const LargeByLengthComponentsSettings& settings ) )
54
55
57MRMESH_API UnionFind<UndirectedEdgeId> getUnionFindStructure( const PolylineTopology& topology );
58
61template <typename V>
62UndirectedEdgeBitSet getLargestComponent( const Polyline<V>& polyline, float minLength = 0, int* numSmallerComponents = nullptr );
63
64MR_BIND_TEMPLATE( UndirectedEdgeBitSet getLargestComponent( const Polyline2& polyline, float minLength = 0, int* numSmallerComponents = nullptr ) )
65MR_BIND_TEMPLATE( UndirectedEdgeBitSet getLargestComponent( const Polyline3& polyline, float minLength = 0, int* numSmallerComponents = nullptr ) )
66
67}
68
69}
Definition MRPolylineTopology.h:18
Union-find data structure for representing disjoin sets of elements with few very quick operations: 1...
Definition MRUnionFind.h:23
UndirectedEdgeBitSet getLargestComponent(const Polyline< V > &polyline, float minLength=0, int *numSmallerComponents=nullptr)
MRMESH_API UnionFind< UndirectedEdgeId > getUnionFindStructure(const PolylineTopology &topology)
MRMESH_API std::vector< UndirectedEdgeBitSet > getAllComponents(const PolylineTopology &topology)
MRMESH_API UndirectedEdgeBitSet getComponent(const PolylineTopology &topology, UndirectedEdgeId id)
std::vector< UndirectedEdgeBitSet > getNLargeByLengthComponents(const Polyline< V > &polyline, const LargeByLengthComponentsSettings &settings)
int * numSmallerComponents
optional output: the number of components in addition to returned ones
Definition MRPolylineComponents.h:41
MRMESH_API size_t getNumComponents(const PolylineTopology &topology)
returns the number of connected components in polyline
int maxLargeComponents
return at most given number of largest by length connected components
Definition MRPolylineComponents.h:38
float minLength
do not consider a component large if its length is below this value
Definition MRPolylineComponents.h:44
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRPolyline.h:18