MeshLib Documentation
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 <vector>
6#include <string>
7
8namespace MR
9{
10
14
15enum class PathError
16{
19};
20
21inline std::string toString(PathError error)
22{
23 switch (error)
24 {
25 case PathError::StartEndNotConnected: return "No path can be found from start to end, because they are not from the same connected component";
26 case PathError::InternalError: return "Report to developers for further investigations";
27 default: return "Unknown error. Please, report to developers for further investigations";
28 }
29}
30
35 const MeshTriPoint & start, const MeshTriPoint & end,
36 int maxGeodesicIters = 5,
37 const VertBitSet* vertRegion = nullptr, VertScalars * outSurfaceDistances = nullptr );
38
40enum class GeodesicPathApprox : char
41{
48};
49
53 const MeshTriPoint & start, const MeshTriPoint & end, GeodesicPathApprox atype,
54 int maxGeodesicIters = 100 );
55
59 const MeshTriPoint & start, const MeshTriPoint & end, GeodesicPathApprox atype );
60
64 const MeshTriPoint & start, const MeshTriPoint & end, const VertBitSet* vertRegion = nullptr,
65 VertScalars * outSurfaceDistances = nullptr );
66
76
80[[nodiscard]] MRMESH_API SurfacePath computeSteepestDescentPath( const MeshPart & mp, const VertScalars & field,
81 const MeshTriPoint & start, const ComputeSteepestDescentPathSettings & settings = {} );
82
87MRMESH_API void computeSteepestDescentPath( const MeshPart & mp, const VertScalars & field,
88 const MeshTriPoint & start, SurfacePath * outPath, const ComputeSteepestDescentPathSettings & settings = {} );
89
91[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, VertId v );
92
94[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, const MeshEdgePoint & ep );
95
97[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, const MeshTriPoint & tp );
98
100{
101 Ridge, // where the field not-increases both in left and right triangles
102 Gorge // where the field not-decreases both in left and right triangles
103};
104
106[[nodiscard]] MRMESH_API UndirectedEdgeBitSet findExtremeEdges( const Mesh & mesh, const VertScalars & field, ExtremeEdgeType type );
107
111 const VertBitSet & starts, const VertBitSet & ends, const VertBitSet * vertRegion = nullptr,
112 VertScalars * outSurfaceDistances = nullptr );
113
116MRMESH_API SurfacePaths getSurfacePathsViaVertices( const Mesh & mesh, const VertBitSet & vs );
117
119MRMESH_API float surfacePathLength( const Mesh& mesh, const SurfacePath& surfacePath );
120
124
126
127} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
auto end(const BitSet &)
Definition MRMesh/MRBitSet.h:282
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
GeodesicPathApprox
the algorithm to compute approximately geodesic path
Definition MRSurfacePath.h:41
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:100
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 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
MRMESH_API Expected< SurfacePath, PathError > computeGeodesicPath(const Mesh &mesh, const MeshTriPoint &start, const MeshTriPoint &end, GeodesicPathApprox atype, int maxGeodesicIters=100)
the maximum number of iterations to reduce approximate path length and convert it in geodesic path
PathError
Definition MRSurfacePath.h:16
@ DijkstraBiDir
compute edge-only path by building it from start and end simultaneously
@ FastMarching
use Fast Marching algorithm
@ DijkstraAStar
compute edge-only path using A*-search algorithm
@ InternalError
report to developers for investigation
@ StartEndNotConnected
no path can be found from start to end, because they are not from the same connected component
Definition MRCameraOrientationPlugin.h:8
std::vector< SurfacePath > SurfacePaths
Definition MRMesh/MRMeshFwd.h:351
tl::expected< T, E > Expected
Definition MRExpected.h:58
std::vector< MeshEdgePoint > SurfacePath
Definition MRMesh/MRMeshFwd.h:350
Contours3< float > Contours3f
Definition MRMesh/MRMeshFwd.h:285
Contour3< float > Contour3f
Definition MRMesh/MRMeshFwd.h:277
MRMESH_API std::string_view toString(DimensionsVisualizePropertyType value)
phmap::flat_hash_map< K, V, Hash, Eq > HashMap
Definition MRMesh/MRMeshFwd.h:460
Definition MRSurfacePath.h:68
EdgePoint * outBdReached
if not nullptr, then the descent is stopped as soon as any boundary point is reached,...
Definition MRSurfacePath.h:74
MeshTriPoint end
if valid, then the descent is stopped as soon as same triangle with (end) is reached
Definition MRSurfacePath.h:70
VertId * outVertexReached
if not nullptr, then the descent is stopped as soon as any vertex is reached, which is written in *ou...
Definition MRSurfacePath.h:72
encodes a point on an edge of mesh or of polyline
Definition MREdgePoint.h:11
Definition MRMesh/MRMeshTriPoint.h:23
Definition MRMesh/MRMesh.h:23