# 3D Reconstruction Based on Iterative Optimization of Moving Least-Squares Function
## 3 Methods
### Adaptive Octree Voxel Partitioning  
In conventional 3D reconstruction methods, autoencoders were widely employed to extract global or local shape features, which were subsequently used to generate the 3D surface. For instance, DeepSDF generates an implicit encoding for each shape, representing its global features. However, the shape surfaces generated by this method often lack detail and struggle to effectively capture intricate information. Consequently, methods have been proposed to transform the target shape from global to local, utilizing local features to express shape details. Among the partitioning methods, the octree data structure has proven to be the most effective, as exemplified by the O-CNN. O-CNN first normalized the target shape to a unit voxel and then performed octree division. Each voxel after division is termed an \"octant\". This octree partition operation is repeated until the specified depth is reached or the number of point clouds within the octant is less than the specified threshold. DeepMLS is a 3D reconstruction based on O-CNN; adaptive O-CNN proposed an adaptive octree partitioning method. Unlike O-CNN, this paper added a partitioning criterion based on O-CNN; that is, whether the point cloud within the octree can be fitted  
Figure 1: Structure diagram of the 3D reconstruction based on iterative optimization of MLS.  
by a plane. When the plane can fit the point cloud within the octant, it indicates that the local area is sufficiently flat and does not need to be further partitioned. However, according to the planar fitting results of adaptive O-CNN, the generated shape surface is not smooth enough.  
We propose a novel shape-adaptive partitioning method that utilizes the correlation between normal vectors of the input point cloud to achieve a more refined division from global to local representations. The input point cloud \(\mathcal{P}\) (\(p_{i}\in\mathcal{P}\), each \(p_{i}\) with a normal \(n_{i}\)) is normalized to a unit voxel and undergoes octree partitioning, where each voxel is recursively subdivided into eight equal parts. In the example of an octree with a depth of 4 (Figure 2), DeepMLS terminates the partitioning process due to the number of points in each octant falling below the smallest threshold. Our method retains this condition but introduces an additional criterion: the average cosine of the angle between the normal of each point in the input cloud and the average normal of the smallest octant containing that point must exceed a predefined threshold.  
This additional criterion ensures that regions with highly similar surface normals, indicating relatively smooth surfaces are not further subdivided, result in a more efficient and detail-preserving partitioning, which reduces computational cost while preserving important geometric features. The cosine mean is calculated as follows:  
\[\overline{c}=\frac{1}{m}\sum_{i=1}^{m}\left(cos(n_{i,d},n_{c,d})\right), \tag{1}\]  
where \(\overline{c}\) represents the mean of the cosine, \(m\) represents the total number of points within the smallest octant with depth \(d\) in the input point cloud, \(cos(n_{i,d},n_{c,d})\) shows the cosine value of the angle between the normal \(n_{i,d}\) of each point and the normal \(n_{c,d}\) of the smallest octant with depth \(d\). In our experiment, the threshold is set to 0.8. (When \(\overline{c}\) is smaller than 0.8, it indicates that the direction of the point cloud normal in the octant is uneven; that is, the octant may contain a complex geometric feature, requiring further subdivision). \(cos(n_{i,d},n_{c,d})\) is calculated as:  
\[cos(n_{i,d},n_{c,d})=\frac{n_{i,d}n_{c,d}}{\left|n_{i,d}\right|\left|n_{c,d} \right|}, \tag{2}\]  
\[n_{c,d}=\frac{1}{m}\sum_{i=1}^{m}n_{i,d}, \tag{3}\]  
where \(n_{i,d}\) represents the normal vector of the point cloud in depth \(d\), while \(n_{c,d}\) represents the mean normal of the point cloud in the smallest octant in depth \(d\) where \(p_{i}\) is located.