3#include "MRPch/MRBindingMacros.h"
21namespace TriangulationHelpers
30 const std::vector<VertId>& fan,
float baseRadius );
72 bool isOutdated(
const std::vector<VertId>& neighbors )
const
74 return !neighbors[
nextId].valid() || !neighbors[
prevId].valid();
100 MR_BIND_IGNORE std::priority_queue<FanOptimizerQueueElement>
queue;
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
the class stores some number of smallest elements from a larger number of candidates
Definition MRFewSmallest.h:14
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:576
MRMESH_API void findNeighborsInBall(const PointCloud &pointCloud, VertId v, float radius, std::vector< VertId > &neighbors)
Finds all neighbors of v in given radius (v excluded)
MRMESH_API float updateNeighborsRadius(const VertCoords &points, VertId v, VertId boundaryV, const std::vector< VertId > &fan, float baseRadius)
Finds max radius of neighbors search, for possible better local triangulation.
MRMESH_API bool isBoundaryPoint(const PointCloud &cloud, VertId v, const Settings &settings, TriangulatedFanData &fanData)
Checks if given vertex is on boundary of the point cloud, by constructing local triangulation around ...
MRMESH_API void filterNeighbors(const VertNormals &normals, VertId v, std::vector< VertId > &neighbors)
Filter neighbors with crossing normals.
MRMESH_API float findNumNeighbors(const PointCloud &pointCloud, VertId v, int numNeis, std::vector< VertId > &neighbors, FewSmallest< PointsProjectionResult > &tmp, float upDistLimitSq=FLT_MAX)
Finds at most given number of neighbors of v (v excluded)
MRMESH_API std::optional< std::vector< SomeLocalTriangulations > > buildLocalTriangulations(const PointCloud &cloud, const Settings &settings, const ProgressCallback &progress={})
MRMESH_API std::optional< VertBitSet > findBoundaryPoints(const PointCloud &pointCloud, const Settings &settings, ProgressCallback cb={})
Returns bit set of points that are considered as boundary by calling isBoundaryPoint in each.
MRMESH_API void buildLocalTriangulation(const PointCloud &cloud, VertId v, const Settings &settings, TriangulatedFanData &fanData)
constructs local triangulation around given point
MRMESH_API std::optional< AllLocalTriangulations > buildUnitedLocalTriangulations(const PointCloud &cloud, const Settings &settings, const ProgressCallback &progress={})
Definition MRCameraOrientationPlugin.h:8
Definition MRMesh/MRPointCloud.h:16
Definition MRPointCloudTriangulationHelpers.h:55
bool stable
Definition MRPointCloudTriangulationHelpers.h:63
bool operator==(const FanOptimizerQueueElement &other) const =default
float weight
Definition MRPointCloudTriangulationHelpers.h:56
int prevId
Definition MRPointCloudTriangulationHelpers.h:60
int nextId
Definition MRPointCloudTriangulationHelpers.h:61
bool operator<(const FanOptimizerQueueElement &other) const
Definition MRPointCloudTriangulationHelpers.h:64
bool isOutdated(const std::vector< VertId > &neighbors) const
Definition MRPointCloudTriangulationHelpers.h:72
Definition MRPointCloudTriangulationHelpers.h:104
int maxRemoves
the maximum number of optimization steps (removals) in local triangulation
Definition MRPointCloudTriangulationHelpers.h:126
float boundaryAngle
the vertex is considered as boundary if its neighbor ring has angle more than this value
Definition MRPointCloudTriangulationHelpers.h:117
int numNeis
Definition MRPointCloudTriangulationHelpers.h:111
bool automaticRadiusIncrease
automatic increase of the radius if points outside can make triangles from original radius not-Delone
Definition MRPointCloudTriangulationHelpers.h:123
std::vector< VertId > * allNeighbors
optional output of considered neighbor points after filtering but before triangulation/optimization
Definition MRPointCloudTriangulationHelpers.h:129
const PointCloud * searchNeighbors
optional: if provided this cloud will be used for searching of neighbors (so it must have same validP...
Definition MRPointCloudTriangulationHelpers.h:135
const VertCoords * trustedNormals
if oriented normals are known, they will be used for neighbor points selection
Definition MRPointCloudTriangulationHelpers.h:120
float * actualRadius
optional output: actual radius of neighbor search (after increase if any)
Definition MRPointCloudTriangulationHelpers.h:132
float critAngle
max allowed angle for triangles in fan
Definition MRPointCloudTriangulationHelpers.h:114
float radius
Definition MRPointCloudTriangulationHelpers.h:107
Data with caches for optimizing fan triangulation.
Definition MRPointCloudTriangulationHelpers.h:83
FewSmallest< PointsProjectionResult > nearesetPoints
the storage to collect n-nearest neighbours, here to avoid allocations for each point
Definition MRPointCloudTriangulationHelpers.h:96
VertId border
Definition MRPointCloudTriangulationHelpers.h:93
std::vector< std::pair< double, int > > cacheAngleOrder
temporary reusable storage to avoid allocations for each point
Definition MRPointCloudTriangulationHelpers.h:89
MR_BIND_IGNORE std::priority_queue< FanOptimizerQueueElement > queue
Definition MRPointCloudTriangulationHelpers.h:100
std::vector< VertId > neighbors
Definition MRPointCloudTriangulationHelpers.h:86