ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PoissonReconLib.h
Go to the documentation of this file.
1 // ##########################################################################
2 // # #
3 // # ACloudViewer WRAPPER: PoissonReconLib #
4 // # #
5 // # This program is free software; you can redistribute it and/or modify #
6 // # it under the terms of the GNU General Public License as published by #
7 // # the Free Software Foundation; version 2 or later of the License. #
8 // # #
9 // # This program is distributed in the hope that it will be useful, #
10 // # but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 // # GNU General Public License for more details. #
13 // # #
14 // # COPYRIGHT: Daniel Girardeau-Montaut #
15 // # #
16 // ##########################################################################
17 
18 #ifndef CC_POISSON_RECON_LIB_WRAPPER
19 #define CC_POISSON_RECON_LIB_WRAPPER
20 
21 #include <cstddef>
22 
25 public:
27  struct Parameters {
29  Parameters();
30 
33 
36 
39 
44  int depth = 8;
45 
48  float finestCellWidth = 0.0f;
49 
52 
55  float scale = 1.1f;
56 
60 
66  float samplesPerNode = 1.5f;
67 
70 
73  float pointWeight = 2.0f;
74 
76 
79  int iters = 8;
80 
83  bool density = false;
84 
87  bool withColors = true;
88 
90 
93  float colorPullFactor = 32.0f;
94 
96 
99  float normalConfidence = 0.0;
100 
102 
107  float normalConfidenceBias = 0.0;
108 
111  bool linearFit = false;
112 
115  int threads = 1;
116 
121 
124  int fullDepth = 5;
125 
127  int baseDepth = 0;
128 
130  int baseVCycles = 1;
131 
133  float cgAccuracy = 1.0e-3f;
134  };
135 
137  template <typename Real>
138  class ICloud {
139  public:
140  virtual size_t size() const = 0;
141  virtual bool hasNormals() const = 0;
142  virtual bool hasColors() const = 0;
143  virtual void getPoint(size_t index, Real* coords) const = 0;
144  virtual void getNormal(size_t index, Real* coords) const = 0;
145  virtual void getColor(size_t index, Real* rgb) const = 0;
146  };
147 
149  template <typename Real>
150  class IMesh {
151  public:
152  virtual void addVertex(const Real* coords) = 0;
153  virtual void addNormal(const Real* coords) = 0;
154  virtual void addColor(const Real* rgb) = 0;
155  virtual void addDensity(double d) = 0;
156  virtual void addTriangle(size_t i1, size_t i2, size_t i3) = 0;
157  };
158 
160  static bool Reconstruct(const Parameters& params,
161  const PoissonReconLib::ICloud<float>& inCloud,
163 
165  static bool Reconstruct(const Parameters& params,
166  const PoissonReconLib::ICloud<double>& inCloud,
168 };
169 
170 #endif // CC_POISSON_RECON_LIB_12_0_WRAPPER
cmdLineReadable * params[]
Input cloud interface.
virtual void getNormal(size_t index, Real *coords) const =0
virtual bool hasNormals() const =0
virtual size_t size() const =0
virtual void getColor(size_t index, Real *rgb) const =0
virtual bool hasColors() const =0
virtual void getPoint(size_t index, Real *coords) const =0
Output mesh interface.
virtual void addNormal(const Real *coords)=0
virtual void addDensity(double d)=0
virtual void addColor(const Real *rgb)=0
virtual void addVertex(const Real *coords)=0
virtual void addTriangle(size_t i1, size_t i2, size_t i3)=0
Wrapper to use PoissonRecon (Kazhdan et. al) as a library.
static bool Reconstruct(const Parameters &params, const PoissonReconLib::ICloud< float > &inCloud, PoissonReconLib::IMesh< float > &ouMesh)
Reconstruct a mesh from a point cloud (float version)
Algorithm parameters.
int baseVCycles
Coarse MG solver v-cycles.
float cgAccuracy
This flag specifies the accuracy cut-off to be used for CG.
float normalConfidence
Normal confidence exponent.
Parameters()
Default initializer.
float colorPullFactor
Data pull factor.
int baseDepth
Coarse MG solver depth.
int fullDepth
The depth beyond which the octree will be adapted.
BoundaryType boundary
Boundary type for the finite elements.
float normalConfidenceBias
Normal confidence bias exponent.
int iters
The number of solver iterations.