## 4 Intelligent Identification and Information Extraction of Rock Discontinuities
### Point Cloud Normal Vector Calculation  
Before conducting point cloud analysis, the normal vector of point cloud needed to be determined based on the spatial distribution of the point cloud first. In the traditional normal vector calculation, for each point xi in the point cloud, a K-Nearest-Neighbor (KNN) algorithm was used to search for the neighborhood points of xi and fit into the surface, and the points in the surface were subjected to principal component analysis (PCA), which was to find eigenvector corresponding to the minimum one. This eigenvector is the normal vector of the fitted surface. However, it was difficult to determine the value of K. Choosing too large or too small a value for K could cause either over-segmentation or under-segmentation of the point cloud, resulting in a large error in the calculation of the normal vector of the point cloud. Therefore, the normal vector calculation of the rock mass point cloud was based on the improved KNN search algorithm. Figure 11: Intelligent identification flow chart of rock discontinuity. Figure 10: Histogram of nearest point pair of improved ICP algorithm. Affected by point cloud acquisition equipment, methods, and spatial differences of features, the number of point clouds of different target objects in the same neighborhood range varies greatly. At this time, if a single-scale neighborhood is used, it will affect the accurate expression of local geometric features and cause the uncertainty of neighborhood features to increase, thus causing a large error in the calculation of normal vector. According to the entropy principle, for any point in the point cloud, the amount of information contained in its neighborhood range can be expressed by the information entropy, and the smaller the entropy value is, the less information is contained in the neighborhood of the point, and the higher the certainty of the point in any dimensional range, which can best express the actual distribution characteristics of the object surface [20], and the normal vector estimation is more reasonable. Therefore, using the neighborhood range information entropy, the best neighborhood radius K value can be obtained through the entropy function minimization constraint criterion, that is:  
\[E_{f}=-\sum_{i}p_{i}\log p_{i}=-p_{1}\ln p_{1}-p_{2}\ln p_{2}-p_{3}\ln p_{3} \tag{6}\]  
\[(p_{1},p_{2},p_{3})=\left[\frac{\sqrt{\lambda_{1}}-\sqrt{\lambda_{2}}}{\sqrt{ \lambda_{1}}},\frac{\sqrt{\lambda_{2}}-\sqrt{\lambda_{3}}}{\sqrt{\lambda_{1}}},\frac{\sqrt{\lambda_{3}}}{\sqrt{\lambda_{1}}}\right] \tag{7}\]  
\[R_{best}=\underset{r\subset[R_{\text{min}},R_{\text{max}}]}{\operatorname{ argmin}}(E_{f}) \tag{8}\]  
where \(p_{1}+p_{2}+p_{3}=1\), \(\lambda_{1},\lambda_{2},\lambda_{3}\) are the eigenvalues of the covariance matrix of the neighborhood point set; \(R_{best}\) is the optimal neighborhood radius; \(E_{f}\) is the information entropy of the neighborhood range; \([R_{\text{min}},R_{\text{max}}]\) is the neighborhood radius search interval, which is suggested to be \([0.02\text{ m},0.5\text{ m}]\)[20]. After completing the K-nearest-neighbor search, linear fitting based on least squares fitting is performed to obtain the plane equation. \[Ax+By+C=Z, \begin{bmatrix}x&y&1\end{bmatrix}\begin{bmatrix}A\\ B\\ C\end{bmatrix} =[Z] \tag{9}\]  
Let the coordinates of the \(k+1\) points on the discontinuity of the rock mass be \((x_{1},y_{1},z_{1}),(x_{2},y_{2},z_{2})\cdots(x_{k+1},y_{k+1},z_{k+1})\), then  
\[\left[ \begin{array}{ccc}x_{1}&y_{1}&1\\ \vdots&\vdots&\vdots\\ x_{k+1}&y_{k+1}&1\end{array} \right]\left[ \begin{array}{c}A\\ B\\ C\end{array} \right]=\left[ \begin{array}{c}Z_{1}\\ \vdots\\ Z_{k+1}\end{array} \right] \tag{10}\]  
\[Let\left[ \begin{array}{ccc}x_{1}&y_{1}&1\\ \vdots&\vdots&\vdots\\ x_{k+1}&y_{k+1}&1\end{array}