## 3 Method
### Comparison of Two Objects: Optimization Function  
We have two 3D objects, \(O_{1}\) and \(O_{2}\), to be compared for identity. Let us mathematically define the meaning of the word \"identity\" used in this work.  
We assume that a 3D object \(O\) has the surface \(S\) with a correct geometry. The object is scaled the way that the centroid of its surface is at the origin of the system of coordinates, and the object itself fits into a sphere of radius 16 and touches this sphere. The number 16 was arbitrarily chosen as a parameter of the method.  
Let us place \(n\) concentric spheres (shells) centered at this origin. We use a set of nine spheres with radii of 1, 3, 5, \(\ldots\), 17. On each \(i\)-th sphere, \(i=1,\ldots,n\), and a continuous function \(f^{(i)}(\theta,\varphi)\) is defined. This function is called the shortest distance function (SDF), and its value is the shortest distance from the point \((\theta,\varphi)\) of this \(i\)-th sphere to the surface \(S\). This distance could have a positive or negative sign. The distance is considered positive if the point \((\theta,\varphi)\), for which the distance to the surface \(S\) is measured, is outside this surface, and negative otherwise. The SDF is a continuous function on \(S^{2}\).  
Let us assume that we found the function \(f=\{f^{(i)}\}\), where \(f^{(i)}=\{f^{(i)}_{lm}\}\) corresponds to object \(O_{1}\) spherical coefficients of \(i\)-th sphere, and the function \(g=\{g^{(i)}\},g^{(i)}=\left\{g^{(i)}_{lm}\right\}\) corresponds to \(O_{2}\).  
Let us denote  
\[M_{0}^{(i)}(l)=\left|\sum_{m=-l}^{l}{|f^{(i)}_{lm}|}^{2}-\sum_{m=-l}^{l}{|g^{(i )}_{lm}|}^{2}\right|.\]  
Due to the Parseval equation [33], if the objects are the rotated version of each other, the absolute value of the difference of energies for expansions \(f\) and \(g\) for degree \(l\) should be equal to zero as follows:  
\[M_{0}^{(i)}(l)=0.\]  
Due to inevitable errors of numerical calculations, we assume that for the rotated versions of objects, the difference should be less than or equal to some threshold \(T_{\text{energy}}\)  
\[M_{0}^{(i)}(l)\leq T_{\text{energy}} \tag{6}\]  
for all the degrees \(l\) used for partial reconstruction. In the calculations, the difference \(M_{0}^{(i)}(l)\) is considered negligible if it is either below 5% of the first object's energy or below 0.01 (the approach is the same as the Python function _isclose_ with relative and absolute tolerances). Condition (6) is used to check the energy similarity of both objects in step A2.  
It is also possible to use a more general form as follows:  
\[M_{1}=\min_{i=1,\ldots,n}\text{CS}^{(i)}, \tag{7}\]  
where  
\[\text{CS}^{(i)}=\text{cosine\_distance}\Big{(}\Big{\{}f^{(i)}\Big{\}},\Big{\{} g^{(i)}\Big{\}}\Big{)}\]  
As a condition of similarity, we request that \(M_{1}\) should be less than the cosine of 10 degrees. This condition is necessary but not sufficient, as shown in [13] (Figure 5 with an airplane).  
One more additional loss function used is  
\[M_{2}=\sum_{i=1}^{n}\Bigl{(}1-\text{CS}^{(i)}\Bigr{)}, \tag{8}\]This is the sum of overall deviations of the spherical coefficients at each sphere. We consider the smaller \(M_{2}\) the better the solution.  
The loss functions, \(M_{1}\) and \(M_{2}\), are used in step A7.  
If we assume that function \(g\) is the result of the application of function \(f\) to sphere \(S_{R}^{2}\) (sphere \(S^{2}\) rotated by transformation \(R\)), then \(g=fR\). We would like to find the transformation \(R\) to map object \(O_{1}\) (corresponding to function \(f\)) to \(O_{2}\) (corresponding to function \(g\)). This transformation \(R\) can be defined as  
\[R=\underset{R}{\text{argmin}}\ \|g-fR\|\]  
In case the best \(R\) found gives the cosine similarity measure \(M_{1}\) above some predefined threshold \(T_{\text{CS}}\), we consider objects \(O_{1}\) and \(O_{2}\) as nonidentical. We chose \(T_{\text{CS}}\) corresponding to 10 degrees.  
One more measure of mapping accuracy could be the Root-Mean-Square Deviation between two reconstructions (5).