# Validation of a Manual Methodology for Measuring Roundness and Cylindicity Tolerances
## Appendix B  
In this appendix it is shown that the point \(\overline{X}(\overline{x},\overline{y},\overline{z})\) belongs to the least-squares line that best fits a cloud of points in space \(P_{i}(x_{i},y_{i},z_{i})\). As is well known, the distance from a point to a straight line is given by Equation (A7).  
\[dis(P_{i},r)=\frac{\left|\overrightarrow{P_{P_{i}}}\times\overrightarrow{V} \right|}{\left|\overrightarrow{V}\right|}\] (A7)  
If \(\overrightarrow{V}\) is a unity modulus vector, the distance is obtained from the Equation (A8).  
\[d_{i}=dis(P_{i},r)=\sqrt{\left(v(z_{i}-z_{0})-w(x_{i}-x_{0})\right)^{2}+\left( w(x_{i}-x_{0})-u(y_{i}-y_{0})\right)^{2}+\left(u(y_{i}-y_{0})-v(x_{i}-x_{0}) \right)^{2}}\] (A8)  
The least squares line is defined as the line that minimizes the sum of the distances to all points, \(\varepsilon\). Equation (A9) corresponds to \(\varepsilon\).  
\[\varepsilon=\sum\limits_{i=1}^{n}d_{i}^{2}=\sum\limits_{i=1}^{n}\left[\left(v( z_{i}-z_{0})-w(y_{i}-y_{0})\right)^{2}+\left(w(x_{i}-x_{0})-u(z_{i}-z_{0}) \right)^{2}+\left(u(y_{i}-y_{0})-v(x_{i}-x_{0})\right)^{2}\right]\] (A9)  
Taking the partial derivatives with respect to \(x_{0}\) and \(y_{0}\), Equations (A10) and (A11) are obtained.  
\[\frac{\partial\varepsilon}{\partial x_{0}}=\sum\limits_{i=1}^{n}2(w(x_{i}-x_{0 })-u(z_{i}-z_{0}))\cdot(-w)+2(u(y_{i}-y_{0})-v(x_{i}-x_{0}))\cdot v\] (A10)  
\[\frac{\partial\varepsilon}{\partial y_{0}}=\sum\limits_{i=1}^{n}2(v(z_{i}-z_{0 })-w(y_{i}-y_{0}))\cdot w+2(u(y_{i}-y_{0})-v(x_{i}-x_{0}))\cdot(-u)\] (A11)Taking into account Equation (A12),  
\[\frac{1}{n}\sum_{i=1}^{n}\left(x_{i}-x_{0}\right)=\overline{x}-x_{0}\] (A12)  
Equation (A10) can be rewritten and set equal to zero, obtaining Equation (A13).  
\[\frac{1}{n}\frac{\partial\epsilon}{\partial x_{0}}=0\Leftrightarrow-w^{2}( \overline{x}-x_{0})+u\cdot w(\overline{z}-z_{0})+u\cdot v(\overline{y}-y_{0} )-v^{2}(\overline{x}-x_{0})=0\] (A13)  
Rearranging the terms and operating afterwards, Equation (A14) can be established.  
\[w(\overline{z}-z_{0})+v(\overline{y}-y_{0})=\Big{(}w^{2}+v^{2}\Big{)}\frac{ \overline{x}-x_{0}}{u}\] (A14)  
Proceeding in a similar way, after combining Equations (A11) and (A12), Equation (A15) is finally obtained.  
\[\frac{1}{n}\frac{\partial\epsilon}{\partial y_{0}}=0\Leftrightarrow u( \overline{x}-x_{0})+w(\overline{z}-z_{0})=\Big{(}u^{2}+w^{2}\Big{)}\frac{ \overline{y}-y_{0}}{u}\] (A15)  
Since \(w(\overline{z}-z_{0})\) appears in both Equations (A14) and (A15), expression of Equation (A16) can be obtained as a combination of them.  
\[\Big{(}u^{2}+w^{2}\Big{)}\frac{\overline{y}-y_{0}}{v}-u(\overline{x}-x_{0})+v (\overline{y}-y_{0})=\Big{(}v^{2}+w^{2}\Big{)}\frac{\overline{x}-x_{0}}{u}\] (A16)  
Finally, Equation (A16) can be expressed as Equation (A17).  
\[\frac{\overline{x}-x_{0}}{u}=\frac{\overline{y}-y_{0}}{v}\] (A17)  
If this procedure is repeated by taking the partial derivative \(\frac{\partial\epsilon}{\partial z_{0}}\), Equation (A18) is concluded in an analogous way, which shows that the center of gravity \(\overline{X}(\overline{x},\overline{y},\overline{z})\) of the points \(P_{i}(x_{i},y_{i},z_{i})\) belongs to the least-squares line.  
\[\frac{\overline{x}-x_{0}}{u}=\frac{\overline{y}-y_{0}}{v}=\frac{\overline{z}- z_{0}}{w}\] (A18)