MeshLib C++ Docs
Loading...
Searching...
No Matches
MR2DContoursTriangulation.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRId.h"
4#include <optional>
5
6namespace MR
7{
8
10{
11
13enum class WindingMode
14{
15 NonZero,
16 Positive,
17 Negative
18};
19
20using HoleVertIds = std::vector<VertId>;
21using HolesVertIds = std::vector<HoleVertIds>;
22
24MRMESH_API HolesVertIds findHoleVertIdsByHoleEdges( const MeshTopology& tp, const std::vector<EdgePath>& holePaths );
25
28{
34
35 // ratio of intersection
36 // 0.0 -> point is lOrg
37 // 1.0 -> point is lDest
38 float lRatio = 0.0f;
39 // 0.0 -> point is uOrg
40 // 1.0 -> point is uDest
41 float uRatio = 0.0f;
42 bool isIntersection() const { return lDest.valid(); }
43};
44
45using ContourIdMap = std::vector<IntersectionInfo>;
46using ContoursIdMap = std::vector<ContourIdMap>;
47
49struct IntersectionsMap
50{
52 size_t shift{ 0 };
54 ContourIdMap map;
55};
56
57struct BaseOutlineParameters
58{
59 bool allowMerge{ false };
60 WindingMode innerType{ WindingMode::Negative };
61};
62
65MRMESH_API Mesh getOutlineMesh( const Contours2f& contours, IntersectionsMap* interMap = nullptr, const BaseOutlineParameters& params = {} );
66MRMESH_API Mesh getOutlineMesh( const Contours2d& contours, IntersectionsMap* interMap = nullptr, const BaseOutlineParameters& params = {} );
67
68struct OutlineParameters
69{
70 ContoursIdMap* indicesMap{ nullptr };
71 BaseOutlineParameters baseParams;
72};
73
75MRMESH_API Contours2f getOutline( const Contours2f& contours, const OutlineParameters& params = {} );
76MRMESH_API Contours2f getOutline( const Contours2d& contours, const OutlineParameters& params = {} );
77
84MRMESH_API Mesh triangulateContours( const Contours2d& contours, const HolesVertIds* holeVertsIds = nullptr );
85MRMESH_API Mesh triangulateContours( const Contours2f& contours, const HolesVertIds* holeVertsIds = nullptr );
86
94MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Contours2d& contours, const HolesVertIds* holeVertsIds = nullptr, std::vector<EdgePath>* outBoundaries = nullptr );
95MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Contours2f& contours, const HolesVertIds* holeVertsIds = nullptr, std::vector<EdgePath>* outBoundaries = nullptr );
96
97}
98}
#define MRMESH_API
Definition MRMeshFwd.h:80
Definition MRMesh/MRMeshTopology.h:19
Definition MRMesh/MRMesh.h:23
Definition MR2DContoursTriangulation.h:58
Definition MR2DContoursTriangulation.h:28
Definition MR2DContoursTriangulation.h:50
new unsafe MR.Std.Vector_MRPlanarTriangulationIntersectionInfo map
Definition MR2DContoursTriangulation.h:69
MRMESH_API Contours2f getOutline(const Contours2f &contours, const OutlineParameters &params={})
returns Contour representing outline if input contours
MRMESH_API std::optional< Mesh > triangulateDisjointContours(const Contours2d &contours, const HolesVertIds *holeVertsIds=nullptr, std::vector< EdgePath > *outBoundaries=nullptr)
triangulate 2d contours only closed contours are allowed (first point of each contour should be the s...
MRMESH_API HolesVertIds findHoleVertIdsByHoleEdges(const MeshTopology &tp, const std::vector< EdgePath > &holePaths)
return vertices of holes that correspond internal contours representation of PlanarTriangulation
MRMESH_API Mesh triangulateContours(const Contours2d &contours, const HolesVertIds *holeVertsIds=nullptr)
triangulate 2d contours only closed contours are allowed (first point of each contour should be the s...
MRMESH_API Mesh getOutlineMesh(const Contours2f &contours, IntersectionsMap *interMap=nullptr, const BaseOutlineParameters &params={})
Definition MRCameraOrientationPlugin.h:8