# Preliminary Application of the Algorithm Highlighting Petroglyph Patterns
## 4 Materials and Methods
The scanned objects are characterised by high surface roughness, which additionally makes it difficult to find the desired drawing. Due to the rough surface, it is not easy to identify only man-made fragments. It is assumed that the drawing is continuous, i.e., it has connection between successive fragments of the pattern being searched for. The processing consisted of preparat  
Figure 4: An example of a mesh area of a scanned petroglyph. Figure 5: View of the scanned object with a rock structure overlaid. Reading of the mesh model. Assessment of the location of the pattern in relation to the floor plane (\(XY\)). 3. 3D transforms of point clouds (rotations around the axis \(X\), \(Y\), \(Z\)). 4. Removing unnecessary fragments of the model. 5. Sorting points on the \(y\) coordinate. 6. Creating a section for a given interval \(m<y<n\). 7. Representation of the cross-section in the diagram. 8. Searching for local minima with specific properties for each cross-section (width and depth of the 'well'). 9. Joining sections--the vicinity of the points found must be within the range (elimination of local grooves). Algorithm 1 shows how to deal with the coordinate file (\(XYZ\)). ```
Input: Coordinate file \((x,y,z)\). Parameters defining the cross-section creation step, window parameters. Output: Coordinate file \((x,y,z)\). ```
1:Estimation of the model redundancy and the position of the pattern surface in relation to the floor plane \((XY)\). 2:Removing unnecessary fragments of the 3D model. 3:Transforms of point cloud (rotations around the axis \(OX,OY,OZ\)). 4:Sorting points on the \(y\) coordinate. 5:Creating a cross-section for a given range \((m,n)\). 6:Searching for local minimum with specific properties for each cross-section. 7:Joining sections--the vicinity of the points found must be within the range. ```  
**Algorithm 1**Cloud data pre-processing and cross-section creation  
The first step of the presented algorithm is to visualise the file containing the coordinates of each scanned point using the Ovito--Open Visualization Tool [18]. Preliminary evaluation of the visualized point cloud allows to determine whether a transformation around any of the \(X\), \(Y\) or \(Z\) axes is required in order to arrange the petroglyph surface parallel to the \(XY\) plane. Another reason may be the need to reduce the point set for faster processing [19]. The next step is to remove the model fragments. Reducing the number of points shortens the processing time and speeds up acquisitions of the final solution. The selection of fragments is manual and allows to reduce the size of the model by about 70%. If a deviation is found, transformations are carried out in accordance with Formulas (1)-(3). \[R_{X}(\alpha)= \begin{bmatrix}1&0&0&0\\ 0&cos\alpha&-sin\alpha&0\\ 0&sin\alpha&cos\alpha&0\\ 0&0&0&1\end{bmatrix} , \tag{1}\]  
\[R_{Y}(\alpha)= \begin{bmatrix}cos\alpha&0&sin\alpha&0\\ 0&1&0&0\\ -sin\alpha&0&cos\alpha&0\\ 0&0&0&1\end{bmatrix} , \tag{2}\]  
\[R_{Z}(\alpha)= \begin{bmatrix}cos\alpha&-sin\alpha&0&0\\ sin\alpha&cos\alpha&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix} , \tag{3}\]  
where \(R\) is the elementary rotation matrix in the \(X\), \(Y\), and \(Z\) axes, respectively, and \(\alpha\) is the rotation angle. \[ \begin{bmatrix}x^{\prime}\\ y^{\prime}\\ z^{\prime}\\ 1\end{bmatrix} =R\cdot \begin{bmatrix}x\\ y\\ z\\ 1\end{bmatrix}  \tag{4}\]  
The coordinates of the points after the rotation around any axis will be the result of multiplying the specific \(R\) matrix by the coordinates of each of the original points. Alignment in this way allows to generate a cross-section that can be easily interpreted, because the coordinates of each successive layer do not differ significantly from the previous one. After the initial preprocessing operations, the coordinates are saved to the local database. The use of a database enables the execution of several steps of the implemented algorithm simultaneously.