MeshLib C++ Docs
Loading...
Searching...
No Matches
MREdgePaths.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRId.h"
4#include "MREdgeMetric.h"
6#include <cfloat>
7#include <vector>
8
9namespace MR
10{
13
14
17
19[[nodiscard]] MRMESH_API bool isEdgePath( const MeshTopology & topology, const std::vector<EdgeId> & edges );
20
22[[nodiscard]] MRMESH_API bool isEdgeLoop( const MeshTopology & topology, const std::vector<EdgeId> & edges );
23
25[[nodiscard]] MRMESH_API std::vector<EdgeLoop> splitOnSimpleLoops( const MeshTopology & topology, std::vector<EdgeLoop> && loops );
26
29MRMESH_API void reverse( EdgePath & path );
31MRMESH_API void reverse( std::vector<EdgePath> & paths );
32
34[[nodiscard]] MRMESH_API double calcPathMetric( const EdgePath & path, EdgeMetric metric );
35[[nodiscard]] inline double calcPathLength( const EdgePath & path, const Mesh & mesh ) { return calcPathMetric( path, edgeLengthMetric( mesh ) ); }
36
39[[nodiscard]] MRMESH_API Vector3d calcOrientedArea( const EdgeLoop & loop, const Mesh & mesh );
40
42MRMESH_API void sortPathsByMetric( std::vector<EdgePath> & paths, EdgeMetric metric );
43inline void sortPathsByLength( std::vector<EdgePath> & paths, const Mesh & mesh ) { sortPathsByMetric( paths, edgeLengthMetric( mesh ) ); }
44
46MRMESH_API void addLeftBand( const MeshTopology & topology, const EdgeLoop & loop, FaceBitSet & addHere );
47
51{
52 VertId v;
53 float metric = 0;
54};
55
58[[nodiscard]] MRMESH_API EdgePath buildShortestPath( const Mesh & mesh, VertId start, VertId finish, float maxPathLen = FLT_MAX );
62[[nodiscard]] MRMESH_API EdgePath buildShortestPathBiDir( const Mesh & mesh, VertId start, VertId finish, float maxPathLen = FLT_MAX );
67[[nodiscard]] MRMESH_API EdgePath buildShortestPathBiDir( const Mesh & mesh,
68 const MeshTriPoint & start, const MeshTriPoint & finish,
69 VertId * outPathStart = nullptr,
70 VertId * outPathFinish = nullptr,
71 float maxPathLen = FLT_MAX );
75[[nodiscard]] MRMESH_API EdgePath buildShortestPathAStar( const Mesh & mesh, VertId start, VertId finish, float maxPathLen = FLT_MAX );
80[[nodiscard]] MRMESH_API EdgePath buildShortestPathAStar( const Mesh & mesh,
81 const MeshTriPoint & start, const MeshTriPoint & finish,
82 VertId * outPathStart = nullptr,
83 VertId * outPathFinish = nullptr,
84 float maxPathLen = FLT_MAX );
85
87[[nodiscard]] MRMESH_API EdgePath buildShortestPath( const Mesh& mesh, VertId start, const VertBitSet& finish, float maxPathLen = FLT_MAX );
88
90[[nodiscard]] MRMESH_API EdgePath buildSmallestMetricPath( const MeshTopology & topology, const EdgeMetric & metric,
91 VertId start, VertId finish, float maxPathMetric = FLT_MAX );
95[[nodiscard]] MRMESH_API EdgePath buildSmallestMetricPathBiDir( const MeshTopology & topology, const EdgeMetric & metric,
96 VertId start, VertId finish, float maxPathMetric = FLT_MAX );
100[[nodiscard]] MRMESH_API EdgePath buildSmallestMetricPathBiDir( const MeshTopology & topology, const EdgeMetric & metric,
101 const TerminalVertex * starts, int numStarts,
102 const TerminalVertex * finishes, int numFinishes,
103 VertId * outPathStart = nullptr,
104 VertId * outPathFinish = nullptr,
105 float maxPathMetric = FLT_MAX );
106
108[[nodiscard]] MRMESH_API EdgePath buildSmallestMetricPath( const MeshTopology& topology, const EdgeMetric& metric,
109 VertId start, const VertBitSet& finish, float maxPathMetric = FLT_MAX );
110
112[[nodiscard]] MRMESH_API std::vector<VertId> getVertexOrdering( const MeshTopology & topology, VertBitSet region );
113
115[[nodiscard]] MRMESH_API std::vector<EdgeLoop> extractClosedLoops( const MeshTopology & topology, EdgeBitSet & edges );
116[[nodiscard]] MRMESH_API std::vector<EdgeLoop> extractClosedLoops( const MeshTopology & topology, const std::vector<EdgeId> & inEdges,
117 EdgeBitSet * outNotLoopEdges = nullptr );
118[[nodiscard]] MRMESH_API EdgeLoop extractLongestClosedLoop( const Mesh & mesh, const std::vector<EdgeId> & inEdges );
119
121MRMESH_API bool dilateRegionByMetric( const MeshTopology& topology, const EdgeMetric& metric, FaceBitSet& region, float dilation, ProgressCallback callback = {} );
122MRMESH_API bool dilateRegionByMetric( const MeshTopology& topology, const EdgeMetric& metric, VertBitSet& region, float dilation, ProgressCallback callback = {} );
123MRMESH_API bool dilateRegionByMetric( const MeshTopology& topology, const EdgeMetric& metric, UndirectedEdgeBitSet& region, float dilation, ProgressCallback callback = {} );
124
126MRMESH_API bool erodeRegionByMetric( const MeshTopology& topology, const EdgeMetric& metric, FaceBitSet& region, float dilation, ProgressCallback callback = {} );
127MRMESH_API bool erodeRegionByMetric( const MeshTopology& topology, const EdgeMetric& metric, VertBitSet& region, float dilation, ProgressCallback callback = {} );
128MRMESH_API bool erodeRegionByMetric( const MeshTopology& topology, const EdgeMetric& metric, UndirectedEdgeBitSet& region, float dilation, ProgressCallback callback = {} );
129
131MRMESH_API bool dilateRegion( const Mesh& mesh, FaceBitSet& region, float dilation, ProgressCallback callback = {} );
132MRMESH_API bool dilateRegion( const Mesh& mesh, VertBitSet& region, float dilation, ProgressCallback callback = {} );
133MRMESH_API bool dilateRegion( const Mesh& mesh, UndirectedEdgeBitSet& region, float dilation, ProgressCallback callback = {} );
134MRMESH_API bool dilateRegion( const MeshTopology& topology, const VertCoords& points, FaceBitSet& region, float dilation, ProgressCallback callback = {} );
135MRMESH_API bool dilateRegion( const MeshTopology& topology, const VertCoords& points, VertBitSet& region, float dilation, ProgressCallback callback = {} );
136MRMESH_API bool dilateRegion( const MeshTopology& topology, const VertCoords& points, UndirectedEdgeBitSet& region, float dilation, ProgressCallback callback = {} );
137
139MRMESH_API bool erodeRegion( const Mesh& mesh, FaceBitSet& region, float dilation, ProgressCallback callback = {} );
140MRMESH_API bool erodeRegion( const Mesh& mesh, VertBitSet& region, float dilation, ProgressCallback callback = {} );
141MRMESH_API bool erodeRegion( const Mesh& mesh, UndirectedEdgeBitSet& region, float dilation, ProgressCallback callback = {} );
142MRMESH_API bool erodeRegion( const MeshTopology& topology, const VertCoords& points, FaceBitSet& region, float dilation, ProgressCallback callback = {} );
143MRMESH_API bool erodeRegion( const MeshTopology& topology, const VertCoords& points, VertBitSet& region, float dilation, ProgressCallback callback = {} );
144MRMESH_API bool erodeRegion( const MeshTopology& topology, const VertCoords& points, UndirectedEdgeBitSet& region, float dilation, ProgressCallback callback = {} );
145
147MRMESH_API int getPathPlaneIntersections( const Mesh & mesh, const EdgePath & path, const Plane3f & plane,
148 std::vector<MeshEdgePoint> * outIntersections = nullptr );
149
151MRMESH_API int getContourPlaneIntersections( const Contour3f & path, const Plane3f & plane,
152 std::vector<Vector3f> * outIntersections = nullptr );
153
155MRMESH_API int getPathEdgesInPlane( const Mesh & mesh, const EdgePath & path, const Plane3f & plane, float tolerance = 0.0f,
156 std::vector<EdgeId> * outInPlaneEdges = nullptr );
157
159
160}
Definition MRMeshTopology.h:22
R calcOrientedArea(const Contour2< T > &contour)
Definition MRContour.h:18
float metric
Definition MREdgePaths.h:53
VertId v
Definition MREdgePaths.h:52
MRMESH_API int getPathEdgesInPlane(const Mesh &mesh, const EdgePath &path, const Plane3f &plane, float tolerance=0.0f, std::vector< EdgeId > *outInPlaneEdges=nullptr)
finds all path edges located in given plane with given tolerance, adds them in outInPlaneEdges and re...
MRMESH_API int getContourPlaneIntersections(const Contour3f &path, const Plane3f &plane, std::vector< Vector3f > *outIntersections=nullptr)
finds all intersection points between given contour and plane, adds them in outIntersections and retu...
double calcPathLength(const EdgePath &path, const Mesh &mesh)
Definition MREdgePaths.h:35
MRMESH_API EdgePath buildSmallestMetricPathBiDir(const MeshTopology &topology, const EdgeMetric &metric, VertId start, VertId finish, float maxPathMetric=FLT_MAX)
MRMESH_API double calcPathMetric(const EdgePath &path, EdgeMetric metric)
computes summed metric of all edges in the path
MRMESH_API EdgePath buildShortestPath(const Mesh &mesh, VertId start, VertId finish, float maxPathLen=FLT_MAX)
MRMESH_API void reverse(EdgePath &path)
MRMESH_API bool dilateRegionByMetric(const MeshTopology &topology, const EdgeMetric &metric, FaceBitSet &region, float dilation, ProgressCallback callback={})
expands the region (of faces or vertices) on given metric value. returns false if callback also retur...
MRMESH_API int getPathPlaneIntersections(const Mesh &mesh, const EdgePath &path, const Plane3f &plane, std::vector< MeshEdgePoint > *outIntersections=nullptr)
finds all intersection points between given path and plane, adds them in outIntersections and returns...
MRMESH_API std::vector< VertId > getVertexOrdering(const MeshTopology &topology, VertBitSet region)
returns all vertices from given region ordered in each connected component in breadth-first way
MRMESH_API bool isEdgePath(const MeshTopology &topology, const std::vector< EdgeId > &edges)
returns true if every next edge starts where previous edge ends
MRMESH_API EdgePath buildSmallestMetricPath(const MeshTopology &topology, const EdgeMetric &metric, VertId start, VertId finish, float maxPathMetric=FLT_MAX)
builds shortest path in given metric from start to finish vertices; if no path can be found then empt...
MRMESH_API EdgePath buildShortestPathBiDir(const Mesh &mesh, VertId start, VertId finish, float maxPathLen=FLT_MAX)
MRMESH_API bool erodeRegionByMetric(const MeshTopology &topology, const EdgeMetric &metric, FaceBitSet &region, float dilation, ProgressCallback callback={})
shrinks the region (of faces or vertices) on given metric value. returns false if callback also retur...
MRMESH_API std::vector< EdgeLoop > splitOnSimpleLoops(const MeshTopology &topology, std::vector< EdgeLoop > &&loops)
given a number of edge loops, splits every loop that passes via a vertex more than once on smaller lo...
void sortPathsByLength(std::vector< EdgePath > &paths, const Mesh &mesh)
Definition MREdgePaths.h:43
MRMESH_API bool erodeRegion(const Mesh &mesh, FaceBitSet &region, float dilation, ProgressCallback callback={})
shrinks the region (of faces or vertices) on given value (in meters). returns false if callback also ...
MRMESH_API EdgeMetric edgeLengthMetric(const Mesh &mesh)
MRMESH_API void addLeftBand(const MeshTopology &topology, const EdgeLoop &loop, FaceBitSet &addHere)
adds all faces incident to loop vertices and located to the left from the loop to given FaceBitSet
MRMESH_API EdgePath buildShortestPathAStar(const Mesh &mesh, VertId start, VertId finish, float maxPathLen=FLT_MAX)
MRMESH_API bool dilateRegion(const Mesh &mesh, FaceBitSet &region, float dilation, ProgressCallback callback={})
expands the region (of faces or vertices) on given value (in meters). returns false if callback also ...
MRMESH_API std::vector< EdgeLoop > extractClosedLoops(const MeshTopology &topology, EdgeBitSet &edges)
finds all closed loops from given edges and removes them from edges
MRMESH_API EdgeLoop extractLongestClosedLoop(const Mesh &mesh, const std::vector< EdgeId > &inEdges)
MRMESH_API void sortPathsByMetric(std::vector< EdgePath > &paths, EdgeMetric metric)
sorts given paths in ascending order of their metrics
MRMESH_API bool isEdgeLoop(const MeshTopology &topology, const std::vector< EdgeId > &edges)
returns true if every next edge starts where previous edge ends, and start vertex coincides with fini...
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMeshTriPoint.h:26
Definition MRMesh.h:23
Definition MREdgePaths.h:51