MeshLib Documentation
Loading...
Searching...
No Matches
MRPolylineDecimate.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include <cfloat>
5#include <climits>
6#include <functional>
7
8namespace MR
9{
10
18template<typename V>
19struct DecimatePolylineSettings
20{
22 float maxError = 0.001f;
23
25 float maxEdgeLen = FLT_MAX;
26
30 float stabilizer = 0.001f;
31
34 bool optimizeVertexPos = true;
35
37 int maxDeletedVertices = INT_MAX;
38
41 VertBitSet* region = nullptr;
42
46 bool touchBdVertices = true;
47
54 std::function<bool( EdgeId edgeToCollapse, const V & newEdgeOrgPos )> preCollapse;
55
64 std::function<void( UndirectedEdgeId ue, float & collapseErrorSq, V & collapsePos )> adjustCollapse;
65
72};
73
76
82{
83 int vertsDeleted = 0;
84 float errorIntroduced = 0;
85};
86
93
100
101} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:20
MRMESH_API DecimatePolylineResult decimateContour(Contour2f &contour, const DecimatePolylineSettings2 &settings={})
Collapse edges in the contour according to the settings.
MRMESH_API DecimatePolylineResult decimatePolyline(Polyline2 &polyline, const DecimatePolylineSettings2 &settings={})
Collapse edges in the polyline according to the settings.
Definition MRCameraOrientationPlugin.h:8
Contour2< float > Contour2f
Definition MRMesh/MRMeshFwd.h:275
Contour3< float > Contour3f
Definition MRMesh/MRMeshFwd.h:277
Results of MR::decimateContour.
float errorIntroduced
Max different (as distance) between original contour and result contour.
Definition MRPolylineDecimate.h:84
int vertsDeleted
Number deleted verts. Same as the number of performed collapses.
Definition MRPolylineDecimate.h:83
Parameters structure for MR::decimatePolyline.
bool optimizeVertexPos
Definition MRPolylineDecimate.h:34
Vector< QuadraticForm< V >, VertId > * vertForms
If not null, then on input: if the vector is not empty then it is taken for initialization instead of...
Definition MRPolylineDecimate.h:71
float maxError
Limit from above on the maximum distance from moved vertices to original contour.
Definition MRPolylineDecimate.h:22
int maxDeletedVertices
Limit on the number of deleted vertices.
Definition MRPolylineDecimate.h:37
float stabilizer
Definition MRPolylineDecimate.h:30
float maxEdgeLen
Maximal possible edge length created during decimation.
Definition MRPolylineDecimate.h:25
std::function< void(UndirectedEdgeId ue, float &collapseErrorSq, V &collapsePos)> adjustCollapse
The user can provide this optional callback for adjusting error introduced by this edge collapse and ...
Definition MRPolylineDecimate.h:64
VertBitSet * region
Definition MRPolylineDecimate.h:41
std::function< bool(EdgeId edgeToCollapse, const V &newEdgeOrgPos)> preCollapse
The user can provide this optional callback that is invoked immediately before edge collapse;.
Definition MRPolylineDecimate.h:54
bool touchBdVertices
Definition MRPolylineDecimate.h:46