Easy3D 2.5.3
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
42 public:
45
53 void set_depth(int d) { depth_ = d; }
54
62 void set_samples_per_node(float s) { samples_per_node_ = s; }
63
65 SurfaceMesh *apply(const PointCloud *cloud, const std::string &density_attr_name = "v:density") const;
66
68 static SurfaceMesh *trim(
69 SurfaceMesh *mesh,
70 const std::string &density_attr_name,
71 float trim_value, float area_ratio, bool triangulate
72 );
73
74 public:
77 void set_full_depth(int v) { full_depth_ = v; }
78 void set_cg_depth(int v) { cgDepth_ = v; }
79 void set_scale(float v) { scale_ = v; }
80 void set_point_weight(float v) { pointWeight_ = v; }
81 void set_gs_iter(int v) { gsIter_ = v; }
82 void set_verbose(bool v) { verbose_ = v; }
83
84 private:
85 /*
86 This integer is the maximum depth of the tree that will be used for surface
87 reconstruction. Running at depth d corresponds to solving on a voxel grid
88 whose resolution is no larger than 2^d x 2^d x 2^d. Note that since the
89 reconstructor adapts the octree to the sampling density, the specified
90 reconstruction depth is only an upper bound.
91 The default value for this parameter is 8.
92 */
93 int depth_; // reconstruction depth
94
95 /*
96 This integer specifies the depth beyond depth the octree will be adapted.
97 At coarser depths, the octree will be complete, containing all 2^d x 2^d x 2^d nodes.
98 The default value for this parameter is 5. */
99 int full_depth_; // adaptive octree depth
100
101 /*
102 This floating point value specifies the minimum number of sample points that should
103 fall within an octree node as the octree construction is adapted to sampling density.
104 For noise-free samples, small values in the range [1.0 - 5.0] can be used. For more
105 noisy samples, larger values in the range [15.0 - 20.0] may be needed to provide a
106 smoother, noise-reduced, reconstruction. The default value is 1.0.
107 */
108 float samples_per_node_; // minimum number of samples
109
110 bool triangulate_mesh_;
111
112 private:
113 // these parameters usually do not need to change
114 int cgDepth_;
115 float scale_;
116
117 /*
118 This floating point value specifies the importance that interpolation of the point
119 samples is given in the formulation of the screened Poisson equation. The results
120 of the original (unscreened) Poisson Reconstruction can be obtained by setting this
121 value to 0. The default value for this parameter is 4.
122 */
123 float pointWeight_; // interpolation weight
124
125 int gsIter_;
126 int threads_;
127 bool verbose_;
128 };
129
130} // namespace easy3d
131
132#endif // EASY3D_ALGO_POISSON_RECONSTRUCTION_H
A data structure for point clouds.
Definition: point_cloud.h:45
Poisson surface reconstruction.
Definition: point_cloud_poisson_reconstruction.h:41
void set_full_depth(int v)
Other parameters for Poisson surface reconstruction algorithm. These parameters are usually not neede...
Definition: point_cloud_poisson_reconstruction.h:77
void set_samples_per_node(float s)
Set the minimum number of samples. This floating point value specifies the minimum number of sample p...
Definition: point_cloud_poisson_reconstruction.h:62
void set_depth(int d)
Set reconstruction depth. This integer is the maximum depth of the tree that will be used for surface...
Definition: point_cloud_poisson_reconstruction.h:53
static SurfaceMesh * trim(SurfaceMesh *mesh, const std::string &density_attr_name, float trim_value, float area_ratio, bool triangulate)
Trim the reconstructed surface model based on the density attribute.
Definition: point_cloud_poisson_reconstruction.cpp:488
SurfaceMesh * apply(const PointCloud *cloud, const std::string &density_attr_name="v:density") const
reconstruction
Definition: point_cloud_poisson_reconstruction.cpp:193
A halfedge data structure for polygonal meshes of 2-manifold.
Definition: surface_mesh.h:52
Definition: collider.cpp:182