Algorithmic Efficiency in Convex Hull Computation: Insights from 2D and 3D Implementations
Abstract
:1. Introduction
2. Two-Dimensional Convex Hull
2.1. Two-Dimensional Convex Hull Algorithm
2.1.1. Jarvis’s March Algorithm
Algorithm 1 Jarvis’s March Algorithm. |
Input: A set of n points in the plane, Output: The convex hull H, a sequence of points ordered counterclockwise Initialize an empty list H to store the convex hull points Find the leftmost point . Set while do Add to H Set for each point do if and p is more counterclockwise than with respect to then Set end if end for Set end while Return H |
2.1.2. Graham Scan Algorithm
Algorithm 2 Graham Scan Algorithm. |
Input: A set of n points in the plane, Output: The convex hull H, a sequence of points ordered counterclockwise Find the point with the smallest y-coordinate in P Sort the remaining points in increasing order of the angle with respect to Initialize an empty stack S to store the points on the convex hull for each point , starting from the sorted list do While the size of S is greater than 1 and the turn from the second-to-last point in S to the last point in S and p is a right turn pop the last point from S Push p onto the stack S end for Return the points in S, which represent the convex hull H |
2.1.3. Divide and Conquer Algorithm
Algorithm 3 Divide and Conquer Algorithm. |
Input: A set of n points in the plane, Output: The convex hull H, a sequence of points ordered counterclockwise Sort the points in P based on their x-coordinates Divide: Split the sorted points into two halves: and Conquer: Recursively compute the upper hull of and Merge the upper hulls from and into one upper hull Recursively compute the lower hull of and Merge the lower hulls from and into one lower hull Return the merged upper and lower hulls as the convex hull H |
2.1.4. Chan’s Algorithm
Algorithm 4 Chan’s Algorithm. |
Input: A set of n points in the plane, Output: The convex hull H, a sequence of points ordered counterclockwise Divide the set P into subsets, each containing h points For each subset, calculate the convex hull using Graham’s Scan in time Merge the mini-hulls using Jarvis’s March algorithm Return H |
2.1.5. QuickHull Algorithm
Algorithm 5 QuickHull Algorithm. |
Input: A set of n points in the plane, Output: The convex hull H, a sequence of points ordered counterclockwise Find the two points with the smallest and largest x-coordinates, and Draw a line segment between and Divide the remaining points into two subsets: points to the left and points to the right of the line segment for each subset do Find the point that is furthest from the line segment Form a triangle with Recursively find the points that are furthest from the sides of the triangle and discard points inside the triangle end for Return H s |
2.1.6. Kirkpatrick–Seidel
- First, the set of points is divided into two halves based on the middle value of the x coordinate.
- Then, the tangent of the upper convex hull between the two sets is found.
- Points below the tangent line are ignored.
- The process is repeated recursively for both the upper and lower convex hulls.
Algorithm 6 Kirkpatrick–Seidel Algorithm. |
Input: A set of n points in the plane, Output: The convex hull H, a sequence of points ordered counterclockwise Divide the set P into two halves based on the middle value of the x-coordinate Find the tangent of the upper convex hull between both sets Ignore all points below the tangent line found in the previous step Recursively apply the algorithm to the upper and lower sets Return H |
Algorithm 7 Upper Convex Hull Tangent Process. |
Input: A set of n points in the plane, Output: The upper convex hull tangent for the set of points Randomly match the points in pairs. If only one point remains, leave it alone. Find the median of the slopes of the pairs. Find the upper supporting point for the median slope. If the upper supporting point is to the left of the baseline, remove all pairs to the right with a slope greater than the median. If the upper supporting point is to the right of the baseline, remove all pairs to the left with a slope smaller than the median. Repeat steps 1 to 4 until only two points remain. |
2.1.7. TORCH Algorithm
Algorithm 8 TORCH Algorithm |
Input: A set of n points in the plane, Output: The convex hull H, a sequence of points ordered counterclockwise Align all points based on the x-axis Find the rightmost point and the leftmost point Find the lowest point and the highest point Construct four lateral hulls between the turning points For each lateral hull, draw edges connecting points along the y-axis from the leftmost to the uppermost point Construct an approximate convex hull by merging the four lateral hulls Convert the approximate convex hull into a convex hull using the Jarvis’s March algorithm Return H |
2.2. Analysis of 2D Convex Hull
2.2.1. Environment
2.2.2. Result
- 1.
- As the number of points increases, the calculation time increases.
- 2.
- Each algorithm will have significant differences depending on the scattered shape of the given points.
- A.
- The number of dots increases from 1000 to 10,000 in increments of 1000.
- B.
- The following five types of point distribution are applied and we calculate the convex hull in each case. The time is measured.
- (a)
- In the case of the Disc, Square, and Though, most of the points are placed on the inner white plane, and some of the points form a convex hull.
- (b)
- In Circle, the points are placed only on the edges of the Circle, so most of the points form a convex hull. In contrast, in the Star, most of the points are placed on the inner white plane as follows, and the points are placed on the five most protruding vertices of the Star. Only five points are used to create the convex hull.
3. Three-Dimensional Convex Hull Algorithms
3.1. Jarvis’s March (Gift Wrapping) Algorithm
Algorithm 9 Jarvis’s March Algorithm (3D Version). |
Input: A set of n points in 3D space Output: The convex hull H, a set of faces that form the convex polyhedron Step 1: Find the point p with the smallest z-coordinate (the bottom point) Step 2: Find the point q that makes the largest angle with the z-axis from p Step 3: Initialize the search queue while Q is not empty do Randomly select an edge from Q Determine the two outermost points v and w relative to edge if Faces and are not already added to the convex hull then Add faces and to H end if Add the edges , , , and to the search queue Q end while Return H |
3.2. Divide and Conquer Algorithm
Algorithm 10 Three-Dimensional Divide and Conquer Algorithm for Convex Hulls. |
Input: A set of n points in 3D space Output: The convex hull of the set of points Step 1: Find the median value for one axis coordinate Step 2: Divide the points into two sets based on the median value Step 3: Recursively apply the algorithm to each of the two sets Step 4: Combine the two convex hulls obtained in step 3 |
Algorithm 11 Combining Two Convex Hulls in 3D. |
Input: Two convex hulls and from two subsets of points Output: The combined convex hull Step 1: Find the first edge of the tube by finding the tangent of the 2D projection of both convex hulls Step 2: Repeat the following process until the first edge is reached again: Find the next edge of the tube from the neighbors of both endpoints of the current edge Connect the outermost point among the neighbors to the corresponding point in the opposite convex hull Step 3: Discard all the surfaces inside the tube and combine the tube with the remaining surfaces to form the final convex hull |
3.3. QuickHull Algorithm
Algorithm 12 Three-Dimensional QuickHull Algorithm. |
Input: A set of n points in 3D space Output: The convex hull of the set of points Step 1: Select three points on the convex hull to form a plane Step 2: Find the point that is furthest from the plane Step 3: Connect the selected point and the plane Step 4: Recursively repeat steps 2–4 for the new faces formed |
Algorithm 13 Connecting Points and Planes in 3D QuickHull. |
Input: A face F, a set of points, and the current convex hull Output: Updated convex hull with new faces Step 1: Place the current face in the navigation queue Step 2: While the queue is not empty, repeat: Pop face F from the queue For all unvisited neighbors of F, do: Compute the dot product of the outer normal vector of F and the perpendicular vector drawn from the face If the dot product is negative and the edge is shared with F, add the face to the result set If the dot product is positive, add the neighboring face to the search queue Step 3: Add the faces from all edges in the result set to the current point and delete all visited faces (those with a positive dot product) |
3.4. Transformation Algorithm
4. Disccusion
4.1. Contribution
4.2. Scalability of the Algorithm in Large Dataset and Higher Dimensions
5. Conclusions
Author Contributions
Funding
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Knueven, B.; Ostrowski, J.; Castillo, A.; Watson, J.P. A computationally efficient algorithm for computing convex hull prices. Comput. Ind. Eng. 2022, 163, 107806. [Google Scholar] [CrossRef]
- Seidel, R. Convex hull computations. In Handbook of Discrete and Computational Geometry; Chapman and Hall/CRC: Boca Raton, FL, USA, 2017; pp. 687–703. [Google Scholar]
- Kenwright, B. Convex Hulls: Surface Mapping onto a Sphere. arXiv 2023, arXiv:2304.04079. [Google Scholar]
- Rossignol, H.; Minotakis, M.; Cobelli, M.; Sanvito, S. Machine-learning-assisted construction of ternary convex hull diagrams. J. Chem. Inf. Model. 2024, 64, 1828–1840. [Google Scholar] [CrossRef] [PubMed]
- DeFord, D.; Dhamankar, N.; Duchin, M.; Gupta, V.; McPike, M.; Schoenbach, G.; Sim, K.W. Implementing partisan symmetry: Problems and paradoxes. Political Anal. 2023, 31, 305–324. [Google Scholar] [CrossRef]
- Meyer, J.J.; Mularski, M.; Gil-Fuster, E.; Mele, A.A.; Arzani, F.; Wilms, A.; Eisert, J. Exploiting symmetry in variational quantum machine learning. PRX Quantum 2023, 4, 010328. [Google Scholar] [CrossRef]
- Izsák, R.; Ivanov, A.V.; Blunt, N.S.; Holzmann, N.; Neese, F. Measuring electron correlation: The impact of symmetry and orbital transformations. J. Chem. Theory Comput. 2023, 19, 2703–2720. [Google Scholar] [CrossRef] [PubMed]
- Fabrizio, J. How to compute the convex hull of a binary shape? A real-time algorithm to compute the convex hull of a binary shape. J. Real-Time Image Process. 2023, 20, 106. [Google Scholar] [CrossRef]
- Guan, Y.; Yan, W.; Li, Y. Convex Hull Collaborative Representation Learning on Grassmann Manifold with Norm Regularization. In Proceedings of the Chinese Conference on Pattern Recognition and Computer Vision (PRCV), Xiamen, China, 13–15 October 2023; pp. 453–465. [Google Scholar]
- Ansar, H.; Al Mudawi, N.; Alotaibi, S.S.; Alazeb, A.; Alabdullah, B.I.; Alonazi, M.; Park, J. Hand gesture recognition for characters understanding using convex Hull landmarks and geometric features. IEEE Access 2023, 11, 82065–82078. [Google Scholar] [CrossRef]
- Huang, Z.; Wu, Z.; Yan, H. A convex-hull based method with manifold projections for detecting cell protrusions. Comput. Biol. Med. 2024, 173, 108350. [Google Scholar] [CrossRef] [PubMed]
- Du, N.; Xie, L.; Zhou, M.; Gao, W.; Wang, Y.; Hu, J. Convex Hull Triangle Mesh-Based Static Mapping in Highly Dynamic Environments. IEEE Trans. Instrum. Meas. 2024, 73, 8500814. [Google Scholar] [CrossRef]
- Wibowo, A.; Santoso, H.B.; Rachmat, C.A.; Delima, R. Mapping and grouping of farm land with Graham scan algorithm on convex hull method. In Proceedings of the 2019 International Conference on Sustainable Engineering and Creative Computing (ICSECC), Bandung, Indonesia, 20–22 August 2019; pp. 121–126. [Google Scholar]
- Zhou, T.; Bilmes, J.A.; Guestrin, C. Divide-and-conquer learning by anchoring a conical hull. Adv. Neural Inf. Process. Syst. 2014, 27, 1242–1250. [Google Scholar]
- Barber, C.B.; Dobkin, D.P.; Huhdanpaa, H. The quickhull algorithm for convex hulls. ACM Trans. Math. Softw. (TOMS) 1996, 22, 469–483. [Google Scholar] [CrossRef]
- Gomes, A.J. A total order heuristic-based convex hull algorithm for points in the plane. Comput.-Aided Des. 2016, 70, 153–160. [Google Scholar] [CrossRef]
- Kumar, V.; Mahima; Verma, S.; Nijhawan, N. Convex Hull: Applications and Dynamic Convex Hull. In Ambient Communications and Computer Systems: Proceedings of RACCCS 2021; Springer: Cham, Switzerland, 2022; pp. 371–381. [Google Scholar]
- Chan, T.M. Optimal output-sensitive convex hull algorithms in two and three dimensions. Discret. Comput. Geom. 1996, 16, 361–368. [Google Scholar] [CrossRef]
- An, P.T.; Hoang, N.D.; Linh, N.K. An efficient improvement of gift wrapping algorithm for computing the convex hull of a finite set of points in Rn. Numer. Algorithms 2020, 85, 1499–1518. [Google Scholar] [CrossRef]
- Day, A. Parallel implementation of 3D convex-hull algorithm. Comput.-Aided Des. 1991, 23, 177–188. [Google Scholar] [CrossRef]
- Zhao, J.; Jiao, L.; Liu, F.; Fernandes, V.B.; Yevseyeva, I.; Xia, S.; Emmerich, M.T. 3D fast convex-hull-based evolutionary multiobjective optimization algorithm. Appl. Soft Comput. 2018, 67, 322–336. [Google Scholar] [CrossRef]
- Sinclair, D. A 3D Sweep Hull Algorithm for computing Convex Hulls and Delaunay Triangulation. arXiv 2016, arXiv:1602.04707. [Google Scholar]
- Blelloch, G.E.; Gu, Y.; Shun, J.; Sun, Y. Randomized incremental convex hull is highly parallel. In Proceedings of the 32nd ACM Symposium on Parallelism in Algorithms and Architectures, Virtual, 15–17 July 2020; pp. 103–115. [Google Scholar]
- Stein, A.; Geva, E.; El-Sana, J. CudaHull: Fast parallel 3D convex hull on the GPU. Comput. Graph. 2012, 36, 265–271. [Google Scholar] [CrossRef]
- Amato, N.M.; Preparata, F.P. The parallel 3D convex hull problem revisited. Int. J. Comput. Geom. Appl. 1992, 2, 163–173. [Google Scholar] [CrossRef]
- Mei, G. CudaChain: A Practical GPU-accelerated 2D Convex Hull Algorithm. arXiv 2015, arXiv:1508.05488. [Google Scholar]
- Alshamrani, R.; Alshehri, F.; Kurdi, H. A preprocessing technique for fast convex hull computation. Procedia Comput. Sci. 2020, 170, 317–324. [Google Scholar] [CrossRef]
- Xu, J.; Zheng, Z.; Feng, Y.; Qing, X. A concave hull algorithm for scattered data and its applications. In Proceedings of the 2010 3rd International Congress on Image and Signal Processing, Yantai, China, 16–18 October 2010; Volume 5, pp. 2430–2433. [Google Scholar]
- Gamby, A.N.; Katajainen, J. Convex-hull algorithms: Implementation, testing, and experimentation. Algorithms 2018, 11, 195. [Google Scholar] [CrossRef]
- Alshehri, F.A.; Alshamrani, R. A Filtering Method for Fast Convex Hull Construction. J. Ubiquitous Syst. Pervasive Netw. 2011, 3, 7. [Google Scholar]
- Jarvis, D.; Griffiths, P.D. Clinical applications of 3D volume MR imaging of the fetal brain in utero. Prenat. Diagn. 2017, 37, 556–565. [Google Scholar] [CrossRef]
- Srikanth, D.; Kothapalli, K.; Govindarajulu, R.; Narayanan, P. Parallelizing two dimensional convex hull on NVIDIA GPU and Cell BE. In Proceedings of the International Conference on High Performance Computing (HiPC), Kochi, India, 16–19 December 2009; pp. 1–5. [Google Scholar]
- Srungarapu, S.; Reddy, D.P.; Kothapalli, K.; Narayanan, P. Fast two dimensional convex hull on the GPU. In Proceedings of the 2011 IEEE Workshops of International Conference on Advanced Information Networking and Applications, Biopolis, Singapore, 22–25 March 2011; pp. 7–12. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Kwon, H.; Oh, S.; Baek, J.-W. Algorithmic Efficiency in Convex Hull Computation: Insights from 2D and 3D Implementations. Symmetry 2024, 16, 1590. https://doi.org/10.3390/sym16121590
Kwon H, Oh S, Baek J-W. Algorithmic Efficiency in Convex Hull Computation: Insights from 2D and 3D Implementations. Symmetry. 2024; 16(12):1590. https://doi.org/10.3390/sym16121590
Chicago/Turabian StyleKwon, Hyun, Sehong Oh, and Jang-Woon Baek. 2024. "Algorithmic Efficiency in Convex Hull Computation: Insights from 2D and 3D Implementations" Symmetry 16, no. 12: 1590. https://doi.org/10.3390/sym16121590
APA StyleKwon, H., Oh, S., & Baek, J.-W. (2024). Algorithmic Efficiency in Convex Hull Computation: Insights from 2D and 3D Implementations. Symmetry, 16(12), 1590. https://doi.org/10.3390/sym16121590