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
20{
22 SurfacePath mids;
24
25 [[nodiscard]] size_t numVertices() const { return start.valid() + mids.size() + end.valid(); }
26};
27
28enum class PathError
29{
32};
33
34inline std::string toString(PathError error)
35{
36 switch (error)
37 {
38 case PathError::StartEndNotConnected: return "No path can be found from start to end, because they are not from the same connected component";
39 case PathError::InternalError: return "Report to developers for further investigations";
40 default: return "Unknown error. Please, report to developers for further investigations";
41 }
42}
43
48 const MeshTriPoint & start, const MeshTriPoint & end,
49 int maxGeodesicIters = 5,
50 const VertBitSet* vertRegion = nullptr, VertScalars * outSurfaceDistances = nullptr );
51
56 int maxGeodesicIters = 100 );
57
61 const MeshTriPoint & start, const MeshTriPoint & end, GeodesicPathApprox atype );
62
66 const MeshTriPoint & start, const MeshTriPoint & end, const VertBitSet* vertRegion = nullptr,
67 VertScalars * outSurfaceDistances = nullptr );
68
78
82[[nodiscard]] MRMESH_API SurfacePath computeSteepestDescentPath( const MeshPart & mp, const VertScalars & field,
83 const MeshTriPoint & start, const ComputeSteepestDescentPathSettings & settings = {} );
84
89MRMESH_API void computeSteepestDescentPath( const MeshPart & mp, const VertScalars & field,
90 const MeshTriPoint & start, SurfacePath * outPath, const ComputeSteepestDescentPathSettings & settings = {} );
91
93[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, VertId v );
94
96[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, const MeshEdgePoint & ep );
97
99[[nodiscard]] MRMESH_API MeshEdgePoint findSteepestDescentPoint( const MeshPart & mp, const VertScalars & field, const MeshTriPoint & tp );
100
102{
103 Ridge,
104 Gorge
105};
106
108[[nodiscard]] MRMESH_API UndirectedEdgeBitSet findExtremeEdges( const Mesh & mesh, const VertScalars & field, ExtremeEdgeType type );
109
112[[nodiscard]] MRMESH_API HashMap<VertId, VertId> computeClosestSurfacePathTargets( const Mesh & mesh,
113 const VertBitSet & starts, const VertBitSet & ends, const VertBitSet * vertRegion = nullptr,
114 VertScalars * outSurfaceDistances = nullptr );
115
118[[nodiscard]] MRMESH_API SurfacePaths getSurfacePathsViaVertices( const Mesh & mesh, const VertBitSet & vs );
119
121[[nodiscard]] MRMESH_API float surfacePathLength( const Mesh& mesh, const SurfacePath& surfacePath );
122
124[[nodiscard]] MRMESH_API float geodesicPathLength( const Mesh& mesh, const GeodesicPath& path );
125
127[[nodiscard]] MRMESH_API Contour3f surfacePathToContour3f( const Mesh & mesh, const SurfacePath & line );
128[[nodiscard]] MRMESH_API Contours3f surfacePathsToContours3f( const Mesh & mesh, const SurfacePaths & lines );
129
131[[nodiscard]] MRMESH_API Contour3f geodesicPathToContour3f( const Mesh& mesh, const GeodesicPath& path );
132
134
135}
MR_BIND_IGNORE_PY auto end(const BitSet &)
Definition MRBitSet.h:397
GeodesicPathApprox
the algorithm to compute approximately geodesic path
Definition MREnums.h:100
bool valid() const
consider this valid if the edge ID is valid
Definition MRMeshTriPoint.h:61
tl::expected< T, E > Expected
Definition MRExpected.h:31
MRMESH_API std::string_view toString(DimensionsVisualizePropertyType value)
@ FastMarching
use Fast Marching algorithm
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:102
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 Contour3f geodesicPathToContour3f(const Mesh &mesh, const GeodesicPath &path)
returns coordinates of all vertices of the given path
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 float geodesicPathLength(const Mesh &mesh, const GeodesicPath &path)
computes the length of the given geodesic path
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 the given surface path
PathError
Definition MRSurfacePath.h:29
@ Gorge
where the field not-increases both in left and right triangles
@ 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
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRSurfacePath.h:70
EdgePoint * outBdReached
if not nullptr, then the descent is stopped as soon as any boundary point is reached,...
Definition MRSurfacePath.h:76
MeshTriPoint end
if valid, then the descent is stopped as soon as same triangle with (end) is reached
Definition MRSurfacePath.h:72
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:74
encodes a point on an edge of mesh or of polyline
Definition MREdgePoint.h:14
Definition MRSurfacePath.h:20
MeshTriPoint start
can be invalid, then the path starts in mids.front()
Definition MRSurfacePath.h:21
size_t numVertices() const
Definition MRSurfacePath.h:25
MeshTriPoint end
can be invalid, then the path ends in mids.back()
Definition MRSurfacePath.h:23
SurfacePath mids
Definition MRSurfacePath.h:22
Definition MRMeshTriPoint.h:26
Definition MRMesh.h:23