Easy3D 2.6.1
Loading...
Searching...
No Matches
point_cloud_poisson_reconstruction.h
1/********************************************************************
2 * Copyright (C) 2015 Liangliang Nan <liangliang.nan@gmail.com>
3 * https://3d.bk.tudelft.nl/liangliang/
4 *
5 * This file is part of Easy3D. If it is useful in your research/work,
6 * I would be grateful if you show your appreciation by citing it:
7 * ------------------------------------------------------------------
8 * Liangliang Nan.
9 * Easy3D: a lightweight, easy-to-use, and efficient C++ library
10 * for processing and rendering 3D data.
11 * Journal of Open Source Software, 6(64), 3255, 2021.
12 * ------------------------------------------------------------------
13 *
14 * Easy3D is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License Version 3
16 * as published by the Free Software Foundation.
17 *
18 * Easy3D is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ********************************************************************/
26
27#ifndef EASY3D_ALGO_POISSON_RECONSTRUCTION_H
28#define EASY3D_ALGO_POISSON_RECONSTRUCTION_H
29
30
31#include <string>
32
33
34namespace easy3d {
35
36 class PointCloud;
37 class SurfaceMesh;
38
44 public:
53
62 void set_depth(int d) { depth_ = d; }
63
72 void set_samples_per_node(float s) { samples_per_node_ = s; }
73
80 SurfaceMesh *apply(const PointCloud *cloud, const std::string &density_attr_name = "v:density") const;
81
91 static SurfaceMesh *trim(
92 SurfaceMesh *mesh,
93 float trim_value,
94 float area_ratio,
95 bool triangulate,
96 const std::string &density_attr_name = "v:density"
97 );
98
99 public:
100 // Other parameters for Poisson surface reconstruction algorithm. These parameters are usually not needed.
107 void set_full_depth(int v) { full_depth_ = v; }
112 void set_cg_depth(int v) { cgDepth_ = v; }
117 void set_scale(float v) { scale_ = v; }
124 void set_point_weight(float v) { pointWeight_ = v; }
129 void set_gs_iter(int v) { gsIter_ = v; }
134 void set_verbose(bool v) { verbose_ = v; }
135
136 private:
137 /*
138 This integer is the maximum depth of the tree that will be used for surface
139 reconstruction. Running at depth d corresponds to solving on a voxel grid
140 whose resolution is no larger than 2^d x 2^d x 2^d. Note that since the
141 reconstructor adapts the octree to the sampling density, the specified
142 reconstruction depth is only an upper bound.
143 The default value for this parameter is 8.
144 */
145 int depth_; // reconstruction depth
146
147 /*
148 This integer specifies the depth beyond depth the octree will be adapted.
149 At coarser depths, the octree will be complete, containing all 2^d x 2^d x 2^d nodes.
150 The default value for this parameter is 5. */
151 int full_depth_; // adaptive octree depth
152
153 /*
154 This floating point value specifies the minimum number of sample points that should
155 fall within an octree node as the octree construction is adapted to sampling density.
156 For noise-free samples, small values in the range [1.0 - 5.0] can be used. For more
157 noisy samples, larger values in the range [15.0 - 20.0] may be needed to provide a
158 smoother, noise-reduced, reconstruction. The default value is 1.0.
159 */
160 float samples_per_node_; // minimum number of samples
161
162 bool triangulate_mesh_;
163
164 private:
165 // these parameters usually do not need to change
166 int cgDepth_;
167 float scale_;
168
169 /*
170 This floating point value specifies the importance that interpolation of the point
171 samples is given in the formulation of the screened Poisson equation. The results
172 of the original (unscreened) Poisson Reconstruction can be obtained by setting this
173 value to 0. The default value for this parameter is 4.
174 */
175 float pointWeight_; // interpolation weight
176
177 int gsIter_;
178 int threads_;
179 bool verbose_;
180 };
181
182} // namespace easy3d
183
184#endif // EASY3D_ALGO_POISSON_RECONSTRUCTION_H
A data structure for point clouds.
Definition point_cloud.h:45
void set_cg_depth(int v)
Set the conjugate gradient depth.
Definition point_cloud_poisson_reconstruction.h:112
void set_scale(float v)
Set the scale factor.
Definition point_cloud_poisson_reconstruction.h:117
void set_point_weight(float v)
Set the point weight.
Definition point_cloud_poisson_reconstruction.h:124
void set_full_depth(int v)
Set the full depth of the octree.
Definition point_cloud_poisson_reconstruction.h:107
void set_verbose(bool v)
Set the verbosity of the reconstruction process.
Definition point_cloud_poisson_reconstruction.h:134
void set_samples_per_node(float s)
Set the minimum number of samples.
Definition point_cloud_poisson_reconstruction.h:72
static SurfaceMesh * trim(SurfaceMesh *mesh, float trim_value, float area_ratio, bool triangulate, const std::string &density_attr_name="v:density")
Trim the reconstructed surface model based on the density attribute.
Definition point_cloud_poisson_reconstruction.cpp:488
PoissonReconstruction()
Constructor.
Definition point_cloud_poisson_reconstruction.cpp:94
void set_depth(int d)
Set reconstruction depth.
Definition point_cloud_poisson_reconstruction.h:62
SurfaceMesh * apply(const PointCloud *cloud, const std::string &density_attr_name="v:density") const
Perform Poisson surface reconstruction.
Definition point_cloud_poisson_reconstruction.cpp:193
void set_gs_iter(int v)
Set the number of Gauss-Seidel iterations.
Definition point_cloud_poisson_reconstruction.h:129
A halfedge data structure for polygonal meshes of 2-manifold.
Definition surface_mesh.h:51
Definition collider.cpp:182