Cross Product and Partitioned Filtering-Based Graham Convex Hull for Buoy Drifting Area Demarcating

An improved Graham scan convex hull algorithm is designed using the convex hull region shrinkage algorithm and the sample selection decision algorithm. In the sorting of Graham scan convex hull algorithm, the cross-multiplicationmethod is used instead of the operation of finding the polar angle, which avoids the high computational complexity of finding the inverse trigonometric function. When the polar angles are the same, that is, the two points are collinear, the points close to each other are deleted directly. Select the maximal horizontal ordinate point, minimal horizontal ordinate point, maximal longitudinal coordinate point, and minimal longitudinal coordinate point. Connect these points and obtain lines. )e whole plane is divided into different regions. )e points that are not on the convex hull are deleted, and the redundant points are removed. )is can speed up the calculation of approximate convex hull boundary and shorten the time of convex hull calculation.)e proposed algorithm is used for buoy drifting area demarcating.)e offsets of the geometric center of the high-frequency position point and the distance from geometric center of high-frequency position of buoy to sinking stone are calculated. )e experimental results show that the new algorithm can effectively accelerate the convex hull calculation. We use the convex hull process to compute the area of the drifting buoy position and discover that the drift area of the port hand buoy is similar. )e drift area of the port hand buoys is similar. )e drift area of the port hand buoy is greater than that of the port hand buoy.


Introduction
A buoy is a kind of artificial mark used to mark warning and channel boundary, which can guide ships to navigate, locate, and avoid obstacles [1][2][3][4]. However, navigation aids installed on the sea are easy to drift due to wind and waves. Navigation aids floating in the channel are easy to cause navigation errors and security threats to ships. In order to analyze the drift characteristics of buoys and accurately warn the real-time position of buoys, pretreatment algorithm can be used.
Convex hull is used to calculate the range of buoys [5][6][7]. e idea of Graham's scanning is to find a point on the convex hull first and then start from that point to find the points on the convex hull one by one in a counterclockwise direction. In fact, it is to sort the polar angles and then use them to query. A modified Graham's convex hull algorithm is proposed for finding the connected orthogonal convex hull of a finite planar point set [8]. Nguyen designed a faster convex hull algorithm for disks [9]. Ferrada discussed a filtering technique for fast convex hull construction in R 2 [10]. Preprocess the input set, filter all points in the eight vertex polygon in O (n) time, and return a simplified candidate point set. ese candidate points are sequentially distributed in four priority queues. Aman et al. used a linear time combinatorial algorithm to compute the relative orthogonal convex hull of digital objects [11]. Wu et al. designed an improved Graham algorithm for determining the convex hull of planar points' set [12].
However, Graham's scanning algorithm still costs great time when dealing with big data. In this paper, an improved Graham scan convex hull algorithm is proposed to speed up the calculation process. e novelty and the contributions of the paper are (1) An improved Graham scan convex hull algorithm is designed using the convex hull region shrinkage algorithm and the sample selection decision algorithm. In the sorting of Graham scan convex hull algorithm, the cross-multiplication method is used instead of the operation of finding the polar angle, which avoids the high computational complexity of finding the inverse trigonometric function. When the polar angles are the same, that is, the two points are collinear, the points close to each other are deleted directly.

Frequency Calculation of Buoy
Position. e buoy moves irregularly around the anchorage under the action of external force. In the process of movement, the frequency of passing through different positions is different. For example, at the edge of the sea area, the frequency of buoy floating here is obviously smaller than that at the center of the active water area. erefore, by calculating the frequency of the buoy at different positions, we can find the characteristics of the shift of the buoy in the water area relative to the sinking stone. Generally speaking, in the buoy sea area, the frequency of reaching the sea area is less, and the position of the buoy reaching the edge waters is more divergent.
Suppose there exists a minimum set, and the sum of the frequency of all these buoy position points set X is not less than 80%. e proportion of each buoy positions points ranked from high to low is P 0 , P 1 , . . ., P m−1 . m is the number buoy in set X. N i is the number of points at position X i . N is the total number of position points: In each buoy position dataset, the point set with the first 80% occurrence times is taken out. Denote S as the minimum set whose frequency is more than 80% of total frequency. c is the number buoys in set S: P 0 + P 1 + · · · P n−1 > � 80%, P 0 + P 1 + · · · P c < 80%.
(2) e method of obtaining dataset S with no less than 80% position data points in the buoy position dataset X is as follows: Step 1: delete the abnormal points whose distance from the rock sinking position exceeds the length of the anchor chain.
Step 2: calculate the proportion of each buoy positions points P i , 0≤i < m.
Step 3: rank the proportion of each buoy positions points from high to low as P 0 , P 1 , . . ., P m−1 . Initialize a stack. Set k � 0.
Step 4: push P k into the stack.
Step 5: if the total frequency of points in the stack is less than 80%, that is, P 0 + P 1 +. . .+P k <80%, set k � k + 1 and go to Step 4.
Step 6: output the final result set, that is, the points in the stack.
Taking the 3 # and 4# buoy as examples, the frequency distribution of each position point is shown in Figure 1. Figure 1(a) shows the position number distribution of 3# buoy. Figure 1(b) shows the frequency distribution of 3# buoy. Figure 1(c) shows the position number distribution of 4# buoy. Figure 1(d) shows the frequency distribution of 4# buoy.

Basic Convex Hull Algorithm.
With the buoy position dataset, the convex hull algorithm is used to obtain the drifting area. Convex hull is a concept in computational geometry. Denote n as the number of points in the buoy position set S. e convex hull is solved based on Graham Scan algorithm as follows: Step 1: the point p 0 with the smallest longitudinal coordinates is first pushed into a stack.
Step 2: calculate the intersection angle of each point relative to p 0.
Step 3: sort the points from small to large according to their intersection angles relative to p 0 . When the intersection angles are the same, those closer to p 0 are arranged in front. e points after sorting are, namely, p 1 , p 2 , . . ., p n-1 .
Step 4: push p 1 into the stack.
Step 5: suppose the top point in the stack is p i , and the second point in the stack is p i−1 . For the first remaining points p j (1 < j < n), link the line p i−1 p j and line p i p j .
Step 6: if from this line p i−1 p j to line p i p j is clockwise, pop p i from the stack and push p j into the stack. If from this line p i−1 p j to line p i p j is counterclockwise, push p j into the stack.

Scientific Programming
Step 7: if p j is not the last remaining point, go to Step 5. Otherwise, output the points in the stack as vertexes of the convex hull.

Improved Graham Scan Convex Hull Algorithm.
Firstly, in the sorting, the cross-multiplication method is used instead of the operation of finding the polar angle, which avoids the high computational complexity of finding the inverse trigonometric function. e cross multiplication of vector a and b is where θ is the angle between the two vectors. When the cross product is larger than zero, the angle for a to b is in a counterclockwise direction. When the cross product is smaller than zero, the angle for a to b is in a clockwise direction. Secondly, when the polar angles are the same, that is, the two points are collinear, the points close to each other are deleted directly.
irdly, due to the large amount of buoy data, in order to save the time of big data processing, we need to improve the algorithm to improve the efficiency of convex hull algorithm. In this algorithm, the points that are not on the convex hull are deleted, and the redundant points are removed. At the same time, the points on the boundary of the convex polygon are sorted and ordered. It can speed up the calculation of approximate convex hull boundary in many situations and shorten the time of convex hull calculation.
Step 1: select the maximal horizontal ordinate point Q n and the minimal horizontal ordinate Q s point. Select the maximal longitudinal coordinate point Q e and minimal longitudinal coordinate point Q w .
Step 2: connect these points and obtain line Q n Q e , Q e Q s , Q s Q w , and Q w Q n , and divide the scattered point set into several regions by the lines. ere are 5 cases.
Case 1: e whole plane is divided into 5 regions, as shown in Figure 2. Case 2: e whole plane is divided into 4 regions, as shown in Figure 3. Case 3: e whole plane is divided into 3 regions, as shown in Figure 4. Case 4: e whole plane is divided into 2 regions, as shown in Figure 5. Case 5: e whole plane is divided into 1 regions, as shown in Figure 6.
Step 3: the points in the polygon surrounded by these four vertices are deleted. Step

Time Complexity.
e time complexity of preprocessing is O (n). e Graham method is carried out on the premise of sorting the vertices, but compared with other convex hull generation methods, this algorithm shows smaller time complexity according to different vertex distributions. e complexity is O (nlog n). erefore, it takes at least o (nlog n) time to solve the convex hull problem of n vertices in the plane.

Dataset.
is section calculates the frequency of the buoy of the main channel in Tianjin port at different locations and calculates the central coordinates of the geometry of the data points containing not less than 80% of the position data points in the dataset of each lamp buoy location. Table 1 shows the geometric center of buoy position. Table 2 lists buoy #5 position records. Figure 7 shows the convex hull results of the buoys. e triangle represents the position of the sinker. e hexagon represents the geometric center of the actual drift position.

Time Cost of Different
Algorithms. e algorithm is tested on a computer with Intel (R) Core(TM) i7-260 QM, CPU @2.20 GHz, 8.00 GB memory, 64 bits operation system. Table 3 shows the calculation time cost of different points' number scale in seconds. Figure 8 shows time cost of different algorithms. e experiment shows that the new algorithm speeds up the buoy convex hull calculation. Most vertices that are not on the convex hull are deleted, which reduces the calculation scale. e inverse trigonometric function is replaced by cross multiplication.

Distance from Geometric Center of High-Frequency
Position of Buoy to Sinking Stone. Table 4 shows the distance between the realistic center of each buoy offset from the high-frequency position point and the corresponding sinking stone. e geometric center of each buoy in the channel deviates from the high-frequency position point, and the maximum distance is about 26.83 m, and the minimum distance is about 3.90 m. ere are many reasons for the offset distance: (1) Some of the far offset buoys may be due to the offset of the anchorage. If the buoy is thrown for a long time, part of the anchor chain may be undercover for a long time, making the buoy move around a chain link of the anchor chain (2) For some far offset buoys, it is also possible that the buoy is affected by the regular wind and current, which makes the offset position of the buoy prefer to a certain water area. In this case, the offset position of the buoy covers the position of the sinking stone, but the frequency of the buoy "staying" is low near the sinking stone.

Area of Buoy Drifting Convex Hull.
We use the convex hull process to compute the area of the drifting buoy position. Table 5 shows the area of buoy drifting convex hull.
According to the customary trend of buoys, those marking the left boundary of the channel are called port hand buoy, such as buoy #4, #10, and #14. ose marking the  Scientific Programming right boundary of the channel are called port hand buoy, such as buoy #5 and #13. From Table 5, the drift area of the port hand buoy is similar. e drift area of the port hand buoys are similar. e drift area of the port hand buoy is greater than that of the port hand buoy.

Influence of Buoy Offset on Navigation Safety.
If the displacement is too large, the buoy may enter the waterway and affect the navigation safety of the ship. According to the analysis of the offset distance and azimuth of the geometric center of the high-frequency position point of the buoy offset relative to the sinker, combined with the position of each buoy relative to the channel sideline, the influence of the buoy offset on navigation safety is analyzed. e tether length of the buoy in the channel is generally three long and one short. e water depth near the channel is about 15-22 m. If the distance of the buoy from the sinking stone is too large, it may be that the error of the buoy is too large, or the anchor point is offset or the sinking stone is displaced.
When the buoy is thrown, there may be some error, or the sinking stone moves, and the actual position of the sinking stone should be located in the southwest of the throwing position. Although the buoy has a large offset to the channel, it is less than the distance between the buoy and the side line of the channel. erefore, its offset will not affect the navigation safety of ships in the channel.

Conclusion
To improve the prediction calculation of buoy trajectory, an improved Graham scan convex hull algorithm is used. e new algorithm speeds up the buoy convex hull calculation. Most vertices that are not on the convex hull are deleted, which reduces the calculation scale. e inverse trigonometric function is replaced by cross multiplication. We use the convex hull process to compute the area of the drifting buoy position and discover that the drift area of the port hand buoy is similar. e drift area of the port hand buoys are similar. e drift area of the port hand buoy is greater than that of the port hand buoy.
e future work will continue to improve the convex hull region shrinkage algorithm and the sample selection decision algorithm. e improved algorithm is used to deal with super large-scale point sets.

Data Availability
All data, models, and code generated or used during the study appear within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest to this work.