An Efficient Convex Hull Algorithm for a Planer Set of Points

602 views

Published on

Published in: Data & Analytics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
602
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

An Efficient Convex Hull Algorithm for a Planer Set of Points

  1. 1. An Efficient Convex Hull Algorithm for a Planer Set of Points Kasun Ranga Wijeweera (krw198708298@gmail.com)
  2. 2. This Presentation is Based on Following Research Paper K. R. Wijeweera, U. A. J. Pinidiyaarachchi (2013), An Efficient Convex Hull Algorithm for a Planer Set of Points, Ceylon Journal of Science (Physical Sciences), Volume 17, pp. 9-17.
  3. 3. Definitions (Convex Set) • A set S is convex if x in S and y in S implies that the segment xy is a subset of S • Example in 2D:
  4. 4. Definitions (Convex Hull of a Set of Points) • The convex hull of a set S of points is the smallest convex set containing all the points in S • Example in 2D:
  5. 5. A 2D Convex Hull Algorithm (Introduction) • This algorithm is based on gradient in coordinate geometry • Achieves parallelism • Achieves data reduction • Manages coincident points • Deals with collinear points • Outputs hull points in boundary traversal order • Low computational cost
  6. 6. A 2D Convex Hull Algorithm (Inputs and Outputs) • Input: A non-empty set of points S = {P1, P2, . . . , Pn} • Output: A non-empty set that contains all the points of the convex hull of S H = {Q1, Q2, . . . , Qm}
  7. 7. A 2D Convex Hull Algorithm (Example Data Set) x y
  8. 8. A 2D Convex Hull Algorithm (Step 1) Calculate following values from the set S minx // minimum value of x-coordinates y_minx // y-coordinate corresponding to minx maxx // maximum value of x-coordinates y_maxx // y-coordinate corresponding to maxx miny // minimum value of y-coordinates x_miny // x-coordinate corresponding to miny maxy // maximum value of y-coordinates x_maxy // x-coordinate corresponding to maxy
  9. 9. A 2D Convex Hull Algorithm (Basic Four Points on the Convex Hull) (x_maxy, maxy) (minx, y_minx) (maxx, y_maxx) (x_miny, miny)
  10. 10. A 2D Convex Hull Algorithm (Step 2) Define following subsets of S A = { ( x, y) in S | ( x <= x_maxy ) AND ( y >= y_minx )} B = { ( x, y) in S | ( x >= x_maxy ) AND ( y >= y_maxx )} C = { ( x, y) in S | ( x >= x_miny ) AND ( y <= y_maxx )} D = { ( x, y) in S | ( x <= x_miny ) AND ( y <= y_minx )}
  11. 11. A 2D Convex Hull Algorithm (Partitioning the Data Set into Four Regions) A B CD
  12. 12. A 2D Convex Hull Algorithm (Step 3) • Find the convex hull parts belong to each of the sets A, B, C, and D in parallel • Merge those hull parts to derive the set H
  13. 13. A 2D Convex Hull Algorithm (After Processing and Merging Hull Parts) A B CD
  14. 14. A 2D Convex Hull Algorithm (Processing Each Set: Gradient) x y M (mx, my) N (nx, ny) m = ( ny – my ) / ( nx – mx )
  15. 15. A 2D Convex Hull Algorithm (Processing Each Set: Modified Gradient) A B CD
  16. 16. A 2D Convex Hull Algorithm (Processing Each Set: Modified Gradient) Region Diagram Modified Gradient Begin Point End Point A ( ay[i] – hully ) / ( ax[i] – hullx ) x = minx y = y_minx x = x_maxy y = maxy B ( bx[i] – hullx ) / (hully - by[i] ) x = x_maxy y = maxy x = maxx y = y_maxx C ( hully - cy[i] ) / ( hullx - cx[i] ) x = maxx y = y_maxx x = x_miny y = miny D ( hullx – dx[i] ) / ( dy[i] – hully ) x = x_miny y = miny x = minx y =y_minx
  17. 17. A 2D Convex Hull Algorithm (Processing Set A: General Case)
  18. 18. A 2D Convex Hull Algorithm (Processing Set A: General Case)
  19. 19. A 2D Convex Hull Algorithm (Processing Set A: General Case)
  20. 20. A 2D Convex Hull Algorithm (Processing Set A: General Case)
  21. 21. A 2D Convex Hull Algorithm (Processing Set A: General Case)
  22. 22. A 2D Convex Hull Algorithm (Processing Set A: Collinear Case)
  23. 23. A 2D Convex Hull Algorithm (Processing Set A: Indeterminate Case)
  24. 24. A 2D Convex Hull Algorithm (Processing Sets B, C, and D) • Using similar method B, C, and D sets can also be processed • Using the same algorithm used for A to process B, C, and D needs additional computational cost • Therefore four separate algorithms are used to process each of four sets with modified gradient
  25. 25. A 2D Convex Hull Algorithm (Interior Points Algorithm) Based on the following Lemma A point is non-extreme if and only if it is inside some (closed) triangle whose vertices are points of the set and is not itself a corner of that triangle
  26. 26. A 2D Convex Hull Algorithm (Interior Points Algorithm) Algorithm: INTERIOR POINTS for each i do for each j != i do for each k != i != j do for each l != k != i != j do if p(l) in Triangle{ p(i), p(j), p(k) } then p(l) is non-extreme
  27. 27. A 2D Convex Hull Algorithm (Proposed Algorithm vs. Interior Points Algorithm) • Both of the algorithms were implemented using C++ programming language • Following hardware and software resources were used – Computer: Intel(R) Pentium(R) Dual CPU; E2180 @ 2.00 GHz; 2.00 GHz, 0.98 GB of RAM; – IDE: Turbo C++; Version 3.0; Copyright(c) 1990, 1992 by Borland International, Inc;
  28. 28. A 2D Convex Hull Algorithm (Proposed Algorithm vs. Interior Points Algorithm) • First, n number of random points were generated in the range 0 – 399 using randomize() function and written them to a text file • Such text files were generated for different n • Number of clock cycles taken to process each data file k times was counted using clock() function
  29. 29. A 2D Convex Hull Algorithm (Proposed Algorithm vs. Interior Points Algorithm) Case Proposed Algorithm (1000) Interior Points Algorithm (1000) Average Ratio (IPA : PA) n = 10; k = 32000; 5.53 37.11 6.71 n = 20; k = 1000; 10.60 693.80 65.45 n = 30; k = 500; 15.20 3881.6 255.36 n = 40; k = 100; 17.00 12769.00 751.11 n = 50; k = 50; 24.00 32554.00 1356.41
  30. 30. A 2D Convex Hull Algorithm (Proposed Algorithm vs. Interior Points Algorithm) 0 5000 10000 15000 20000 25000 30000 35000 Case 1 Case 2 Case 3 Case 4 Case 5 A(1000) B(1000)
  31. 31. A 2D Convex Hull Algorithm (Drawbacks of the Proposed Algorithm) • It cannot be easily extended to higher dimensions • The notion of gradient causes the problem • Need to solve partial differential equations in order to derive the gradient • Because of this higher dimensional extension is not cost effective • The entire data set is needed from the beginning – The algorithm is static
  32. 32. Any Questions?
  33. 33. Thank You!

×