MeshLib Documentation
Loading...
Searching...
No Matches
MRLocalTriangulations.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRId.h"
4#include "MRVector.h"
5#include "MRBuffer.h"
6#include <array>
7#include <cstdint>
8#include <functional>
9#include <optional>
10
11namespace MR
12{
13
16{
19 VertId border;
20
22 std::uint32_t firstNei;
23
24 FanRecord( VertId b = {}, std::uint32_t fn = 0 ) : border( b ), firstNei( fn ) {}
26};
27
30{
32 VertId center;
33
34 FanRecordWithCenter( VertId c = {}, VertId b = {}, std::uint32_t fn = 0 ) : FanRecord( b, fn ), center( c ) {}
36};
37
40{
41 std::vector<VertId> neighbors;
42 std::vector<FanRecordWithCenter> fanRecords;
43 VertId maxCenterId; //in fanRecords
44};
45
52
55[[nodiscard]] MRMESH_API std::optional<AllLocalTriangulations> uniteLocalTriangulations( const std::vector<SomeLocalTriangulations> & in, const ProgressCallback & progress = {} );
56
58[[nodiscard]] MRMESH_API Vector3f computeNormal( const AllLocalTriangulations & triangs, const VertCoords & points, VertId v );
59
61MRMESH_API void orientLocalTriangulations( AllLocalTriangulations & triangs, const VertCoords & coords, const VertBitSet & region, const VertNormals & targetDir );
62MRMESH_API void orientLocalTriangulations( AllLocalTriangulations & triangs, const VertCoords & coords, const VertBitSet & region, const std::function<Vector3f(VertId)> & targetDir );
63
65MRMESH_API bool autoOrientLocalTriangulations( const PointCloud & pointCloud, AllLocalTriangulations & triangs, const VertBitSet & region, ProgressCallback progress = {},
66 Triangulation * outRep3 = nullptr,
67 Triangulation * outRep2 = nullptr );
68
73using TrianglesRepetitions = std::array<int, 4>;
74
77
79[[nodiscard]] MRMESH_API std::vector<UnorientedTriangle> findRepeatedUnorientedTriangles( const AllLocalTriangulations & triangs, int repetitions );
80
82[[nodiscard]] MRMESH_API Triangulation findRepeatedOrientedTriangles( const AllLocalTriangulations & triangs, int repetitions );
83
87 Triangulation * outRep3,
88 Triangulation * outRep2 );
89
90} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
std::vector<V>-like container that is 1) resized without initialization of its elements,...
Definition MRBuffer.h:54
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:20
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:576
Definition MRCameraOrientationPlugin.h:8
MRMESH_API TrianglesRepetitions computeTrianglesRepetitions(const AllLocalTriangulations &triangs)
computes statistics about the number of triangle repetitions in local triangulations
MRMESH_API std::optional< AllLocalTriangulations > uniteLocalTriangulations(const std::vector< SomeLocalTriangulations > &in, const ProgressCallback &progress={})
MRMESH_API Triangulation findRepeatedOrientedTriangles(const AllLocalTriangulations &triangs, int repetitions)
from local triangulations returns all oriented triangles with given number of repetitions each in [1,...
MRMESH_API void orientLocalTriangulations(AllLocalTriangulations &triangs, const VertCoords &coords, const VertBitSet &region, const VertNormals &targetDir)
orient neighbors around each point in
std::array< int, 4 > TrianglesRepetitions
Definition MRLocalTriangulations.h:73
MRMESH_API std::vector< UnorientedTriangle > findRepeatedUnorientedTriangles(const AllLocalTriangulations &triangs, int repetitions)
from local triangulations returns all unoriented triangles with given number of repetitions each in [...
MRMESH_API Vector3f computeNormal(const AllLocalTriangulations &triangs, const VertCoords &points, VertId v)
compute normal at point by averaging neighbor triangle normals weighted by triangle's angle at the po...
MRMESH_API bool autoOrientLocalTriangulations(const PointCloud &pointCloud, AllLocalTriangulations &triangs, const VertBitSet &region, ProgressCallback progress={}, Triangulation *outRep3=nullptr, Triangulation *outRep2=nullptr)
orient neighbors around each point in
constexpr NoInit noInit
Definition MRMesh/MRMeshFwd.h:57
triangulations for all points, with easy access by VertId
Definition MRLocalTriangulations.h:48
Buffer< VertId > neighbors
Definition MRLocalTriangulations.h:49
Vector< FanRecord, VertId > fanRecords
Definition MRLocalTriangulations.h:50
describes one fan of triangles around a point including the point
Definition MRLocalTriangulations.h:30
FanRecordWithCenter(VertId c={}, VertId b={}, std::uint32_t fn=0)
Definition MRLocalTriangulations.h:34
VertId center
center point in the fan
Definition MRLocalTriangulations.h:32
FanRecordWithCenter(NoInit)
Definition MRLocalTriangulations.h:35
describes one fan of triangles around a point excluding the point
Definition MRLocalTriangulations.h:16
FanRecord(NoInit)
Definition MRLocalTriangulations.h:25
VertId border
Definition MRLocalTriangulations.h:19
std::uint32_t firstNei
the position of first neigbor in LocalTriangulations::neighbours
Definition MRLocalTriangulations.h:22
FanRecord(VertId b={}, std::uint32_t fn=0)
Definition MRLocalTriangulations.h:24
Definition MRMesh/MRMeshFwd.h:56
Definition MRMesh/MRPointCloud.h:16
describes a number of local triangulations of some points (e.g. assigned to a thread)
Definition MRLocalTriangulations.h:40
std::vector< FanRecordWithCenter > fanRecords
Definition MRLocalTriangulations.h:42
VertId maxCenterId
Definition MRLocalTriangulations.h:43
std::vector< VertId > neighbors
Definition MRLocalTriangulations.h:41