Understanding Convex Hulls in Computational Geometry

Slide Note
Embed
Share

Convex hulls play a vital role in computational geometry, enabling shape approximation, collision avoidance in robotics, and finding smallest enclosing boxes for point sets. The convex hull problem involves computing the smallest convex polygon containing a set of points, with extreme points determining the boundaries. Extreme points cannot be expressed as convex combinations of other points in the set. By understanding and computing convex hulls efficiently, various applications in robotics, shape analysis, and line fitting can be addressed.


Uploaded on Sep 22, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Convex Hulls Chapter 1 of the text Chapter 3 of O Rourke book

  2. Convex Hulls Convex hulls are to CG what sorting is to discrete algorithms First order shape approximation CH(P) P P The shape approximated is invariant under rotation and translation Rubber band analogy Many applications in robotics, shape analysis, line fitting.

  3. Convex Hulls (applications) Collision Avoidance: Robot moving in a polygonal environment Can the robot be moved from the start position to the end position Only translation Translation and rotation Observation: If the convex hull of the robot avoids collision with obstacles, so does the robot. start end

  4. Convex Hulls (applications) Smallest Box Given a set of points, determine the smallest area rectangle (not necessarily axis-aligned) that encloses the point set. Needs to enclose the convex hull of the points One of the sides of an optimal rectangle must be aligned with a convex hull edge

  5. Convex Hulls Convex Hull Problem: Given a finite set of points S, compute its convex hull CH(S) A set is convex if every line segment connecting two points in the set is fully contained in the set Non-convex Convex

  6. Convex Hull What is a convex hull of a set of points S? Smallest area/perimeter convex set containing S Union of all points expressible by a convex combination of points in S, i.e points of the form: The definition is not suitable for an algorithm

  7. Convex Hulls Extreme Point: p is an extreme point of S if p can not be expressed as a convex combination of S {p} Or: p is an extreme point of S if p admits a line of support of S p is an extreme point q is a boundary point r is an interior point L is the line of supported admitted by p p r q L

  8. Computational Problem Given S R2 , |S| = n, find the description of CH(S) CH(S) is a convex polygon with at most n vertices Want to find these (extreme) vertices in counterclockwise order. Assume all points are distinct (otherwise sort and remove duplicates)

  9. Comparing Two Angles tj ti j i s For each edge determine the point of intersection with a unit length box Measure perimeter length L(s ti) and L(s tj) i < j if and only if L(s ti) < L(s tj)

  10. Left-Right Turn How does one test whether r is to the left or right of pq? r2 q r1 p If D < 0 Right Turn If D > 0 Left Turn If D > 0 Collinear r q r p q r q p p

  11. Better Algorithms R.A Jarvis, On the Identification of the Convex Hull of a Finite Set of Points in the Plane, Information Processing Letters, Vol. 2, pp 18-21, 1973. S.G. Akl and G.T. Toussaint, A Fast Convex Hull Algorithm, Information Processing Letters, Vol.7, No. 5, pp 219-222, 1978. R.L. Graham, An Efficient Algorithm for Determining the Convex Hull of a Finite Planar Set, Information Processing Letters, Vol. 1, pp. 132-133, 1972

  12. Efficient Convex Hull Algorithm Gift-Wrapping[Jarvis 73] [Chand and Kapur 70] 1. Start with the bottom extreme point p 2. pstart = p 3. Let L be the horizontal ray incident on p 4. Determine the point x with the smallest counterclockwise angle with L at p px is a convex hull edge 5. Set L = ray at x containing to px 6. Set p = x 7. Repeat from step 4until p = pstart x p L L x p This algorithm is also known as rope-fence method

  13. Gift-Wrapping (Left-Right Test Only) /* Let S = {p1, p2, , pn}; z(i) = point with the smallest CCW angle (p-,p,z(i)) among {p1, p2, , pi}, the first i points of the set. */ L Z(1) = p1; (assuming p1 p, p1 p-) For i = 2 to n ; (pi p and pi p) { If (p, z(i-1), pi) is a right turn) z(i) = pi; else z(i) = z(i-1) ; } p p-

  14. Gift-Wrapping (Example) p2 p6 p1 p5 p3 p4 L p p-

  15. Gift-Wrapping (Example) z1 = p1 i = 2 p2 p6 p1 z1 p5 p3 p4 L p p-

  16. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn p2 p6 p1 z1 p5 p3 p4 L p p-

  17. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 p2 z2 p6 p1 p5 p3 p4 L p p-

  18. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 (p, z(i-1), pi) => Left Turn p2 z2 p6 p1 p5 p3 p4 L p p-

  19. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 (p, z(i-1), pi) => Left Turn z3 = z2 i = 4 p2 z3 p6 p1 p5 p3 p4 L p p-

  20. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 (p, z(i-1), pi) => Left Turn z3 = z2 i = 4 (p, z(i-1), pi) => Left Turn p2 z3 p6 p1 p5 p3 p4 L p p-

  21. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 (p, z(i-1), pi) => Left Turn z3 = z2 i = 4 (p, z(i-1), pi) => Left Turn z4 = z3 i = 5 p2 z4 p6 p1 p5 p3 p4 L p p-

  22. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 (p, z(i-1), pi) => Left Turn z3 = z2 i = 4 (p, z(i-1), pi) => Left Turn z4 = z3 i = 5 (p, z(i-1), pi) => Right Turn p2 z4 p6 p1 p5 p3 p4 L p p-

  23. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 (p, z(i-1), pi) => Left Turn z3 = z2 i = 4 (p, z(i-1), pi) => Left Turn z4 = z3 i = 5 (p, z(i-1), pi) => Right Turn z5 = p5 i = 6 p2 p6 p6 p1 p1 p5 z5 p3 p4 L L p p- p-

  24. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 (p, z(i-1), pi) => Left Turn z3 = z2 i = 4 (p, z(i-1), pi) => Left Turn z4 = z3 i = 5 (p, z(i-1), pi) => Right Turn z5 = p5 i = 6 (p, z(i-1), pi) => Left Turn p2 p6 p1 p1 p5 z5 p3 p4 L L p p- p-

  25. Gift-Wrapping (Example) z1 = p1 i = 2 (p, z(i-1), pi) => Right Turn z2 = p2 i = 3 (p, z(i-1), pi) => Left Turn z3 = z2 i = 4 (p, z(i-1), pi) => Left Turn z4 = z3 i = 5 (p, z(i-1), pi) => Right Turn z5 = p5 i = 6 (p, z(i-1), pi) => Left Turn z6 = z5 p2 p6 p1 p1 p5 z6 p3 p4 L L p p- p-

  26. Gift-Wrapping (Example) p2 p6 L p1 p1 z1 p p3 p4 p- p8

  27. Complexity of Gift-Wrapping (Jarvis) Let h = number of extreme points 3 h n Complexity = O (nh) Worst Case Complexity = O(n2) h = n Best Case Complexity = O(n) h = constant Jarvis algorithm is output-sensitive; the running time is dependent on the size of the output.

  28. Grahams Algorithm In Jarvis algorithm all points are treated equally. Here we eliminate a point if it is found to be inside Algorithm: Sort S by y-coordinates; p1, p2, , pn Initialize : Push(p1), Push(p2) For i = 3 to n do While( (next, top, pi) is a right turn) Pop() Push(pi) Return Stack (giving the right convex hull chain) Similarly compute the left convex hull chain q d c b a p1

  29. Invariant When Pi is being considered the stack gives the right chain of the convex hull of {p1, p2, , pi-1 } q d c b a p1

  30. Grahams Algorithm p2 p6 p1 p5 p3 p4 p7 p8 Stack

  31. Grahams Algorithm p2 p6 p1 p5 p3 p4 p7 p8 Stack SORT

  32. Grahams Algorithm p8 p7 p6 p5 p4 p3 p2 p1 Stack

  33. Grahams Algorithm p8 p7 p6 p5 p4 p3 p2 p1 Stack Push p1 and p2

  34. Grahams Algorithm p8 p7 p6 p5 p4 p3 p2 P2 P1 p1 Stack

  35. Grahams Algorithm p8 p7 p6 p5 p4 p3 p2 P2 P1 p1 Stack P1, P2, P3 is a left turn Push (p3) i = 3

  36. Grahams Algorithm p8 p7 p6 p5 p4 p3 P3 P2 P1 p2 p1 Stack i = 3

  37. Grahams Algorithm p8 p7 p6 p5 p4 p3 P3 P2 P1 p2 p1 Stack P2, P3, P4 is a left turn Push (p4) i = 4

  38. Grahams Algorithm p8 p7 p6 p5 p4 P4 P3 P2 P1 p3 p2 p1 Stack i = 4

  39. Grahams Algorithm p8 p7 p6 p5 p4 P4 P3 P2 P1 p3 p2 p1 Stack P3, P4, P5 is a right turn Pop() i = 5

  40. Grahams Algorithm p8 p7 p6 p5 p4 p3 P3 P2 P1 p2 p1 Stack P2, P3, P5 is a right turn Pop() i = 5

  41. Grahams Algorithm p8 p7 p6 p5 p4 p3 p2 P2 P1 p1 Stack P1, P2, P5 is a Left turn Push(P5) i = 5

  42. Grahams Algorithm p8 p7 p6 p5 p4 p3 P5 P2 P1 p2 p1 Stack i = 5

  43. Grahams Algorithm p8 p7 p6 p5 p4 p3 P5 P2 P1 p2 p1 Stack P2, P5, P6 is a Left turn Push(P6) i = 6

  44. Grahams Algorithm p8 p7 p6 p5 p4 P6 P5 P2 P1 p3 p2 p1 Stack i = 6

  45. Grahams Algorithm p8 p7 p6 p5 p4 P6 P5 P2 P1 p3 p2 p1 Stack P5, P6, P7 is a right turn Pop() i = 7

  46. Grahams Algorithm p8 p7 p6 p5 p4 p3 P5 P2 P1 p2 p1 Stack P2, P5, P7 is a left turn Push(P7) i = 7

  47. Grahams Algorithm p8 p7 p6 p5 p4 P7 P5 P2 P1 p3 p2 p1 Stack i = 7

  48. Grahams Algorithm p8 p7 p6 p5 p4 P7 P5 P2 P1 p3 p2 p1 Stack i = 7

  49. Grahams Algorithm p8 p7 p6 p5 p4 P7 P5 P2 P1 p3 p2 p1 Stack P5, P7, P8 is a right turn Pop() i = 8

  50. Grahams Algorithm p8 p7 p6 p5 p4 p3 P5 P2 P1 p2 p1 Stack P2, P5, P8 is a left turn Push(P8) i = 8

Related


More Related Content