MeshLib C++ Docs
Loading...
Searching...
No Matches
MRWeightedPointsShell.h
1#pragma once
2
3#include "MRVoxelsFwd.h"
4#include "MRDistanceVolumeParams.h"
5#include "MRMarchingCubes.h"
6#include "MRMesh/MRExpected.h"
7#include "MRMesh/MRProgressCallback.h"
8#include "MRMesh/MRClosestWeightedPoint.h"
9#include "MRMesh/MRBitSet.h"
10#include "MRMesh/MRBox.h"
11#include "MRPch/MRBindingMacros.h"
12
13namespace MR::WeightedShell
14{
15
16struct DistanceVolumeCreationParams
17{
18 DistanceVolumeParams vol;
19
20 DistanceFromWeightedPointsComputeParams dist;
21};
22
24[[nodiscard]] MRVOXELS_API FunctionVolume pointsToDistanceVolume( const PointCloud & cloud, const DistanceVolumeCreationParams& params );
25
27[[nodiscard]] MRVOXELS_API FunctionVolume meshToDistanceVolume( const Mesh & mesh, const DistanceVolumeCreationParams& params );
28using meshToDistanceVolumeT = std::function<FunctionVolume(const Mesh&, const DistanceVolumeCreationParams&)>;
29
30struct ParametersBase
31{
33 float offset = 0;
34
37 float voxelSize = 0;
38
40 float numLayers = 1.001f;
41
43 ProgressCallback progress;
44
45
46 // To allow passing Python lambdas into `dist.pointWeight`.
47 MR_BIND_PREFER_UNLOCK_GIL_WHEN_USED_AS_PARAM
48};
49
50struct ParametersMetric : ParametersBase
51{
53 DistanceFromWeightedPointsParams dist;
54};
55
56struct ParametersRegions : ParametersBase
57{
58 struct Region
59 {
60 VertBitSet verts;
61 float weight = 0.f;
62 };
63
66 std::vector<Region> regions;
67
70 float interpolationDist = 0;
71
74 bool bidirectionalMode = true;
75};
76
80// MR_BIND_IGNORE to hide this function in Python API because calling Python's Lambda will be extremely slow anyway
81[[nodiscard]] MR_BIND_IGNORE MRVOXELS_API Expected<Mesh> pointsShell( const PointCloud & cloud, const ParametersMetric& params );
82
86[[nodiscard]] MRVOXELS_API Expected<Mesh> pointsShell( const PointCloud & cloud, const VertScalars& pointWeights, const ParametersMetric& params );
87
91// MR_BIND_IGNORE to hide this function in Python API because calling Python's Lambda will be extremely slow anyway
92[[nodiscard]] MR_BIND_IGNORE MRVOXELS_API Expected<Mesh> meshShell( const Mesh & mesh, const ParametersMetric& params );
93
97[[nodiscard]] MRVOXELS_API Expected<Mesh> meshShell( const Mesh & mesh, const VertScalars& vertWeights, const ParametersMetric& params );
98
100MRVOXELS_API VertScalars calculateShellWeightsFromRegions(
101 const Mesh& mesh, const std::vector<ParametersRegions::Region>& regions, float interpolationDist );
102
104[[nodiscard]] MRVOXELS_API Expected<Mesh> meshShell( const Mesh& mesh, const ParametersRegions& params );
105
107[[nodiscard]] MRVOXELS_API Expected<Mesh> meshShell( const Mesh& mesh, const ParametersRegions& params, meshToDistanceVolumeT volumeBuilder );
108
109} //namespace MR::WeightedShell
Definition MRMesh/MRMesh.h:23
Definition MRMesh/MRPointCloud.h:17
new unsafe ref float voxelSize
new unsafe MR.Std.Function_BoolFuncFromFloat progress
new unsafe ref float numLayers
Definition MRWeightedPointsShell.h:51
new unsafe MR.DistanceFromWeightedPointsParams dist
Definition MRWeightedPointsShell.h:57
new unsafe ref float interpolationDist
new unsafe MR.Std.Vector_MRWeightedShellParametersRegionsRegion regions
new unsafe ref bool bidirectionalMode
static unsafe MR.FunctionVolume pointsToDistanceVolume(MR.Const_PointCloud cloud, MR.WeightedShell.Const_DistanceVolumeCreationParams params_)
static unsafe MR.FunctionVolume meshToDistanceVolume(MR.Const_Mesh mesh, MR.WeightedShell.Const_DistanceVolumeCreationParams params_)
Definition MRWeightedPointsShell.h:59