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{
10
11
12namespace PlanarTriangulation
13{
14
16enum class WindingMode
17{
18 NonZero,
21};
22
23using HoleVertIds = std::vector<VertId>;
24using HolesVertIds = std::vector<HoleVertIds>;
25
27MRMESH_API HolesVertIds findHoleVertIdsByHoleEdges( const MeshTopology& tp, const std::vector<EdgePath>& holePaths );
28
31{
34 VertId lOrg, lDest;
36 VertId uOrg, uDest;
37
41 float lRatio = 0.0f;
44 float uRatio = 0.0f;
45 bool isIntersection() const { return lDest.valid(); }
46};
47
48using ContourIdMap = std::vector<IntersectionInfo>;
49using ContoursIdMap = std::vector<ContourIdMap>;
50
53{
55 size_t shift{ 0 };
58};
59
65
68MRMESH_API Mesh getOutlineMesh( const Contours2f& contours, IntersectionsMap* interMap = nullptr, const BaseOutlineParameters& params = {} );
69MRMESH_API Mesh getOutlineMesh( const Contours2d& contours, IntersectionsMap* interMap = nullptr, const BaseOutlineParameters& params = {} );
70
76
78MRMESH_API Contours2f getOutline( const Contours2f& contours, const OutlineParameters& params = {} );
79MRMESH_API Contours2f getOutline( const Contours2d& contours, const OutlineParameters& params = {} );
80
87MRMESH_API Mesh triangulateContours( const Contours2d& contours, const HolesVertIds* holeVertsIds = nullptr );
88MRMESH_API Mesh triangulateContours( const Contours2f& contours, const HolesVertIds* holeVertsIds = nullptr );
89
97MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Contours2d& contours, const HolesVertIds* holeVertsIds = nullptr, std::vector<EdgePath>* outBoundaries = nullptr );
98MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Contours2f& contours, const HolesVertIds* holeVertsIds = nullptr, std::vector<EdgePath>* outBoundaries = nullptr );
99
100}
101}
Definition MRMeshTopology.h:22
std::vector< HoleVertIds > HolesVertIds
Definition MR2DContoursTriangulation.h:24
std::vector< IntersectionInfo > ContourIdMap
Definition MR2DContoursTriangulation.h:48
VertId lDest
Definition MR2DContoursTriangulation.h:34
MRMESH_API Contours2f getOutline(const Contours2f &contours, const OutlineParameters &params={})
returns Contour representing outline if input contours
std::vector< ContourIdMap > ContoursIdMap
Definition MR2DContoursTriangulation.h:49
ContourIdMap map
map[id-shift] = {lower intersection edge, upper intersection edge}
Definition MR2DContoursTriangulation.h:57
VertId lOrg
Definition MR2DContoursTriangulation.h:34
VertId uDest
Definition MR2DContoursTriangulation.h:36
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...
bool isIntersection() const
Definition MR2DContoursTriangulation.h:45
WindingMode
Specify mode of detecting inside and outside parts of triangulation.
Definition MR2DContoursTriangulation.h:17
float uRatio
Definition MR2DContoursTriangulation.h:44
std::vector< VertId > HoleVertIds
Definition MR2DContoursTriangulation.h:23
BaseOutlineParameters baseParams
Definition MR2DContoursTriangulation.h:74
bool allowMerge
allow to merge vertices with same coordinates
Definition MR2DContoursTriangulation.h:62
float lRatio
Definition MR2DContoursTriangulation.h:41
MRMESH_API Mesh getOutlineMesh(const Contours2f &contours, IntersectionsMap *interMap=nullptr, const BaseOutlineParameters &params={})
VertId uOrg
ids of upper intersection edge vertices
Definition MR2DContoursTriangulation.h:36
WindingMode innerType
what to mark as inner part
Definition MR2DContoursTriangulation.h:63
size_t shift
shift of index
Definition MR2DContoursTriangulation.h:55
ContoursIdMap * indicesMap
optional output from result contour ids to input ones
Definition MR2DContoursTriangulation.h:73
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMesh.h:23
Definition MR2DContoursTriangulation.h:61
Info about intersection point for mapping.
Definition MR2DContoursTriangulation.h:31
struct to map new vertices (only appear on intersections) of the outline to it's edges
Definition MR2DContoursTriangulation.h:53
Definition MR2DContoursTriangulation.h:72