MeshLib
 
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
9namespace PlanarTriangulation
10{
11
13enum class WindingMode
14{
15 NonZero,
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
50{
52 size_t shift{ 0 };
55};
56
59MRMESH_API Mesh getOutlineMesh( const Contours2f& contours, IntersectionsMap* interMap = nullptr );
60
63MRMESH_API Contours2f getOutline( const Contours2f& contours, ContoursIdMap* indicesMap = nullptr );
64
71MRMESH_API Mesh triangulateContours( const Contours2d& contours, const HolesVertIds* holeVertsIds = nullptr );
72MRMESH_API Mesh triangulateContours( const Contours2f& contours, const HolesVertIds* holeVertsIds = nullptr );
73
80MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Contours2d& contours, const HolesVertIds* holeVertsIds = nullptr );
81MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Contours2f& contours, const HolesVertIds* holeVertsIds = nullptr );
82
83}
84}
int VertId
Definition MRDotNet/MRMeshFwd.h:51
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRMesh/MRMeshTopology.h:18
std::vector< HoleVertIds > HolesVertIds
Definition MR2DContoursTriangulation.h:21
std::vector< IntersectionInfo > ContourIdMap
Definition MR2DContoursTriangulation.h:45
std::vector< ContourIdMap > ContoursIdMap
Definition MR2DContoursTriangulation.h:46
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...
WindingMode
Specify mode of detecting inside and outside parts of triangulation.
Definition MR2DContoursTriangulation.h:14
std::vector< VertId > HoleVertIds
Definition MR2DContoursTriangulation.h:20
MRMESH_API Contours2f getOutline(const Contours2f &contours, ContoursIdMap *indicesMap=nullptr)
MRMESH_API Mesh getOutlineMesh(const Contours2f &contours, IntersectionsMap *interMap=nullptr)
MRMESH_API std::optional< Mesh > triangulateDisjointContours(const Contours2d &contours, const HolesVertIds *holeVertsIds=nullptr)
triangulate 2d contours only closed contours are allowed (first point of each contour should be the s...
Definition MRCameraOrientationPlugin.h:7
Contours2< double > Contours2d
Definition MRMesh/MRMeshFwd.h:281
Contours2< float > Contours2f
Definition MRMesh/MRMeshFwd.h:282
Definition MRMesh/MRMesh.h:23
Info about intersection point for mapping.
Definition MR2DContoursTriangulation.h:28
VertId lDest
Definition MR2DContoursTriangulation.h:31
VertId lOrg
Definition MR2DContoursTriangulation.h:31
VertId uDest
Definition MR2DContoursTriangulation.h:33
bool isIntersection() const
Definition MR2DContoursTriangulation.h:42
float uRatio
Definition MR2DContoursTriangulation.h:41
float lRatio
Definition MR2DContoursTriangulation.h:38
VertId uOrg
ids of upper intersection edge vertices
Definition MR2DContoursTriangulation.h:33
struct to map new vertices (only appear on intersections) of the outline to it's edges
Definition MR2DContoursTriangulation.h:50
ContourIdMap map
map[id-shift] = {lower intersection edge, upper intersection edge}
Definition MR2DContoursTriangulation.h:54
size_t shift
shift of index
Definition MR2DContoursTriangulation.h:52