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

Authors: Gang Lu; Yide Liu; Xue Yao; Jiachen Yang; Cheng Jia
Journal: Computational Intelligence and Neuroscience
 (2022)

---

## Abstract

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.


---

## Body

## 1. Introduction

The 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. The 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 direction-parallel 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. The 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. Thus, 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].Figure 1
Graphical representation of zigzag parallel and contour parallel hatch.


## 2. 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. The main function can be called by other functions outside that file, and the main function is called by the filename of theM 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. The subfunctions appear in any order, but the main function must appear first.


### 2.1. Original Graph Curve Fitting

#### 2.1.1. Definition of Curve Fitting

The 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:(A)
In each segment interval [xi, xi + 1] (i = 0, 1, …, n − 1, x increasing), S(x) = Si(x) is a cubic polynomial(B)
The following relationship is satisfied:(1)Six=yii=0,1,…,n.(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(2)Six=ai+bix−xi+cix−xi2+dix−xi3,where i = 0, 1, …, n−1, and ai, bi, ci, di represent the 4n unknown coefficients.


#### 2.1.2. Request a Solution

Interpolation and continuity:(3)Sixi=yi,Sixi+1=yi+1,where i = 0, 1, …, n − 1.Differential continuity:(4)Si′xi+1=Si+1″xi+1,Si′xi+1=Si+1″xi+1,where i = 0, 1, …, n − 2.Differential equation of a spline curve:(5)Six=ai+bix−xi+cix−xi2+dix−xi3,Si′x=bi+2cix−xi+3dix−xi2,Si″x=2ci+6dix−xi.Bring the following step sizeh into the conditions of the spline curve:(6)hi=xi+1−xi.Thus, we can deduce(7)ai=yi,ai+hibi+hi2ci+hi3di=yi+1,bi+2hici+3hi2di−bi+1=0,2ci+6hidi−2ci+1=0.We assume that(8)mi=Si″xi=2ci.Thus, we can deduce the following result:(9)2ci+6hidi−2ci+1=0.It is equivalent to the following equation.(10)mi+6hidi−mi+1=0.Thus, the following formula is derived as(11)di=mi+1−mi6hi.We substituteci, di into(12)yi+hibi+hi2ci+hi3di=yi+1,we can derive the formula:(13)bi=yi+1−yihi−hi2mi−hi6mi+1−mi.From the range of values ofi, 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 x0 and xn. Here, we use not-a-knot [23] to solve the problem.Specify the cubic differential matching of the spline curve.(14)S0′″x1=S1′″x1,Sn−2′″xn−1=Sn−1′″xn−1.After that we can derive the following conclusions:(15)h1m1−m0=h0m2−m1,hn−1mn−1−mn−2=hn−2mn−mn−1.The new coefficient matrix of the system of equations can be written as(16)−h1h0+h1−h0⋯⋯0h02h0+h1h10⋮0h12h1+h2h20⋮⋮0⋱⋱⋱00⋯0hn−22hn−2+hn−1hn−10⋯⋯−hn−1hn−2+hn−1−hn−2.


### 2.2. Introduction to Matlab Functions

The polyshape function [24] creates a polygon defined by two-dimensional vertices and returns an object with attributes describing its vertices, solid regions, and holes.The 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 distanced. For positive values of d, the solid area boundary polyin expands by unit d and the hole boundary shrinks by unit d. The negative values of d shrink the solid boundary and expand the hole boundary.The Intersect function is the intersection of a polyshape object. It can return the intersection of a closed curve and a line, and determine which parts of the line are inside and outside the closed curve.


### 2.3. Boundary Curve Offset Based on Contour Parallel Path

Decompose the original figure inton simple figures, denote the centroid [25] of each simple figure, GI represents the center point of each simple graph and the Si represents the area of each simple figure, yielding the central point coordinates of the original graph as(17)x=∑ni=1GixSi∑inSi,y=∑ni=1GixSi∑inSi.Thus, the maximum distance from any point (X, Y) on the road strength to the center of the path is obtained as:(18)d=maxX−x2+Y−y2..For the contour parallel line hatching problem, we use the buffer function polybuffer for computer simulation.(19)polyout=polybufferpolyin,d.Returns a polyshape object with a boundary that creates a buffer at distanced based on the input polyshape object polyin. For positive values of d, the solid area boundary of polyin is expanded by d units and the hole boundary is shrunk by d units. Negative values of d shrink the solid boundary and expand the hole boundary.


### 2.4. 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. The 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.Figure 2
Simulation graphics.Figure 3
Domain zoning.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.TheX 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. The scan intersection is shown in Figure 4.Figure 4
Scan for delivery.


## 2.1. Original Graph Curve Fitting

### 2.1.1. Definition of Curve Fitting

The 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:(A)
In each segment interval [xi, xi + 1] (i = 0, 1, …, n − 1, x increasing), S(x) = Si(x) is a cubic polynomial(B)
The following relationship is satisfied:(1)Six=yii=0,1,…,n.(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(2)Six=ai+bix−xi+cix−xi2+dix−xi3,where i = 0, 1, …, n−1, and ai, bi, ci, di represent the 4n unknown coefficients.


### 2.1.2. Request a Solution

Interpolation and continuity:(3)Sixi=yi,Sixi+1=yi+1,where i = 0, 1, …, n − 1.Differential continuity:(4)Si′xi+1=Si+1″xi+1,Si′xi+1=Si+1″xi+1,where i = 0, 1, …, n − 2.Differential equation of a spline curve:(5)Six=ai+bix−xi+cix−xi2+dix−xi3,Si′x=bi+2cix−xi+3dix−xi2,Si″x=2ci+6dix−xi.Bring the following step sizeh into the conditions of the spline curve:(6)hi=xi+1−xi.Thus, we can deduce(7)ai=yi,ai+hibi+hi2ci+hi3di=yi+1,bi+2hici+3hi2di−bi+1=0,2ci+6hidi−2ci+1=0.We assume that(8)mi=Si″xi=2ci.Thus, we can deduce the following result:(9)2ci+6hidi−2ci+1=0.It is equivalent to the following equation.(10)mi+6hidi−mi+1=0.Thus, the following formula is derived as(11)di=mi+1−mi6hi.We substituteci, di into(12)yi+hibi+hi2ci+hi3di=yi+1,we can derive the formula:(13)bi=yi+1−yihi−hi2mi−hi6mi+1−mi.From the range of values ofi, 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 x0 and xn. Here, we use not-a-knot [23] to solve the problem.Specify the cubic differential matching of the spline curve.(14)S0′″x1=S1′″x1,Sn−2′″xn−1=Sn−1′″xn−1.After that we can derive the following conclusions:(15)h1m1−m0=h0m2−m1,hn−1mn−1−mn−2=hn−2mn−mn−1.The new coefficient matrix of the system of equations can be written as(16)−h1h0+h1−h0⋯⋯0h02h0+h1h10⋮0h12h1+h2h20⋮⋮0⋱⋱⋱00⋯0hn−22hn−2+hn−1hn−10⋯⋯−hn−1hn−2+hn−1−hn−2.


## 2.1.1. Definition of Curve Fitting

The 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:(A)
In each segment interval [xi, xi + 1] (i = 0, 1, …, n − 1, x increasing), S(x) = Si(x) is a cubic polynomial(B)
The following relationship is satisfied:(1)Six=yii=0,1,…,n.(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(2)Six=ai+bix−xi+cix−xi2+dix−xi3,where i = 0, 1, …, n−1, and ai, bi, ci, di represent the 4n unknown coefficients.


## 2.1.2. Request a Solution

Interpolation and continuity:(3)Sixi=yi,Sixi+1=yi+1,where i = 0, 1, …, n − 1.Differential continuity:(4)Si′xi+1=Si+1″xi+1,Si′xi+1=Si+1″xi+1,where i = 0, 1, …, n − 2.Differential equation of a spline curve:(5)Six=ai+bix−xi+cix−xi2+dix−xi3,Si′x=bi+2cix−xi+3dix−xi2,Si″x=2ci+6dix−xi.Bring the following step sizeh into the conditions of the spline curve:(6)hi=xi+1−xi.Thus, we can deduce(7)ai=yi,ai+hibi+hi2ci+hi3di=yi+1,bi+2hici+3hi2di−bi+1=0,2ci+6hidi−2ci+1=0.We assume that(8)mi=Si″xi=2ci.Thus, we can deduce the following result:(9)2ci+6hidi−2ci+1=0.It is equivalent to the following equation.(10)mi+6hidi−mi+1=0.Thus, the following formula is derived as(11)di=mi+1−mi6hi.We substituteci, di into(12)yi+hibi+hi2ci+hi3di=yi+1,we can derive the formula:(13)bi=yi+1−yihi−hi2mi−hi6mi+1−mi.From the range of values ofi, 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 x0 and xn. Here, we use not-a-knot [23] to solve the problem.Specify the cubic differential matching of the spline curve.(14)S0′″x1=S1′″x1,Sn−2′″xn−1=Sn−1′″xn−1.After that we can derive the following conclusions:(15)h1m1−m0=h0m2−m1,hn−1mn−1−mn−2=hn−2mn−mn−1.The new coefficient matrix of the system of equations can be written as(16)−h1h0+h1−h0⋯⋯0h02h0+h1h10⋮0h12h1+h2h20⋮⋮0⋱⋱⋱00⋯0hn−22hn−2+hn−1hn−10⋯⋯−hn−1hn−2+hn−1−hn−2.


## 2.2. Introduction to Matlab Functions

The polyshape function [24] creates a polygon defined by two-dimensional vertices and returns an object with attributes describing its vertices, solid regions, and holes.The 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 distanced. For positive values of d, the solid area boundary polyin expands by unit d and the hole boundary shrinks by unit d. The negative values of d shrink the solid boundary and expand the hole boundary.The Intersect function is the intersection of a polyshape object. It can return the intersection of a closed curve and a line, and determine which parts of the line are inside and outside the closed curve.


## 2.3. Boundary Curve Offset Based on Contour Parallel Path

Decompose the original figure inton simple figures, denote the centroid [25] of each simple figure, GI represents the center point of each simple graph and the Si represents the area of each simple figure, yielding the central point coordinates of the original graph as(17)x=∑ni=1GixSi∑inSi,y=∑ni=1GixSi∑inSi.Thus, the maximum distance from any point (X, Y) on the road strength to the center of the path is obtained as:(18)d=maxX−x2+Y−y2..For the contour parallel line hatching problem, we use the buffer function polybuffer for computer simulation.(19)polyout=polybufferpolyin,d.Returns a polyshape object with a boundary that creates a buffer at distanced based on the input polyshape object polyin. For positive values of d, the solid area boundary of polyin is expanded by d units and the hole boundary is shrunk by d units. Negative values of d shrink the solid boundary and expand the hole boundary.


## 2.4. 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. The 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.Figure 2
Simulation graphics.Figure 3
Domain zoning.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.TheX 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. The scan intersection is shown in Figure 4.Figure 4
Scan for delivery.


## 3. Results

We conducted two simulation experiments on the designed contour parallel path boundary offset algorithm using Matlab software. The 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. The 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. The simulation results for the two parameters are shown in Figures 4 and 5, respectively.Figure 5
Results of simulation experiment I.


### 3.1. 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 the operation of the algorithm by running it several times. The results are shown in Tables 1 and 2.Table 1
Experiment I algorithm analysis.
Function nameNumber of callsTotal time (s)Self-use (s)createCanvas10.0070.002Getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001Polygon300.0390.017doSetup300.0220.022ToolbarController10.0050.004Attributes300.0120.003checkAttrs300.0010.001checkClass300.0010.001checkInputs300.0070.002Axescheck600.0090.007strcmpi (“parent”,x)600.0020.001Lunkuo12.2210.089Cla10.0070.003converStringToCharArgs300.0010.001generateArgumentDescriptor300.0040.004isCharOrString9000Gobjects920.0130.009claNotify10.0010.001Clo10.0030.003hasDisplay100Hold300.0230.014isFigureShowEnabled100isPublishingTest100isStringScalar600.0010.001markFigure300.0050.005Newplot310.0660.041Newplotwrapper10.0610.001Nextstyle300.010.01Table 2
Experiment II algorithm analysis.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002Getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001Polygon3140.3090.139doSetup3140.1770.17ToolbarController10.0050.004Attributes3140.0420.009checkAttrs3140.0020.002checkClass3140.0080.008checkInputs3140.0230.01Axescheck6280.0570.048strcmpi (“parent”,x)6280.0090.006Lunkuo120.4740.047Cla10.0070.002converStringToCharArgs3140.0040.004generateArgumentDescriptor3140.0130.012isCharOrString9420.0020.002Gobjects9420.0770.059claNotify10.0010.001Clo10.0030.003hasDisplay100Hold3140.1810.112isFigureShowEnabled100isPublishingTest100isStringScalar6280.0030.003markFigure3140.0390.039Newplot3150.1470.067newplot > ObserveAxesNextPlot3150.0270.021


#### 3.1.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. The results are shown in Table3.Table 3
Comparison of results of contour parallel experiments.
Experimental group12345Average timeNumber of lapsAverage time ratioCircumferenceTime(s)Number of experiment11.9371.9521.9951.9592.1031.9891110.436896.820220.58320.53420.5121.16921.00220.75911010017


### 3.2. 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. Figures6 to 11 show each of the five areas of the division. The final results are shown in Figures 12 and 13, respectively.Figure 6
Simulation experiment II partial enlargement.Figure 7
Region 1.Figure 8
Region 2.Figure 9
Region 3.Figure 10
Region 4.Figure 11
Region 5.Figure 12
Zigzag parallel experiment.Figure 13
Zigzag parallel experiment II.


#### 3.2.2. 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 Tables4 and 5, respectively.Table 4
Algorithm analysis based on zigzag parallel path simulation experiment I.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001ToolbarController10.0050.004axescheck60.0020.002strcmpi (“parent”,x)60.0010.001c2_iuci10.3630.035cla10.0060.002gobjects140.0020.002claNotify10.0010.001clo10.0030.003hasDisplay100hold60.0090.005isFigureShowEnabled100isPublishingTest100isStringScalar600markFigure60.0020.002newplot70.0590.041newplot > ObserveAxesNextPlot70.0080.002newplot > ObserveFigureNextPlot70.0010.001newplotwrapper70.0630.002area1530.0120.007intersect510.0340.028numboundaries4080.0110.01numsides1020.0040.003perimeter1530.010.006checkAndSimplify510.2040.166checkArray8670.0030.003checkConsistency4080.0010.001checkinput510.0070.003checkPointArray510.0030.003NumHoles1020.0020.002NumRegions1020.0030.003getXY510.0040.004isEmptyShape4080.0140.002isEqualShape510.0350.004parselntersectUnionArgs510.0010.001polyshape1020.2210.01settings10.0010settings10.0010.001usejava10.0010Table 5
Algorithm analysis based on zigzag parallel path simulation experiment II.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001ToolbarController10.0050.004axescheck60.0020.002strcmpi (“parent”,x)60.0010.001c2_iuci12.4760.08cla10.0060.002gobjects140.0020.002claNotify10.0010.001clo10.0030.003hasDisplay100hold60.0090.005isFigureShowEnabled100isPublishingTest10.0010.001isStringScalar600markFigure60.0020.002newplot70.0570.038newplot > ObserveAxesNextPlot70.0080.002newplot > ObserveFigureNextPlot70.0010.001newplotwrapper70.0610.002area15930.1030.048intersect5310.2830.251numboundaries42480.0990.085numsides10620.0260.021perimeter15930.0920.044checkAndSimplify5311.9451.653checkArray90270.0290.029checkConsistency42480.010.01checkinput5310.0230.011checkPointArray5310.010.01NumHoles10620.0120.012NumRegions10620.0230.023getXY5310.0120.012isEmptyShape42480.1190.021isEqualShape5310.2720.016parselntersectUnionArgs5310.0040.004polyshape10622.0430.075settings10.0010settings10.0010.001usejava10.0010


#### 3.2.3. 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 Tables6.Table 6
Analysis of each factor of the zigzag path simulation experiment.
Experimental group12345Average timeAverage time ratioCircumferenceNumber of articlesTimeNumber of experiment10.0730.0760.0760.0740.0780.07541.0026917695720.0750.0750.0750.0760.0770.075686885


## 3.1. 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 the operation of the algorithm by running it several times. The results are shown in Tables 1 and 2.Table 1
Experiment I algorithm analysis.
Function nameNumber of callsTotal time (s)Self-use (s)createCanvas10.0070.002Getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001Polygon300.0390.017doSetup300.0220.022ToolbarController10.0050.004Attributes300.0120.003checkAttrs300.0010.001checkClass300.0010.001checkInputs300.0070.002Axescheck600.0090.007strcmpi (“parent”,x)600.0020.001Lunkuo12.2210.089Cla10.0070.003converStringToCharArgs300.0010.001generateArgumentDescriptor300.0040.004isCharOrString9000Gobjects920.0130.009claNotify10.0010.001Clo10.0030.003hasDisplay100Hold300.0230.014isFigureShowEnabled100isPublishingTest100isStringScalar600.0010.001markFigure300.0050.005Newplot310.0660.041Newplotwrapper10.0610.001Nextstyle300.010.01Table 2
Experiment II algorithm analysis.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002Getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001Polygon3140.3090.139doSetup3140.1770.17ToolbarController10.0050.004Attributes3140.0420.009checkAttrs3140.0020.002checkClass3140.0080.008checkInputs3140.0230.01Axescheck6280.0570.048strcmpi (“parent”,x)6280.0090.006Lunkuo120.4740.047Cla10.0070.002converStringToCharArgs3140.0040.004generateArgumentDescriptor3140.0130.012isCharOrString9420.0020.002Gobjects9420.0770.059claNotify10.0010.001Clo10.0030.003hasDisplay100Hold3140.1810.112isFigureShowEnabled100isPublishingTest100isStringScalar6280.0030.003markFigure3140.0390.039Newplot3150.1470.067newplot > ObserveAxesNextPlot3150.0270.021


### 3.1.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. The results are shown in Table3.Table 3
Comparison of results of contour parallel experiments.
Experimental group12345Average timeNumber of lapsAverage time ratioCircumferenceTime(s)Number of experiment11.9371.9521.9951.9592.1031.9891110.436896.820220.58320.53420.5121.16921.00220.75911010017


## 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 the operation of the algorithm by running it several times. The results are shown in Tables 1 and 2.Table 1
Experiment I algorithm analysis.
Function nameNumber of callsTotal time (s)Self-use (s)createCanvas10.0070.002Getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001Polygon300.0390.017doSetup300.0220.022ToolbarController10.0050.004Attributes300.0120.003checkAttrs300.0010.001checkClass300.0010.001checkInputs300.0070.002Axescheck600.0090.007strcmpi (“parent”,x)600.0020.001Lunkuo12.2210.089Cla10.0070.003converStringToCharArgs300.0010.001generateArgumentDescriptor300.0040.004isCharOrString9000Gobjects920.0130.009claNotify10.0010.001Clo10.0030.003hasDisplay100Hold300.0230.014isFigureShowEnabled100isPublishingTest100isStringScalar600.0010.001markFigure300.0050.005Newplot310.0660.041Newplotwrapper10.0610.001Nextstyle300.010.01Table 2
Experiment II algorithm analysis.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002Getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001Polygon3140.3090.139doSetup3140.1770.17ToolbarController10.0050.004Attributes3140.0420.009checkAttrs3140.0020.002checkClass3140.0080.008checkInputs3140.0230.01Axescheck6280.0570.048strcmpi (“parent”,x)6280.0090.006Lunkuo120.4740.047Cla10.0070.002converStringToCharArgs3140.0040.004generateArgumentDescriptor3140.0130.012isCharOrString9420.0020.002Gobjects9420.0770.059claNotify10.0010.001Clo10.0030.003hasDisplay100Hold3140.1810.112isFigureShowEnabled100isPublishingTest100isStringScalar6280.0030.003markFigure3140.0390.039Newplot3150.1470.067newplot > ObserveAxesNextPlot3150.0270.021


## 3.1.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. The results are shown in Table3.Table 3
Comparison of results of contour parallel experiments.
Experimental group12345Average timeNumber of lapsAverage time ratioCircumferenceTime(s)Number of experiment11.9371.9521.9951.9592.1031.9891110.436896.820220.58320.53420.5121.16921.00220.75911010017


## 3.2. 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. Figures6 to 11 show each of the five areas of the division. The final results are shown in Figures 12 and 13, respectively.Figure 6
Simulation experiment II partial enlargement.Figure 7
Region 1.Figure 8
Region 2.Figure 9
Region 3.Figure 10
Region 4.Figure 11
Region 5.Figure 12
Zigzag parallel experiment.Figure 13
Zigzag parallel experiment II.


### 3.2.2. 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 Tables4 and 5, respectively.Table 4
Algorithm analysis based on zigzag parallel path simulation experiment I.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001ToolbarController10.0050.004axescheck60.0020.002strcmpi (“parent”,x)60.0010.001c2_iuci10.3630.035cla10.0060.002gobjects140.0020.002claNotify10.0010.001clo10.0030.003hasDisplay100hold60.0090.005isFigureShowEnabled100isPublishingTest100isStringScalar600markFigure60.0020.002newplot70.0590.041newplot > ObserveAxesNextPlot70.0080.002newplot > ObserveFigureNextPlot70.0010.001newplotwrapper70.0630.002area1530.0120.007intersect510.0340.028numboundaries4080.0110.01numsides1020.0040.003perimeter1530.010.006checkAndSimplify510.2040.166checkArray8670.0030.003checkConsistency4080.0010.001checkinput510.0070.003checkPointArray510.0030.003NumHoles1020.0020.002NumRegions1020.0030.003getXY510.0040.004isEmptyShape4080.0140.002isEqualShape510.0350.004parselntersectUnionArgs510.0010.001polyshape1020.2210.01settings10.0010settings10.0010.001usejava10.0010Table 5
Algorithm analysis based on zigzag parallel path simulation experiment II.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001ToolbarController10.0050.004axescheck60.0020.002strcmpi (“parent”,x)60.0010.001c2_iuci12.4760.08cla10.0060.002gobjects140.0020.002claNotify10.0010.001clo10.0030.003hasDisplay100hold60.0090.005isFigureShowEnabled100isPublishingTest10.0010.001isStringScalar600markFigure60.0020.002newplot70.0570.038newplot > ObserveAxesNextPlot70.0080.002newplot > ObserveFigureNextPlot70.0010.001newplotwrapper70.0610.002area15930.1030.048intersect5310.2830.251numboundaries42480.0990.085numsides10620.0260.021perimeter15930.0920.044checkAndSimplify5311.9451.653checkArray90270.0290.029checkConsistency42480.010.01checkinput5310.0230.011checkPointArray5310.010.01NumHoles10620.0120.012NumRegions10620.0230.023getXY5310.0120.012isEmptyShape42480.1190.021isEqualShape5310.2720.016parselntersectUnionArgs5310.0040.004polyshape10622.0430.075settings10.0010settings10.0010.001usejava10.0010


### 3.2.3. 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 Tables6.Table 6
Analysis of each factor of the zigzag path simulation experiment.
Experimental group12345Average timeAverage time ratioCircumferenceNumber of articlesTimeNumber of experiment10.0730.0760.0760.0740.0780.07541.0026917695720.0750.0750.0750.0760.0770.075686885


## 3.2.1. Simulation Results

We generate the marking path according to the area division as follows. Figures6 to 11 show each of the five areas of the division. The final results are shown in Figures 12 and 13, respectively.Figure 6
Simulation experiment II partial enlargement.Figure 7
Region 1.Figure 8
Region 2.Figure 9
Region 3.Figure 10
Region 4.Figure 11
Region 5.Figure 12
Zigzag parallel experiment.Figure 13
Zigzag parallel experiment II.


## 3.2.2. 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 Tables4 and 5, respectively.Table 4
Algorithm analysis based on zigzag parallel path simulation experiment I.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001ToolbarController10.0050.004axescheck60.0020.002strcmpi (“parent”,x)60.0010.001c2_iuci10.3630.035cla10.0060.002gobjects140.0020.002claNotify10.0010.001clo10.0030.003hasDisplay100hold60.0090.005isFigureShowEnabled100isPublishingTest100isStringScalar600markFigure60.0020.002newplot70.0590.041newplot > ObserveAxesNextPlot70.0080.002newplot > ObserveFigureNextPlot70.0010.001newplotwrapper70.0630.002area1530.0120.007intersect510.0340.028numboundaries4080.0110.01numsides1020.0040.003perimeter1530.010.006checkAndSimplify510.2040.166checkArray8670.0030.003checkConsistency4080.0010.001checkinput510.0070.003checkPointArray510.0030.003NumHoles1020.0020.002NumRegions1020.0030.003getXY510.0040.004isEmptyShape4080.0140.002isEqualShape510.0350.004parselntersectUnionArgs510.0010.001polyshape1020.2210.01settings10.0010settings10.0010.001usejava10.0010Table 5
Algorithm analysis based on zigzag parallel path simulation experiment II.
Function nameNumber of callsTotal time (s)Self-use time (s)createCanvas10.0070.002getlnstance100hasBeenOpened10.0010.001maybeShow10.0030.001ToolbarController10.0050.004axescheck60.0020.002strcmpi (“parent”,x)60.0010.001c2_iuci12.4760.08cla10.0060.002gobjects140.0020.002claNotify10.0010.001clo10.0030.003hasDisplay100hold60.0090.005isFigureShowEnabled100isPublishingTest10.0010.001isStringScalar600markFigure60.0020.002newplot70.0570.038newplot > ObserveAxesNextPlot70.0080.002newplot > ObserveFigureNextPlot70.0010.001newplotwrapper70.0610.002area15930.1030.048intersect5310.2830.251numboundaries42480.0990.085numsides10620.0260.021perimeter15930.0920.044checkAndSimplify5311.9451.653checkArray90270.0290.029checkConsistency42480.010.01checkinput5310.0230.011checkPointArray5310.010.01NumHoles10620.0120.012NumRegions10620.0230.023getXY5310.0120.012isEmptyShape42480.1190.021isEqualShape5310.2720.016parselntersectUnionArgs5310.0040.004polyshape10622.0430.075settings10.0010settings10.0010.001usejava10.0010


## 3.2.3. 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 Tables6.Table 6
Analysis of each factor of the zigzag path simulation experiment.
Experimental group12345Average timeAverage time ratioCircumferenceNumber of articlesTimeNumber of experiment10.0730.0760.0760.0740.0780.07541.0026917695720.0750.0750.0750.0760.0770.075686885


## 4. Discussion and Conclusion

Through 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. The 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.The 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.



---

*Source: 7443410-2022-06-24.xml*