11# cython: language_level=3str
22
3+ # # 2021.07.21: code adapted from https://github.com/mmolero/pypoisson
4+ # # https://github.com/mmolero/pypoisson/blob/4f6a651d20ff2bab5ec0d0f8d0a14cc6cef3ef51/src/pypoisson.pyx
5+
36cimport numpy as np
47import numpy as np
58from libcpp.vector cimport vector
@@ -17,9 +20,9 @@ cdef extern from "../Src/PoissonReconLib.h":
1720
1821def poisson_reconstruction (points , normals ,
1922 depth = 8 , full_depth = 5 , scale = 1.1 ,
20- samples_per_node = 1.0 , cg_depth = 0.0 ,
23+ samples_per_node = 1.0 ,
2124 enable_polygon_mesh = False , enable_density = False ,
22- nthreads = 0 , verbose = False ):
25+ nthreads = 8 , verbose = False ):
2326
2427 """
2528 Python Binding of Poisson Surface Reconstruction
@@ -64,12 +67,6 @@ def poisson_reconstruction(points, normals,
6467 For more noisy samples, larger values in the range [15.0 - 20.0] may be needed to provide a smoother, noise-reduced, reconstruction.
6568 The default value is 1.0.
6669
67- cg_depth: Integer
68-
69- This integer is the depth up to which a conjugate-gradients solver will be used to solve the linear system.
70- Beyond this depth Gauss-Seidel relaxation will be used.
71- The default value for this parameter is 0.
72-
7370 enable_polygon_mesh: Bool
7471 Enabling this flag tells the reconstructor to output a polygon mesh (rather than triangulating the results of Marching Cubes).
7572 The default value for this parameter is False.
@@ -79,7 +76,8 @@ def poisson_reconstruction(points, normals,
7976 The default value for this parameter is False.
8077
8178 nthreads: int
82- Number of omp threads to use. Default = 0 = all available threads.
79+ This parameter specifies the number of threads across which the solver should be parallelized.
80+ The default value for this parameter is 8.
8381
8482 verbose: Bool
8583 Enable verbose mode.
@@ -104,7 +102,7 @@ def poisson_reconstruction(points, normals,
104102 return _poisson_reconstruction(np.ascontiguousarray(np.float64(points)),
105103 np.ascontiguousarray(np.float64(normals)),
106104 depth, full_depth, scale, samples_per_node,
107- cg_depth, enable_polygon_mesh, enable_density,
105+ enable_polygon_mesh, enable_density,
108106 nthreads, verbose)
109107
110108
@@ -115,7 +113,6 @@ cdef _poisson_reconstruction(np.float64_t[:, ::1] points,
115113 int full_depth = 5 ,
116114 double scale = 1.10 ,
117115 double samples_per_node = 1.0 ,
118- double cg_depth = 0.0 ,
119116 bool enable_polygon_mesh = False ,
120117 bool enable_density = False ,
121118 int nthreads = 0 ,
@@ -127,7 +124,6 @@ cdef _poisson_reconstruction(np.float64_t[:, ::1] points,
127124 string arg_full_depth = str (full_depth).encode()
128125 string arg_scale = str (scale).encode()
129126 string arg_samples_per_node = str (samples_per_node).encode()
130- string arg_cg_depth = str (cg_depth).encode()
131127 string arg_nthreads = str (nthreads).encode()
132128
133129 int_data.clear()
@@ -145,17 +141,16 @@ cdef _poisson_reconstruction(np.float64_t[:, ::1] points,
145141 mem_data[j + point_ncols + i * (point_ncols + normal_ncols)] = normals[i,j]
146142
147143
148- args = [b" PoissonRecon" , b" --in" , b" none" , b" --out" , b" none" , b" --depth" , arg_depth.c_str(),
149- b" --fullDepth" , arg_full_depth.c_str(), b" --scale" , arg_scale.c_str(),
150- b" --samplesPerNode" , arg_samples_per_node.c_str(),
151- b" --cgDepth" , arg_cg_depth.c_str()]
144+ args = [b" PoissonRecon" , b" --in" , b" none" , b" --out" , b" none" ,
145+ b" --depth" , arg_depth.c_str(),
146+ b" --fullDepth" , arg_full_depth.c_str(),
147+ b" --scale" , arg_scale.c_str(),
148+ b" --samplesPerNode" , arg_samples_per_node.c_str(),
149+ b" --threads" , arg_nthreads.c_str()
150+ ]
152151
153152 if verbose == True :
154153 args += [b" --verbose" ]
155-
156- if nthreads > 0 :
157- args += [b" --threads" , arg_nthreads.c_str()]
158-
159154 if enable_polygon_mesh:
160155 args += [b" --polygonMesh" ]
161156 if enable_density:
0 commit comments