MeshLib Documentation
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{
31 VertId lOrg, lDest;
33 VertId uOrg, uDest;
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
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
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 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
MRMESH_API Contours2f getOutline(const Contours2f &contours, const OutlineParameters &params={})
returns Contour representing outline if input contours
std::vector< ContourIdMap > ContoursIdMap
Definition MR2DContoursTriangulation.h:46
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...
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 Mesh getOutlineMesh(const Contours2f &contours, IntersectionsMap *interMap=nullptr, const BaseOutlineParameters &params={})
Definition MRCameraOrientationPlugin.h:8
Contours2< double > Contours2d
Definition MRMesh/MRMeshFwd.h:282
Contours2< float > Contours2f
Definition MRMesh/MRMeshFwd.h:283
Definition MRMesh/MRMesh.h:23
Definition MR2DContoursTriangulation.h:58
bool allowMerge
allow to merge vertices with same coordinates
Definition MR2DContoursTriangulation.h:59
WindingMode innerType
what to mark as inner part
Definition MR2DContoursTriangulation.h:60
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
Definition MR2DContoursTriangulation.h:69
BaseOutlineParameters baseParams
Definition MR2DContoursTriangulation.h:71
ContoursIdMap * indicesMap
optional output from result contour ids to input ones
Definition MR2DContoursTriangulation.h:70