MeshLib Documentation
Loading...
Searching...
No Matches
Surface Paths

Topics

 Planar Path
 
 Surface Distance
 
 Group Surface Distance Builder
 
 Surface Path
 
 Tunnel Detector
 

Classes

struct  MR::VertPathInfo
 information associated with each vertex by the paths builder More...
 
MRMESH_API EdgeMetric MR::identityMetric ()
 metric returning 1 for every edge
 
MRMESH_API EdgeMetric MR::edgeLengthMetric (const Mesh &mesh)
 
MRMESH_API EdgeMetric MR::discreteAbsMeanCurvatureMetric (const Mesh &mesh)
 
MRMESH_API EdgeMetric MR::discreteMinusAbsMeanCurvatureMetric (const Mesh &mesh)
 
MRMESH_API EdgeMetric MR::edgeCurvMetric (const Mesh &mesh, float angleSinFactor=2, float angleSinForBoundary=0)
 
MRMESH_API EdgeMetric MR::edgeTableSymMetric (const MeshTopology &topology, const EdgeMetric &metric)
 
EdgeMetric MR::edgeTableMetric (const MeshTopology &topology, const EdgeMetric &metric)
 
MRMESH_API bool MR::isEdgePath (const MeshTopology &topology, const std::vector< EdgeId > &edges)
 returns true if every next edge starts where previous edge ends
 
MRMESH_API bool MR::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 finish vertex
 
MRMESH_API std::vector< EdgeLoopMR::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 loops without self-intersections
 
MRMESH_API void MR::reverse (EdgePath &path)
 
MRMESH_API void MR::reverse (std::vector< EdgePath > &paths)
 reverse every path in the vector
 
MRMESH_API double MR::calcPathMetric (const EdgePath &path, EdgeMetric metric)
 computes summed metric of all edges in the path
 
double MR::calcPathLength (const EdgePath &path, const Mesh &mesh)
 
MRMESH_API Vector3d MR::calcOrientedArea (const EdgeLoop &loop, const Mesh &mesh)
 
MRMESH_API void MR::sortPathsByMetric (std::vector< EdgePath > &paths, EdgeMetric metric)
 sorts given paths in ascending order of their metrics
 
void MR::sortPathsByLength (std::vector< EdgePath > &paths, const Mesh &mesh)
 
MRMESH_API void MR::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 MR::buildShortestPath (const Mesh &mesh, VertId start, VertId finish, float maxPathLen=FLT_MAX)
 
MRMESH_API EdgePath MR::buildShortestPathBiDir (const Mesh &mesh, VertId start, VertId finish, float maxPathLen=FLT_MAX)
 
MRMESH_API EdgePath MR::buildShortestPathBiDir (const Mesh &mesh, const MeshTriPoint &start, const MeshTriPoint &finish, VertId *outPathStart=nullptr, VertId *outPathFinish=nullptr, float maxPathLen=FLT_MAX)
 
MRMESH_API EdgePath MR::buildShortestPathAStar (const Mesh &mesh, VertId start, VertId finish, float maxPathLen=FLT_MAX)
 
MRMESH_API EdgePath MR::buildShortestPathAStar (const Mesh &mesh, const MeshTriPoint &start, const MeshTriPoint &finish, VertId *outPathStart=nullptr, VertId *outPathFinish=nullptr, float maxPathLen=FLT_MAX)
 
MRMESH_API EdgePath MR::buildShortestPath (const Mesh &mesh, VertId start, const VertBitSet &finish, float maxPathLen=FLT_MAX)
 builds shortest path in euclidean metric from start to finish vertices; if no path can be found then empty path is returned
 
MRMESH_API EdgePath MR::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 empty path is returned
 
MRMESH_API EdgePath MR::buildSmallestMetricPathBiDir (const MeshTopology &topology, const EdgeMetric &metric, VertId start, VertId finish, float maxPathMetric=FLT_MAX)
 
MRMESH_API EdgePath MR::buildSmallestMetricPathBiDir (const MeshTopology &topology, const EdgeMetric &metric, const TerminalVertex *starts, int numStarts, const TerminalVertex *finishes, int numFinishes, VertId *outPathStart=nullptr, VertId *outPathFinish=nullptr, float maxPathMetric=FLT_MAX)
 
MRMESH_API EdgePath MR::buildSmallestMetricPath (const MeshTopology &topology, const EdgeMetric &metric, VertId start, const VertBitSet &finish, float maxPathMetric=FLT_MAX)
 builds shortest path in given metric from start to finish vertices; if no path can be found then empty path is returned
 
MRMESH_API std::vector< VertId > MR::getVertexOrdering (const MeshTopology &topology, VertBitSet region)
 returns all vertices from given region ordered in each connected component in breadth-first way
 
MRMESH_API std::vector< EdgeLoopMR::extractClosedLoops (const MeshTopology &topology, EdgeBitSet &edges)
 finds all closed loops from given edges and removes them from edges
 
MRMESH_API std::vector< EdgeLoopMR::extractClosedLoops (const MeshTopology &topology, const std::vector< EdgeId > &inEdges, EdgeBitSet *outNotLoopEdges=nullptr)
 
MRMESH_API EdgeLoop MR::extractLongestClosedLoop (const Mesh &mesh, const std::vector< EdgeId > &inEdges)
 
MRMESH_API bool MR::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 returns false
 
MRMESH_API bool MR::dilateRegionByMetric (const MeshTopology &topology, const EdgeMetric &metric, VertBitSet &region, float dilation, ProgressCallback callback={})
 
MRMESH_API bool MR::dilateRegionByMetric (const MeshTopology &topology, const EdgeMetric &metric, UndirectedEdgeBitSet &region, float dilation, ProgressCallback callback={})
 
MRMESH_API bool MR::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 returns false
 
MRMESH_API bool MR::erodeRegionByMetric (const MeshTopology &topology, const EdgeMetric &metric, VertBitSet &region, float dilation, ProgressCallback callback={})
 
MRMESH_API bool MR::erodeRegionByMetric (const MeshTopology &topology, const EdgeMetric &metric, UndirectedEdgeBitSet &region, float dilation, ProgressCallback callback={})
 
MRMESH_API bool MR::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 returns false
 
MRMESH_API bool MR::dilateRegion (const Mesh &mesh, VertBitSet &region, float dilation, ProgressCallback callback={})
 
MRMESH_API bool MR::dilateRegion (const Mesh &mesh, UndirectedEdgeBitSet &region, float dilation, ProgressCallback callback={})
 
MRMESH_API bool MR::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 returns false
 
MRMESH_API bool MR::erodeRegion (const Mesh &mesh, VertBitSet &region, float dilation, ProgressCallback callback={})
 
MRMESH_API bool MR::erodeRegion (const Mesh &mesh, UndirectedEdgeBitSet &region, float dilation, ProgressCallback callback={})
 
MRMESH_API int MR::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 their number
 
MRMESH_API int MR::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 returns their number
 

Detailed Description

Function Documentation

◆ addLeftBand()

MRMESH_API void MR::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

◆ buildShortestPath() [1/2]

MRMESH_API EdgePath MR::buildShortestPath ( const Mesh & mesh,
VertId start,
const VertBitSet & finish,
float maxPathLen = FLT_MAX )
nodiscard

builds shortest path in euclidean metric from start to finish vertices; if no path can be found then empty path is returned

◆ buildShortestPath() [2/2]

MRMESH_API EdgePath MR::buildShortestPath ( const Mesh & mesh,
VertId start,
VertId finish,
float maxPathLen = FLT_MAX )
nodiscard

finds the shortest path in euclidean metric from start to finish vertices using Dijkstra algorithm; if no path can be found then empty path is returned

◆ buildShortestPathAStar() [1/2]

MRMESH_API EdgePath MR::buildShortestPathAStar ( const Mesh & mesh,
const MeshTriPoint & start,
const MeshTriPoint & finish,
VertId * outPathStart = nullptr,
VertId * outPathFinish = nullptr,
float maxPathLen = FLT_MAX )
nodiscard

finds the path from a vertex in start-triangle to a vertex in finish-triangle, so that the length start-first_vertex-...-last_vertex-finish is shortest in euclidean metric; using A* modification of Dijkstra algorithm, which is faster for near linear path; if no path can be found then empty path is returned

◆ buildShortestPathAStar() [2/2]

MRMESH_API EdgePath MR::buildShortestPathAStar ( const Mesh & mesh,
VertId start,
VertId finish,
float maxPathLen = FLT_MAX )
nodiscard

finds the shortest path in euclidean metric from start to finish vertices using A* modification of Dijkstra algorithm, which is faster for near linear path; if no path can be found then empty path is returned

◆ buildShortestPathBiDir() [1/2]

MRMESH_API EdgePath MR::buildShortestPathBiDir ( const Mesh & mesh,
const MeshTriPoint & start,
const MeshTriPoint & finish,
VertId * outPathStart = nullptr,
VertId * outPathFinish = nullptr,
float maxPathLen = FLT_MAX )
nodiscard

finds the path from a vertex in start-triangle to a vertex in finish-triangle, so that the length start-first_vertex-...-last_vertex-finish is shortest in euclidean metric; using bidirectional modification of Dijkstra algorithm, constructing the path simultaneously from both start and finish, which is faster for long paths; if no path can be found then empty path is returned

◆ buildShortestPathBiDir() [2/2]

MRMESH_API EdgePath MR::buildShortestPathBiDir ( const Mesh & mesh,
VertId start,
VertId finish,
float maxPathLen = FLT_MAX )
nodiscard

finds the shortest path in euclidean metric from start to finish vertices using bidirectional modification of Dijkstra algorithm, constructing the path simultaneously from both start and finish, which is faster for long paths; if no path can be found then empty path is returned

◆ buildSmallestMetricPath() [1/2]

MRMESH_API EdgePath MR::buildSmallestMetricPath ( const MeshTopology & topology,
const EdgeMetric & metric,
VertId start,
const VertBitSet & finish,
float maxPathMetric = FLT_MAX )
nodiscard

builds shortest path in given metric from start to finish vertices; if no path can be found then empty path is returned

◆ buildSmallestMetricPath() [2/2]

MRMESH_API EdgePath MR::buildSmallestMetricPath ( const MeshTopology & topology,
const EdgeMetric & metric,
VertId start,
VertId finish,
float maxPathMetric = FLT_MAX )
nodiscard

builds shortest path in given metric from start to finish vertices; if no path can be found then empty path is returned

◆ buildSmallestMetricPathBiDir() [1/2]

MRMESH_API EdgePath MR::buildSmallestMetricPathBiDir ( const MeshTopology & topology,
const EdgeMetric & metric,
const TerminalVertex * starts,
int numStarts,
const TerminalVertex * finishes,
int numFinishes,
VertId * outPathStart = nullptr,
VertId * outPathFinish = nullptr,
float maxPathMetric = FLT_MAX )
nodiscard

finds the smallest metric path from one of start vertices to one of the finish vertices, using bidirectional modification of Dijkstra algorithm, constructing the path simultaneously from both starts and finishes, which is faster for long paths; if no path can be found then empty path is returned

◆ buildSmallestMetricPathBiDir() [2/2]

MRMESH_API EdgePath MR::buildSmallestMetricPathBiDir ( const MeshTopology & topology,
const EdgeMetric & metric,
VertId start,
VertId finish,
float maxPathMetric = FLT_MAX )
nodiscard

finds the smallest metric path from start vertex to finish vertex, using bidirectional modification of Dijkstra algorithm, constructing the path simultaneously from both start and finish, which is faster for long paths; if no path can be found then empty path is returned

◆ calcOrientedArea()

MRMESH_API Vector3d MR::calcOrientedArea ( const EdgeLoop & loop,
const Mesh & mesh )
nodiscard

returns the vector with the magnitude equal to the area surrounded by the loop (if the loop is planar), and directed to see the loop in ccw order from the vector tip

◆ calcPathLength()

double MR::calcPathLength ( const EdgePath & path,
const Mesh & mesh )
inlinenodiscard

◆ calcPathMetric()

MRMESH_API double MR::calcPathMetric ( const EdgePath & path,
EdgeMetric metric )
nodiscard

computes summed metric of all edges in the path

◆ dilateRegion() [1/3]

MRMESH_API bool MR::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 returns false

◆ dilateRegion() [2/3]

MRMESH_API bool MR::dilateRegion ( const Mesh & mesh,
UndirectedEdgeBitSet & region,
float dilation,
ProgressCallback callback = {} )

◆ dilateRegion() [3/3]

MRMESH_API bool MR::dilateRegion ( const Mesh & mesh,
VertBitSet & region,
float dilation,
ProgressCallback callback = {} )

◆ dilateRegionByMetric() [1/3]

MRMESH_API bool MR::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 returns false

◆ dilateRegionByMetric() [2/3]

MRMESH_API bool MR::dilateRegionByMetric ( const MeshTopology & topology,
const EdgeMetric & metric,
UndirectedEdgeBitSet & region,
float dilation,
ProgressCallback callback = {} )

◆ dilateRegionByMetric() [3/3]

MRMESH_API bool MR::dilateRegionByMetric ( const MeshTopology & topology,
const EdgeMetric & metric,
VertBitSet & region,
float dilation,
ProgressCallback callback = {} )

◆ discreteAbsMeanCurvatureMetric()

MRMESH_API EdgeMetric MR::discreteAbsMeanCurvatureMetric ( const Mesh & mesh)
nodiscard

returns edge's absolute discrete mean curvature as a metric; the metric is minimal in the planar regions of mesh; this metric is symmetric: m(e) == m(e.sym())

◆ discreteMinusAbsMeanCurvatureMetric()

MRMESH_API EdgeMetric MR::discreteMinusAbsMeanCurvatureMetric ( const Mesh & mesh)
nodiscard

returns minus of edge's absolute discrete mean curvature as a metric; the metric is minimal in the most curved regions of mesh; this metric is symmetric: m(e) == m(e.sym())

◆ edgeCurvMetric()

MRMESH_API EdgeMetric MR::edgeCurvMetric ( const Mesh & mesh,
float angleSinFactor = 2,
float angleSinForBoundary = 0 )
nodiscard

returns edge's metric that depends both on edge's length and on the angle between its left and right faces

Parameters
angleSinFactormultiplier before dihedral angle sine in edge metric calculation (positive to prefer concave angles, negative - convex)
angleSinForBoundaryconsider this dihedral angle sine for boundary edges; this metric is symmetric: m(e) == m(e.sym())

◆ edgeLengthMetric()

MRMESH_API EdgeMetric MR::edgeLengthMetric ( const Mesh & mesh)
nodiscard

returns edge's length as a metric; this metric is symmetric: m(e) == m(e.sym())

◆ edgeTableMetric()

EdgeMetric MR::edgeTableMetric ( const MeshTopology & topology,
const EdgeMetric & metric )
inline

◆ edgeTableSymMetric()

MRMESH_API EdgeMetric MR::edgeTableSymMetric ( const MeshTopology & topology,
const EdgeMetric & metric )
nodiscard

pre-computes the metric for all mesh edges to quickly return it later for any edge; input metric must be symmetric: metric(e) == metric(e.sym())

◆ erodeRegion() [1/3]

MRMESH_API bool MR::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 returns false

◆ erodeRegion() [2/3]

MRMESH_API bool MR::erodeRegion ( const Mesh & mesh,
UndirectedEdgeBitSet & region,
float dilation,
ProgressCallback callback = {} )

◆ erodeRegion() [3/3]

MRMESH_API bool MR::erodeRegion ( const Mesh & mesh,
VertBitSet & region,
float dilation,
ProgressCallback callback = {} )

◆ erodeRegionByMetric() [1/3]

MRMESH_API bool MR::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 returns false

◆ erodeRegionByMetric() [2/3]

MRMESH_API bool MR::erodeRegionByMetric ( const MeshTopology & topology,
const EdgeMetric & metric,
UndirectedEdgeBitSet & region,
float dilation,
ProgressCallback callback = {} )

◆ erodeRegionByMetric() [3/3]

MRMESH_API bool MR::erodeRegionByMetric ( const MeshTopology & topology,
const EdgeMetric & metric,
VertBitSet & region,
float dilation,
ProgressCallback callback = {} )

◆ extractClosedLoops() [1/2]

MRMESH_API std::vector< EdgeLoop > MR::extractClosedLoops ( const MeshTopology & topology,
const std::vector< EdgeId > & inEdges,
EdgeBitSet * outNotLoopEdges = nullptr )
nodiscard

◆ extractClosedLoops() [2/2]

MRMESH_API std::vector< EdgeLoop > MR::extractClosedLoops ( const MeshTopology & topology,
EdgeBitSet & edges )
nodiscard

finds all closed loops from given edges and removes them from edges

◆ extractLongestClosedLoop()

MRMESH_API EdgeLoop MR::extractLongestClosedLoop ( const Mesh & mesh,
const std::vector< EdgeId > & inEdges )
nodiscard

◆ getPathEdgesInPlane()

MRMESH_API int MR::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 returns their number

◆ getPathPlaneIntersections()

MRMESH_API int MR::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 their number

◆ getVertexOrdering()

MRMESH_API std::vector< VertId > MR::getVertexOrdering ( const MeshTopology & topology,
VertBitSet region )
nodiscard

returns all vertices from given region ordered in each connected component in breadth-first way

◆ identityMetric()

MRMESH_API EdgeMetric MR::identityMetric ( )
nodiscard

metric returning 1 for every edge

◆ isEdgeLoop()

MRMESH_API bool MR::isEdgeLoop ( const MeshTopology & topology,
const std::vector< EdgeId > & edges )
nodiscard

returns true if every next edge starts where previous edge ends, and start vertex coincides with finish vertex

◆ isEdgePath()

MRMESH_API bool MR::isEdgePath ( const MeshTopology & topology,
const std::vector< EdgeId > & edges )
nodiscard

returns true if every next edge starts where previous edge ends

◆ reverse() [1/2]

MRMESH_API void MR::reverse ( EdgePath & path)

reverses the order of edges and flips each edge orientation, thus making the opposite directed edge path

◆ reverse() [2/2]

MRMESH_API void MR::reverse ( std::vector< EdgePath > & paths)

reverse every path in the vector

◆ sortPathsByLength()

void MR::sortPathsByLength ( std::vector< EdgePath > & paths,
const Mesh & mesh )
inline

◆ sortPathsByMetric()

MRMESH_API void MR::sortPathsByMetric ( std::vector< EdgePath > & paths,
EdgeMetric metric )

sorts given paths in ascending order of their metrics

◆ splitOnSimpleLoops()

MRMESH_API std::vector< EdgeLoop > MR::splitOnSimpleLoops ( const MeshTopology & topology,
std::vector< EdgeLoop > && loops )
nodiscard

given a number of edge loops, splits every loop that passes via a vertex more than once on smaller loops without self-intersections