MeshLib C++ Docs
Loading...
Searching...
No Matches
MROneMeshContours.h
Go to the documentation of this file.
1#pragma once
2
5#include "MRExpected.h"
6#include "MREnums.h"
7#include <variant>
8
9namespace MR
10{
13
14
17{
21 const AffineXf3f* rigidB2A{nullptr};
23 bool isOtherA{false};
24};
25
28{
29 std::variant<FaceId, EdgeId, VertId> primitiveId;
30
31 Vector3f coordinate;
32};
33
36{
37 std::vector<OneMeshIntersection> intersections;
38 bool closed{false};
39};
47using OneMeshContours = std::vector<OneMeshContour>;
48
51MRMESH_API void subdivideLoneContours( Mesh& mesh, const OneMeshContours& contours, FaceHashMap* new2oldMap = nullptr );
52
57MRMESH_API void getOneMeshIntersectionContours( const Mesh& meshA, const Mesh& meshB, const ContinuousContours& contours,
59 const CoordinateConverters& converters, const AffineXf3f* rigidB2A = nullptr,
60 Contours3f* outPtsA = nullptr,
61 bool addSelfyTerminalVerts = false );
62
65[[nodiscard]]
67 const CoordinateConverters& converters, const AffineXf3f* rigidB2A = nullptr );
68
70[[nodiscard]]
71MRMESH_API Contours3f extractMeshContours( const OneMeshContours& meshContours );
72
73using MeshTriPointsConnector = std::function<Expected<SurfacePath>( const MeshTriPoint& start, const MeshTriPoint& end, int startIndex, int endIndex )>;
81[[nodiscard]]
82MR_BIND_IGNORE MRMESH_API Expected<OneMeshContour> convertMeshTriPointsToMeshContour( const Mesh& mesh, const std::vector<MeshTriPoint>& surfaceLine,
83 MeshTriPointsConnector connectorFn, std::vector<int>* pivotIndices = nullptr );
84
91
99[[nodiscard]]
100MRMESH_API Expected<OneMeshContour> convertMeshTriPointsToMeshContour( const Mesh& mesh, const std::vector<MeshTriPoint>& surfaceLine,
101 SearchPathSettings searchSettings = {}, std::vector<int>* pivotIndices = nullptr );
102
110[[nodiscard]]
111MRMESH_API Expected<OneMeshContour> convertMeshTriPointsToClosedContour( const Mesh& mesh, const std::vector<MeshTriPoint>& surfaceLine,
112 SearchPathSettings searchSettings = {}, std::vector<int>* pivotIndices = nullptr );
113
132[[nodiscard]]
134 const MeshTriPoint& start,
135 const SurfacePath& surfacePath,
136 const MeshTriPoint& end );
137
143[[nodiscard]]
144MRMESH_API OneMeshContours convertSurfacePathsToMeshContours( const Mesh& mesh, const std::vector<SurfacePath>& surfacePaths );
145
146}
MR_BIND_IGNORE_PY auto end(const BitSet &)
Definition MRBitSet.h:397
MR_BIND_IGNORE MRMESH_API Expected< OneMeshContour > convertMeshTriPointsToMeshContour(const Mesh &mesh, const std::vector< MeshTriPoint > &surfaceLine, MeshTriPointsConnector connectorFn, std::vector< int > *pivotIndices=nullptr)
Makes continuous contour by mesh tri points, if first and last meshTriPoint is the same,...
MRMESH_API OneMeshContour convertSurfacePathWithEndsToMeshContour(const Mesh &mesh, const MeshTriPoint &start, const SurfacePath &surfacePath, const MeshTriPoint &end)
Converts SurfacePath to OneMeshContours.
MRMESH_API Expected< OneMeshContour > convertMeshTriPointsToClosedContour(const Mesh &mesh, const std::vector< MeshTriPoint > &surfaceLine, SearchPathSettings searchSettings={}, std::vector< int > *pivotIndices=nullptr)
Makes closed continuous contour by mesh tri points, note that first and last meshTriPoint should not ...
MRMESH_API OneMeshContours convertSurfacePathsToMeshContours(const Mesh &mesh, const std::vector< SurfacePath > &surfacePaths)
Converts SurfacePaths to OneMeshContours.
std::vector< OneMeshContour > OneMeshContours
Special data type for MR::cutMesh.
Definition MRIntersectionContour.h:13
GeodesicPathApprox
the algorithm to compute approximately geodesic path
Definition MREnums.h:100
std::function< Expected< SurfacePath >(const MeshTriPoint &start, const MeshTriPoint &end, int startIndex, int endIndex)> MeshTriPointsConnector
Definition MROneMeshContours.h:73
const AffineXf3f * rigidB2A
Definition MROneMeshContours.h:21
const ContinuousContours & contours
Definition MROneMeshContours.h:19
MRMESH_API void subdivideLoneContours(Mesh &mesh, const OneMeshContours &contours, FaceHashMap *new2oldMap=nullptr)
MRMESH_API Contours3f extractMeshContours(const OneMeshContours &meshContours)
Converts OneMeshContours contours representation to Contours3f: set of coordinates.
ConvertToIntVector converter
Definition MROneMeshContours.h:20
size_t meshAVertsNum
Definition MROneMeshContours.h:22
bool isOtherA
Definition MROneMeshContours.h:23
tl::expected< T, E > Expected
Definition MRExpected.h:31
std::vector< OneMeshIntersection > intersections
Definition MROneMeshContours.h:37
GeodesicPathApprox geodesicPathApprox
the algorithm to compute approximately geodesic path
Definition MROneMeshContours.h:88
std::vector< ContinuousContour > ContinuousContours
Definition MRIntersectionContour.h:16
int maxReduceIters
the maximum number of iterations to reduce approximate path length and convert it in geodesic path
Definition MROneMeshContours.h:89
std::variant< FaceId, EdgeId, VertId > primitiveId
Definition MROneMeshContours.h:29
std::function< Vector3i(const Vector3f &)> ConvertToIntVector
float-to-int coordinate converter
Definition MRPrecisePredicates3.h:56
Vector3f coordinate
Definition MROneMeshContours.h:31
const Mesh & otherMesh
Definition MROneMeshContours.h:18
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
bool closed
Definition MROneMeshContours.h:38
MRMESH_API void getOneMeshIntersectionContours(const Mesh &meshA, const Mesh &meshB, const ContinuousContours &contours, OneMeshContours *outA, OneMeshContours *outB, const CoordinateConverters &converters, const AffineXf3f *rigidB2A=nullptr, Contours3f *outPtsA=nullptr, bool addSelfyTerminalVerts=false)
if true, then open self-intersection contours will be prolonged to terminal vertices
MRMESH_API OneMeshContours getOneMeshSelfIntersectionContours(const Mesh &mesh, const ContinuousContours &contours, const CoordinateConverters &converters, const AffineXf3f *rigidB2A=nullptr)
@ DijkstraAStar
compute edge-only path using A*-search algorithm
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
this struct contains coordinate converters float-int-float
Definition MRPrecisePredicates3.h:61
Definition MRMeshTriPoint.h:26
Definition MRMesh.h:23
One contour on mesh.
Definition MROneMeshContours.h:36
Simple point on mesh, represented by primitive id and coordinate in mesh space.
Definition MROneMeshContours.h:28
Geo path search settings.
Definition MROneMeshContours.h:87
Special data to sort intersections more accurate.
Definition MROneMeshContours.h:17