# Bidirectional Sliding Window for Boundary Recognition of Pavement Construction Area Using GPS-RTK
## 1 Introduction
### PCA Boundary Recognition with BSW  
Sliding Window (SW) is a transmission control technology applied in the TCP (Transmission Control Protocol) and this algorithm only pays attention to the information in the window at each moment. As shown in Figure 4, the gray curve is the PCA boundary to be fitted. The SW with a window size of three to detect RP is indicated by the blue dotted boxes, and the red and black circles are the PIP and RP detected by the BSW algorithm, respectively.  
Differently from the traditional SW algorithm, the proposed BSW algorithm selects the PIP by using the Sliding Window Clockwise (SWC) once and the Sliding Window Anticlockwise (SWA) once. As shown in Algorithm 1, the SWC and SWA flags are set to determine the proper window width and select PIP, and the RP data set is the DBD (abbreviation for DoubleBoundaryData mentioned in Algorithm 1) data set minus the PIP. In this paper, we call the proposed algorithm BSW due to the implementation of the SWC and SWA.  
Figure 4: Sliding Window (SW) with a window size of three to detect Relevant Points (RPs).  
```
Input:WindowWidth Output:FittingError,WindowWidth  Design a curved quadrilateral as shown in Figure 1f that meets the curvature constraints of the articulated road roller. Sample the curved quadrilateral and add the GPS-RTK measurement error distribution to simulate the acquired boundary data. To avoid data overflow in the experiment, double the boundary data and define variable DoubleBoundaryData as DBD.  SWC \(\gets\) 0, SWA \(\gets\) 0, PIP \(\leftarrow\) {\(\O\)}, RP \(\leftarrow\) {\(\O\)},  While SWC == 0 do \(|\) PIP\({}_{\text{c}}\leftarrow\) {\(\O\)} | for k \(\leftarrow\) 1 to K do \(|\) Cof\({}_{\text{c}}\leftarrow\) SlidingWindowC (DBD, WindowWidth, k) || if Cof\({}_{\text{c}}>\) 1 or Cof\({}_{\text{c}}<\) = 0 then \(|\) L WindowWidth \(\leftarrow\) WindowWidth + 1, break \(|\) if Cof\({}_{\text{c}}<\) Threshold\({}_{\text{c}}\) and Cof\({}_{\text{c}}>\) 0 then \(|\) L PIP\({}_{\text{c}}\leftarrow\) PIP\({}_{\text{c}}\cup\) {DBD.k} || Extract the set of more than two consecutive PIP\({}_{\text{c}}\) and mark them as C.a,C.b, \(\ldots\subset\) C || if k == K and length(C) == 2 then \(\text{L\ L\ L\ SWC }\gets 1\) While SWA == 0 do \(|\) PIP\({}_{\text{a}}\leftarrow\) {\(\O\)} | for k \(\leftarrow\) 2K to K + 1 do \(|\) Cof\({}_{\text{a}}\leftarrow\) SlidingWindowA (DBD, WindowWidth, k) || if Cof\({}_{\text{a}}>\) 1 or Cof\({}_{\text{a}}<\) = 0 then \(|\) L WindowWidth \(\leftarrow\) WindowWidth + 1, break \(|\) if Cof\({}_{\text{a}}\) \(<\) Threshold\({}_{\text{a}}\) and Cof\({}_{\text{a}}>\) 0 then \(|\) L PIP\({}_{\text{a}}\leftarrow\) PIP\({}_{\text{a}}\cup\) {DBD.k} || Extract the set of more than two consecutive PIP\({}_{\text{a}}\) and mark them as A.a,A.b, \(\ldots\subset\) A || if k == K + 1 and length(A) == 2 then \(\text{L\ L\ L\ SWA }\gets 1\) PIP\(\leftarrow\) PIP\({}_{\text{c}}\cup\) PIP\({}_{\text{a}}\) RP \(\leftarrow\) DBD \(\setminus\) PIP FittingError \(\leftarrow\) BoundaryRecognition(RP)
```  
**Algorithm 1**Boundary Recognition with BSW