Abstract

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. 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. The whole plane is divided into different regions. The points that are not on the convex hull are deleted, and the redundant points are removed. This can speed up the calculation of approximate convex hull boundary and shorten the time of convex hull calculation. The proposed algorithm is used for buoy drifting area demarcating. The 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. The 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. The drift area of the port hand buoys is similar. The drift area of the port hand buoy is greater than that of the port hand buoy.

1. 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 [14]. 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 [57]. The 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 R2 [10]. Preprocess the input set, filter all points in the eight vertex polygon in O (n) time, and return a simplified candidate point set. These 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.

The 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.(2)Select the maximal horizontal ordinate point Qn and the minimal horizontal ordinate point Qs point. Select the maximal longitudinal coordinate point Qe and minimal longitudinal coordinate point . Connect these points and obtain lines. The whole plane is divided into different regions. The points that are not on the convex hull are deleted, and the redundant points are removed. This can speed up the calculation of approximate convex hull boundary and shorten the time of convex hull calculation.(3)The proposed algorithm is used for buoy drifting area demarcating. The 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.

2.1. Frequency Calculation of Buoy Position

The 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. Therefore, 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%. The proportion of each buoy positions points ranked from high to low is P0, P1, …, Pm−1. m is the number buoy in set X. Ni is the number of points at position Xi. 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:

The 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 Pi, 0≤i < m.Step 3: rank the proportion of each buoy positions points from high to low as P0, P1, …, Pm−1. Initialize a stack. Set k = 0.Step 4: push Pk into the stack.Step 5: if the total frequency of points in the stack is less than 80%, that is, P0 + P1+…+Pk <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.

2.2. 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. The convex hull is solved based on Graham Scan algorithm as follows:Step 1: the point p0 with the smallest longitudinal coordinates is first pushed into a stack.Step 2: calculate the intersection angle of each point relative to p0.Step 3: sort the points from small to large according to their intersection angles relative to p0. When the intersection angles are the same, those closer to p0 are arranged in front. The points after sorting are, namely, p1, p2, …, pn-1.Step 4: push p1 into the stack.Step 5: suppose the top point in the stack is pi, and the second point in the stack is pi−1. For the first remaining points pj (1 < j < n), link the line pi−1pj and line pipj.Step 6: if from this line pi−1pj to line pipj is clockwise, pop pi from the stack and push pj into the stack. If from this line pi−1pj to line pipj is counterclockwise, push pj into the stack.Step 7: if pj is not the last remaining point, go to Step 5. Otherwise, output the points in the stack as vertexes of the convex hull.

3. Main Results

3.1. 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.

The cross multiplication of vector a and b iswhere 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.

Thirdly, 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 Qn and the minimal horizontal ordinate Qs point. Select the maximal longitudinal coordinate point Qe and minimal longitudinal coordinate point .Step 2: connect these points and obtain line QnQe, QeQs, QsQw, and QwQn, and divide the scattered point set into several regions by the lines. There are 5 cases.Case 1: The whole plane is divided into 5 regions, as shown in Figure 2.Case 2: The whole plane is divided into 4 regions, as shown in Figure 3.Case 3: The whole plane is divided into 3 regions, as shown in Figure 4.Case 4: The whole plane is divided into 2 regions, as shown in Figure 5.Case 5: The 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 4: sort the points in the point set according to the abscissa of the vertex. If the abscissa values of two points in the upper part are the same, the points with relatively large ordinate values are selected and retained, while the points with relatively small ordinate values are deleted. Similarly, the points in the lower part of the point set are sorted according to the abscissa. If there are two points with the same abscissa value, the vertex with relatively small ordinate value is selected and the vertex with relatively large ordinate value is deleted.

3.2. Time Complexity

The time complexity of preprocessing is O (n). The 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. The complexity is O (nlog n). Therefore, it takes at least o (nlog n) time to solve the convex hull problem of n vertices in the plane.

4. Experiment and Analysis

4.1. Dataset

This 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.

4.2. Convex Hull Computing Results

Figure 7 shows the convex hull results of the buoys. The triangle represents the position of the sinker. The hexagon represents the geometric center of the actual drift position.

4.3. Analysis and Discussion
4.3.1. Time Cost of Different Algorithms

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

The 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. The inverse trigonometric function is replaced by cross multiplication.

4.3.2. 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.

The 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. There 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.(3)The offset distance between the geometric center of some buoys’ high-frequency position points and the sinking stone is small. For example, the offset of 4# buoy is only 3.90 m, and the offset of 10# buoy is about 5.48 m. This shows that the sinking stone of these buoys is basically not displaced, and the anchorage point is also basically not displaced. The buoy basically moves around the location of the sinking stone under the action of external force.

The average deviation direction of the 4–14 buoy in the waters of the foreign navigation section is about 230.11°. Therefore, in the outer leg, the direction of the geometric center of the buoy offset high-frequency position point relative to the buoy is basically perpendicular to the main channel strike offset.

4.3.3. 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. Those marking the 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. The drift area of the port hand buoys are similar. The drift area of the port hand buoy is greater than that of the port hand buoy.

4.3.4. 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.

The tether length of the buoy in the channel is generally three long and one short. The 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. Therefore, its offset will not affect the navigation safety of ships in the channel.

5. Conclusion

To improve the prediction calculation of buoy trajectory, an improved Graham scan convex hull algorithm is used. 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. The 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. The drift area of the port hand buoys are similar. The drift area of the port hand buoy is greater than that of the port hand buoy.

The future work will continue to improve the convex hull region shrinkage algorithm and the sample selection decision algorithm. The 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

The authors declare that they have no conflicts of interest to this work.

Acknowledgments

The work was supported by the Natural Science Foundation of Fujian Province (2021J01819) and National fund cultivation program of Jimei University (ZP2020005).