Exploration of Laser Marking Path and Algorithm Based on Intelligent Computing and Internet of Things

Nowadays, laser processing technology is being used more and more in various fields, and the requirements for laser control procedures are getting higher and higher. This paper aims to study the path generation problem of laser marking technology in order to improve the efficiency of laser marking as well as the protection of the marking material. Therefore, we creatively propose two-path generation methods, namely, sawtooth parallel and contour parallel, and design the boundary curve offset algorithm and domain partition intersection algorithm for the computer simulation of the two marking paths, respectively. Through the simulation, we discussed the efficiency and marking quality of the two path generation methods and gave the conclusion that the efficiency of the sawtooth parallel path generation method is greater than that of the contour parallel path generation method under specific parameters.


Introduction
e laser [1] is an important invention of the 20th century and has been called "the sharpest knife," "the most accurate ruler," and "the most unusual light." Lasers have been increasingly used in industrial processes for a variety of machining operations such as marking, welding, drilling, cutting, heat treating, and painting. Laser marking [2] is the marking of logos, characters, symbols, and images with a laser on the product surface. It is a widely used processing method with the advantages of high processing efficiency, noncontact operation, no consumables, and low impact on product surface deformation [3] and solid marking content. e hatch tool of a laser marking machine can be used for hatch-specified 2D composite profile [4], but the setting of different hatch parameters has a great impact on the processing effect of different materials. Zigzag parallel [5] hatching and profile parallel [6] hatching are the two basic ways of marking road dynamics generation. And the design of different process processing and hatching algorithms has substantial significance on whether the operation efficiency and accuracy of laser marking machine [7] can be improved.
Nowadays, in the field of laser marking, more research lies in the combination selection and optimization of process parameters [8]. Shivakoti [9] et al. investigated the selection of optimal laser beam micromarking process parameters using the fuzzy TOPSIS [10] method in the GaN laser beam [11] marking process and concluded that small pulse frequency [12], high current, and scanning speed lead to increased mark intensity. Some people have explored this area through Bessel curves [13]. And a connected Fermat spiral area filling algorithm (CFS) [14] has also been proposed, but its study has not been deeply applied to laser marking technology and cannot be applied for complex graphics [15]. Our research aims to fill this gap in the laser marking path generation algorithm.
To fill this gap, in order to fill this gap, we explore the laser marking path generation algorithm from the perspective of improving the efficiency of laser marking path generation, combining computer graphics [16] principles with the length of the laser marking path and the time of the generation algorithm as the main factors. Firstly, we propose two-path generation methods, namely directionparallel hatching and contour-parallel hatching. Parallel directional shaded lines, also called "zigzag" shaded lines, have paths that move along line segments parallel to the initially selected reference direction. e two marking path forms are shown in Figure 1. Based on this strategy, connected paths are obtained by connecting these parallel line segments so that they either all cross from right to left (or left to right) or alternate between left to right and right to left. In contrast, contour-parallel shading uses offset line [17,18] segments based on boundary curves as smooth shading paths similar to boundary curves. us, contour-parallel shadows can be generated in a spiral fashion along a curve at a constant distance from the curve boundary. Later, the domain partition intersection algorithm and boundary curve offset algorithm are proposed for both methods and verified the feasibility and generation efficiency of both algorithms by computer simulation [19].

Method
In exploring the problem of laser marking path generation, we proposed the zigzag parallel and contour parallel [20] filling path approaches and used interpolation methods [21] to fit the original pattern at a high level to enhance the marking pattern.
Usually, the first function in an M-file is the main function, which can be followed by any number of subfunctions. e main function can be called by other functions outside that file, and the main function is called by the filename of the M file where the function is stored.
M files can include multiple functions, and functions other than the main function are called subfunctions. Subfunctions can only be called by the main function or by other subfunctions within that file. Each subfunction begins with a function definition statement and continues until the definition of the next function or the end of the file. e subfunctions appear in any order, but the main function must appear first.

Definition of Curve Fitting.
e spline curve [22] S(x) is a segmentally defined equation. Given (n + 1) data points and a total of n intervals, the cubic spline equation satisfies the following conditions: is a cubic polynomial (B) e following relationship is satisfied: (C) S(x), the derivative S ′ (x), and the second-order derivative S ″ (x) are all continuous in the interval [a, b], that is, the S(x) curve is smooth. So n cubic polynomial segments can be written as where i � 0, 1, . . ., n−1, and a i , b i , c i , d i represent the 4n unknown coefficients.

Request a Solution.
Interpolation and continuity: where i � 0, 1, . . ., n − 1. Differential continuity: where i � 0, 1, . . ., n − 2. Differential equation of a spline curve: Bring the following step size h into the conditions of the spline curve: us, we can deduce We assume that us, we can deduce the following result: It is equivalent to the following equation.
us, the following formula is derived as 2 Computational Intelligence and Neuroscience We substitute c i , d i into we can derive the formula: From the range of values of i, there are (n − 1) equations but (n + 1) unknowns m. To solve the system of equations, two additional equations are required. So some restrictions need to be placed on the differentiation of the two endpoints x 0 and x n . Here, we use not-a-knot [23] to solve the problem. Specify the cubic differential matching of the spline curve.
After that we can derive the following conclusions: e new coefficient matrix of the system of equations can be written as    e polyshape function [24] creates a polygon defined by two-dimensional vertices and returns an object with attributes describing its vertices, solid regions, and holes. e polybuffer function implements the creation of a buffer around a point, line, or polyshape object. Its boundary will be input to the polyshape object buffer polyin a distance d.  us, the maximum distance from any point (X, Y) on the road strength to the center of the path is obtained as: For the contour parallel line hatching problem, we use the buffer function polybuffer for computer simulation.
Returns a polyshape object with a boundary that creates a buffer at distance d based on the input polyshape object polyin.

Domain-Distinct Intersection Algorithm for Self-Intersecting Graphs Based on Zigzag Parallel Paths.
For the serrated parallel path, we propose a regionalized closed curve [26] and a straight-line intersection algorithm. Firstly the original graph is regionalized according to the concave and convex points. e original graphics and the zoning graphics are shown in Figures 2 and 3 respectively. Afterwards, using a straight line y � a from the top of the closed graph to the bottom in 1 mm steps in order to scan [27], using the intersect function to find the coordinates of the entry, and then according to the previous cycle can always find the coordinates of the intersection point of the line with the original graph each time y � a.
According to the above division, the region will be divided into many small blocks of all data points, each small block with an array to store the first (from left to right) of the intersection of the line, and then an array to store the second, because it is a sawtooth arrangement, so it must be the first from a small block to point to the second, and so on, the intersection of each small block will be the first from the small block of coordinates to point to the second coordinates. e X and Y values of the coordinates of the intersection point, the next in each array position relationship will be the X and Y values of the coordinates of the intersection point of the next line and the intersection point of the line at the coordinates of the intersection point of        that previous line and the graph. e scan intersection is shown in Figure 4.

Results
We conducted two simulation experiments on the designed contour parallel path boundary offset algorithm using Matlab software. e first simulation experiment was set to the inner shrinkage boundary distance of 1 mm and the hatch line spacing of 1 mm, and the second simulation experiment was set to the inner shrinkage boundary [28] distance of 0.1 mm and the hatch line spacing of 0.1 mm. Under these two sets of parameters, the total length of the hatching lines of the serrated parallel and contour parallel hatching curves were calculated, and the number of horizontal lines of the serrated parallel hatching and the number of circles of the contour parallel hatching were also calculated. e average running time (in ms) was calculated based on multiple runs of the hatching program, and the running time ratio of the program runs under different conditions was also calculated. e simulation results for the two parameters are shown in Figures 4 and 5, respectively.

Simulation of Boundary Curve Offset Algorithm Based on
Contour Parallel Path 3.1.1. Algorithm Analysis Results. We have performed an accurate analysis of the running time [29] of this algorithm and have derived the number of function calls and the time during    Tables 1 and 2.

Analysis Results.
According to the simulation experiment results, we counted the running time, the number of laps of the path, and the total length of the path for each simulation experiment, respectively. e results are shown in Table 3.

Simulation Results of Domain Partitioning Algorithm
Based on Sawtooth Parallel Paths without Self-Intersecting Graphs 3.2.1. Simulation Results. We generate the marking path according to the area division as follows. Figures 6 to 11 show each of the five areas of the division. e final results are shown in Figures 12 and 13, respectively.

Analysis of Domain Partitioning Intersection Algorithm
Based on Sawtooth Parallel Paths. For this algorithm, we conducted two sets of simulation experiments with different parameters and performed statistical analysis on the number of calls and time of each function in the operation of the algorithm, and the following results are obtained in Tables 4 and 5, respectively.

Zigzag Parallel Path Analysis.
We statistically analyze the average running time, path length, and number of path entries of the zigzag parallel path algorithm, and the following results are obtained in Tables 6.

Discussion and Conclusion
rough the simulation solution, we can know that the average operation time of the zigzag parallel pattern filling and contour parallel pattern filling algorithms is 1 mm and 0.1 mm. After the fitting algorithm in this paper, we can get a nearly parallel straight line, while the contour pattern can be filled in parallel. e K value of the fitting function of the algorithm is close to 10, that is, under the same magnification, the zigzag algorithm can approach the previous value in time. e algorithm in this paper can establish the length of two paths, that is, the distance that the laser sweeps through the whole closed figure, and the two paths are not very different [30].
However, the results of the simulation marking pattern can be seen, the simulation pattern based on the marking algorithm of the contour parallel path is more accurate, and the simulation pattern obtained by the marking algorithm of the sawtooth parallel path algorithm is relatively rough. Of course, this is also related to the design of our algorithm, and we believe that the accuracy of the serrated parallel path marking will be improved after the algorithm is continuously iterated and optimized.
Data Availability e datasets for this study can be found in the (official website of APMCM) (https://www.apmcm.org/detail/2403).

Conflicts of Interest
e authors declare that there are no conflicts of interest.