MeshLib C++ Docs
Loading...
Searching...
No Matches
MRSurfacePath.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRExpected.h"
4#include "MRMeshTriPoint.h"
5#include "MREnums.h"
6#include <vector>
7#include <string>
8
9namespace MR
10{
11
15
16enum class PathError
17{
18 StartEndNotConnected,
19 InternalError
20};
21
22inline std::string toString(PathError error)
23{
24 switch (error)
25 {
26 case PathError::StartEndNotConnected: return "No path can be found from start to end, because they are not from the same connected component";
27 case PathError::InternalError: return "Report to developers for further investigations";
28 default: return "Unknown error. Please, report to developers for further investigations";
29 }
30}
31
35MRMESH_API Expected<SurfacePath, PathError> computeSurfacePath( const MeshPart & mp,
36 const MeshTriPoint & start, const MeshTriPoint & end,
37 int maxGeodesicIters = 5,
38 const VertBitSet* vertRegion = nullptr, VertScalars * outSurfaceDistances = nullptr );
39
42MRMESH_API Expected<SurfacePath, PathError> computeGeodesicPath( const Mesh & mesh,
43 const MeshTriPoint & start, const MeshTriPoint & end, GeodesicPathApprox atype = GeodesicPathApprox::FastMarching,
44 int maxGeodesicIters = 100 );
45
48MRMESH_API Expected<SurfacePath, PathError> computeGeodesicPathApprox( const Mesh & mesh,
49 const MeshTriPoint & start, const MeshTriPoint & end, GeodesicPathApprox atype );
50
53MRMESH_API Expected<SurfacePath, PathError> computeFastMarchingPath( const MeshPart & mp,
54 const MeshTriPoint & start, const MeshTriPoint & end, const VertBitSet* vertRegion = nullptr,
55 VertScalars * outSurfaceDistances = nullptr );
56
58{
62 VertId * outVertexReached = nullptr;
64 EdgePoint * outBdReached = nullptr;
65};
66
70[[nodiscard]] MRMESH_API SurfacePath computeSteepestDescentPath( const MeshPart & mp, const VertScalars & field,
71 const MeshTriPoint & start, const ComputeSteepestDescentPathSettings & settings = {} );
72
78 const MeshTriPoint & start, SurfacePath * outPath, const ComputeSteepestDescentPathSettings & settings = {} );
79
81[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, VertId v );
82
84[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, const MeshEdgePoint & ep );
85
87[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, const MeshTriPoint & tp );
88
90{
91 Ridge, // where the field not-increases both in left and right triangles
92 Gorge // where the field not-decreases both in left and right triangles
93};
94
96[[nodiscard]] MRMESH_API UndirectedEdgeBitSet findExtremeEdges( const Mesh & mesh, const VertScalars & field, ExtremeEdgeType type );
97
100MRMESH_API HashMap<VertId, VertId> computeClosestSurfacePathTargets( const Mesh & mesh,
101 const VertBitSet & starts, const VertBitSet & ends, const VertBitSet * vertRegion = nullptr,
102 VertScalars * outSurfaceDistances = nullptr );
103
106MRMESH_API SurfacePaths getSurfacePathsViaVertices( const Mesh & mesh, const VertBitSet & vs );
107
109MRMESH_API float surfacePathLength( const Mesh& mesh, const SurfacePath& surfacePath );
110
112MRMESH_API Contour3f surfacePathToContour3f( const Mesh & mesh, const SurfacePath & line );
113MRMESH_API Contours3f surfacePathsToContours3f( const Mesh & mesh, const SurfacePaths & lines );
114
116
117} // namespace MR
#define MRMESH_API
Definition MRMeshFwd.h:80
Definition MRSurfacePath.h:58
new unsafe MR.? Box_VertId outVertexReached
new unsafe MR.? EdgePoint outBdReached
new unsafe MR.MeshTriPoint end
Definition MREdgePoint.h:11
Definition MRMeshTriPoint.h:23
Definition MRMesh/MRMesh.h:23
PathError
MR_BIND_IGNORE auto end(const BitSet &)
Definition MRMesh/MRBitSet.h:382
MRMESH_API UndirectedEdgeBitSet findExtremeEdges(const Mesh &mesh, const VertScalars &field, ExtremeEdgeType type)
computes all edges in the mesh, where the field not-increases both in left and right triangles
MRMESH_API HashMap< VertId, VertId > computeClosestSurfacePathTargets(const Mesh &mesh, const VertBitSet &starts, const VertBitSet &ends, const VertBitSet *vertRegion=nullptr, VertScalars *outSurfaceDistances=nullptr)
ExtremeEdgeType
Definition MRSurfacePath.h:90
MRMESH_API Expected< SurfacePath, PathError > computeSurfacePath(const MeshPart &mp, const MeshTriPoint &start, const MeshTriPoint &end, int maxGeodesicIters=5, const VertBitSet *vertRegion=nullptr, VertScalars *outSurfaceDistances=nullptr)
MRMESH_API Expected< SurfacePath, PathError > computeFastMarchingPath(const MeshPart &mp, const MeshTriPoint &start, const MeshTriPoint &end, const VertBitSet *vertRegion=nullptr, VertScalars *outSurfaceDistances=nullptr)
MRMESH_API SurfacePath computeSteepestDescentPath(const MeshPart &mp, const VertScalars &field, const MeshTriPoint &start, const ComputeSteepestDescentPathSettings &settings={})
MRMESH_API Expected< SurfacePath, PathError > computeGeodesicPath(const Mesh &mesh, const MeshTriPoint &start, const MeshTriPoint &end, GeodesicPathApprox atype=GeodesicPathApprox::FastMarching, int maxGeodesicIters=100)
the maximum number of iterations to reduce approximate path length and convert it in geodesic path
MRMESH_API Contour3f surfacePathToContour3f(const Mesh &mesh, const SurfacePath &line)
converts lines on mesh in 3D contours by computing coordinate of each point
MRMESH_API Expected< SurfacePath, PathError > computeGeodesicPathApprox(const Mesh &mesh, const MeshTriPoint &start, const MeshTriPoint &end, GeodesicPathApprox atype)
MRMESH_API Contours3f surfacePathsToContours3f(const Mesh &mesh, const SurfacePaths &lines)
MRMESH_API MeshEdgePoint findSteepestDescentPoint(const MeshPart &mp, const VertScalars &field, VertId v)
finds the point along minus maximal gradient on the boundary of first ring boundary around given vert...
MRMESH_API SurfacePaths getSurfacePathsViaVertices(const Mesh &mesh, const VertBitSet &vs)
MRMESH_API float surfacePathLength(const Mesh &mesh, const SurfacePath &surfacePath)
computes the length of surface path
Definition MRCameraOrientationPlugin.h:8
MRMESH_API std::string_view toString(DimensionsVisualizePropertyType value)