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 "MRHoleFillPlan.h"
5#include <memory>
6#include <optional>
7
8namespace MR
9{
12
13
15{
16
24
27{
30 VertId lOrg, lDest;
32 VertId uOrg, uDest;
33
37 float lRatio = 0.0f;
40 float uRatio = 0.0f;
41 bool isIntersection() const { return lDest.valid(); }
42};
43
44using ContourIdMap = std::vector<IntersectionInfo>;
45using ContoursIdMap = std::vector<ContourIdMap>;
46
49{
51 size_t shift{ 0 };
54};
55
61
64MRMESH_API Mesh getOutlineMesh( const Contours2f& contours, IntersectionsMap* interMap = nullptr, const BaseOutlineParameters& params = {} );
65MRMESH_API Mesh getOutlineMesh( const Contours2d& contours, IntersectionsMap* interMap = nullptr, const BaseOutlineParameters& params = {} );
66
72
74MRMESH_API Contours2f getOutline( const Contours2f& contours, const OutlineParameters& params = {} );
75MRMESH_API Contours2f getOutline( const Contours2d& contours, const OutlineParameters& params = {} );
76
87
95
102{
103public:
104 ISweepLineCache() = default;
107 ISweepLineCache( const ISweepLineCache & ) = delete;
111};
112
114MRMESH_API std::unique_ptr<ISweepLineCache> makeSweepLineCache();
115
121MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Contours2d& contours, ISweepLineCache* cache = nullptr );
122MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Contours2f& contours, ISweepLineCache* cache = nullptr );
123
133MRMESH_API std::optional<Mesh> triangulateDisjointContours( const Mesh& mesh, const EdgeLoops& loops, const Vector3f& normal, WholeEdgeMap* outPatchMap = nullptr, ISweepLineCache* cache = nullptr );
134
140MR_BIND_IGNORE MRMESH_API MeshTopology* triangulateDisjointContoursTopology( const Mesh& mesh, const EdgeLoops& loops, const Vector3f& normal, WholeEdgeMap& outPatchMap, ISweepLineCache& cache );
141
153MRMESH_API std::optional<HoleFillPlan> getMonotonePlan( const Mesh& mesh, const EdgeLoops& loops, const Vector3f& normal );
154
155}
156}
#define MRMESH_API
Definition MRMeshFwd.h:85
Definition MRMeshTopology.h:30
Definition MR2DContoursTriangulation.h:102
std::vector<T>-like container that requires specific indexing type,
Definition MRVector.h:23
std::vector< IntersectionInfo > ContourIdMap
Definition MR2DContoursTriangulation.h:44
Mesh triangulateContours(const Contours2d &contours, const TriangulationParameters &params={})
triangulate 2d contours only closed contours are allowed (first point of each contour should be the s...
std::vector< EdgeLoop > EdgeLoops
Definition MRMeshFwd.h:157
VertId lDest
Definition MR2DContoursTriangulation.h:30
std::vector< ContourIdMap > ContoursIdMap
Definition MR2DContoursTriangulation.h:45
ContourIdMap map
map[id-shift] = {lower intersection edge, upper intersection edge}
Definition MR2DContoursTriangulation.h:53
MR_BIND_IGNORE MeshTopology * triangulateDisjointContoursTopology(const Mesh &mesh, const EdgeLoops &loops, const Vector3f &normal, WholeEdgeMap &outPatchMap, ISweepLineCache &cache)
VertId lOrg
Definition MR2DContoursTriangulation.h:30
VertId uDest
Definition MR2DContoursTriangulation.h:32
bool isIntersection() const
Definition MR2DContoursTriangulation.h:41
WindingMode
Specify mode of detecting inside and outside parts of triangulation.
Definition MR2DContoursTriangulation.h:19
float uRatio
Definition MR2DContoursTriangulation.h:40
Contours2< double > Contours2d
Definition MRMeshFwd.h:385
BaseOutlineParameters baseParams
Definition MR2DContoursTriangulation.h:70
Contours2f getOutline(const Contours2f &contours, const OutlineParameters &params={})
returns Contour representing outline if input contours
Mesh getOutlineMesh(const Contours2f &contours, IntersectionsMap *interMap=nullptr, const BaseOutlineParameters &params={})
std::unique_ptr< ISweepLineCache > makeSweepLineCache()
creates a cache for the sweep-line triangulation
std::optional< HoleFillPlan > getMonotonePlan(const Mesh &mesh, const EdgeLoops &loops, const Vector3f &normal)
splits the near-planar region bounded by loops in monotone parts, without triangulating them this is ...
bool allowMerge
allow to merge vertices with same coordinates
Definition MR2DContoursTriangulation.h:58
float lRatio
Definition MR2DContoursTriangulation.h:37
virtual ~ISweepLineCache()=0
pure to make the class abstract: instances are created by makeSweepLineCache() only
ISweepLineCache(const ISweepLineCache &)=delete
Contours2< float > Contours2f
Definition MRMeshFwd.h:386
Vector< int, FaceId > * outFaceWinding
Definition MR2DContoursTriangulation.h:81
VertId uOrg
ids of upper intersection edge vertices
Definition MR2DContoursTriangulation.h:32
ISweepLineCache & operator=(const ISweepLineCache &)=delete
WindingMode innerType
what to mark as inner part
Definition MR2DContoursTriangulation.h:59
size_t shift
shift of index
Definition MR2DContoursTriangulation.h:51
std::array< Vector3f, 3 > MR_BIND_IGNORE
Definition MRMeshBuilderTypes.h:13
ContoursIdMap * indicesMap
optional output from result contour ids to input ones
Definition MR2DContoursTriangulation.h:69
IntersectionsMap * outInterMap
Definition MR2DContoursTriangulation.h:85
Vector3f normal(const MeshTopology &topology, const VertCoords &points, FaceId f)
computes triangular face normal from its vertices
Definition MRMeshMath.h:224
std::optional< Mesh > triangulateDisjointContours(const Contours2d &contours, ISweepLineCache *cache=nullptr)
triangulate 2d contours only closed contours are allowed (first point of each contour should be the s...
@ Positive
Definition MR2DContoursTriangulation.h:21
@ NonZero
Definition MR2DContoursTriangulation.h:20
@ Negative
Definition MR2DContoursTriangulation.h:22
Definition MR2DContoursTriangulation.h:15
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMesh.h:24
Definition MR2DContoursTriangulation.h:57
Info about intersection point for mapping.
Definition MR2DContoursTriangulation.h:27
struct to map new vertices (only appear on intersections) of the outline to it's edges
Definition MR2DContoursTriangulation.h:49
Definition MR2DContoursTriangulation.h:68
Definition MR2DContoursTriangulation.h:78