MeshLib
 
Loading...
Searching...
No Matches
Mesh Segmentation overwiev

A set of functions for selecting segments on a mesh. More...

Functions

MRMESH_API FaceBitSet MR::fillContourLeftByGraphCut (const MeshTopology &topology, const EdgePath &contour, const EdgeMetric &metric)
 Fills region located to the left from given contour, by minimizing the sum of metric over the boundary.
 
MRMESH_API FaceBitSet MR::fillContourLeftByGraphCut (const MeshTopology &topology, const std::vector< EdgePath > &contours, const EdgeMetric &metric)
 Fills region located to the left from given contours, by minimizing the sum of metric over the boundary.
 
MRMESH_API FaceBitSet MR::segmentByGraphCut (const MeshTopology &topology, const FaceBitSet &source, const FaceBitSet &sink, const EdgeMetric &metric)
 Finds segment that divide mesh on source and sink (source included, sink excluded), by minimizing the sum of metric over the boundary.
 
MRMESH_API Expected< EdgeLoopMR::surroundingContour (const Mesh &mesh, std::vector< EdgeId > includeEdges, const EdgeMetric &edgeMetric, const Vector3f &dir)
 Find the best closed edge loop passing through given edges, which minimizes the sum of given edge metric.
 

Detailed Description

A set of functions for selecting segments on a mesh.

How To

  1. Make Contour(-s)
    First step to get a mesh segment by two (/three) points, is getting the contour that bounds the segment.
    To do this, you can use surroundingContour
  2. Get Segment
    For getting segment of mesh by contour(-s) use fillContourLeftByGraphCut.
Before
After

Function Documentation

◆ fillContourLeftByGraphCut() [1/2]

MRMESH_API FaceBitSet MR::fillContourLeftByGraphCut ( const MeshTopology & topology,
const EdgePath & contour,
const EdgeMetric & metric )

Fills region located to the left from given contour, by minimizing the sum of metric over the boundary.

◆ fillContourLeftByGraphCut() [2/2]

MRMESH_API FaceBitSet MR::fillContourLeftByGraphCut ( const MeshTopology & topology,
const std::vector< EdgePath > & contours,
const EdgeMetric & metric )

Fills region located to the left from given contours, by minimizing the sum of metric over the boundary.

◆ segmentByGraphCut()

MRMESH_API FaceBitSet MR::segmentByGraphCut ( const MeshTopology & topology,
const FaceBitSet & source,
const FaceBitSet & sink,
const EdgeMetric & metric )

Finds segment that divide mesh on source and sink (source included, sink excluded), by minimizing the sum of metric over the boundary.

◆ surroundingContour()

MRMESH_API Expected< EdgeLoop > MR::surroundingContour ( const Mesh & mesh,
std::vector< EdgeId > includeEdges,
const EdgeMetric & edgeMetric,
const Vector3f & dir )
nodiscard

Find the best closed edge loop passing through given edges, which minimizes the sum of given edge metric.

Find the best closed edge loop passing through given vertices, which minimizes the sum of given edge metric.

Parameters
includeEdgescontain all edges that must be present in the returned loop, probably with reversed direction (should have at least 2 elements)
edgeMetricreturned loop will minimize the sum of this metric
dirdirection approximately orthogonal to the loop
keyVerticescontain all vertices that returned loop must pass (should have at least 2 elements)
edgeMetricreturned loop will minimize the sum of this metric
dirdirection approximately orthogonal to the loop