Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Successfully reported this slideshow.

Like this presentation? Why not share!

- Convex hull by Shiwangi Thakur 552 views
- Convex Hull Algorithms by Kasun Ranga Wijew... 1108 views
- An Efficient Convex Hull Algorithm ... by Kasun Ranga Wijew... 690 views
- Convex Hull Algorithm Analysis by Rex Yuan 387 views
- Convex hulls & Chan's algorithm by Alberto Parravicini 473 views
- Csc406 lecture7 device independence... by Daroko blog(www.p... 655 views

No Downloads

Total views

2,573

On SlideShare

0

From Embeds

0

Number of Embeds

2

Shares

0

Downloads

143

Comments

0

Likes

3

No embeds

No notes for slide

- 1. Convex Hull<br />1<br />4<br />5<br />3<br />6<br />2<br />1<br />0<br /><ul><li>Given a set of pins on a pinboard
- 2. And a rubber band around them
- 3. How does the rubber band look when it snaps tight?
- 4. We represent the convex hull as the sequence of points on the convex hull polygon, in counter-clockwise order.</li></ul>By Ravikirankalal<br />
- 5. Defination<br />Informal definition: Convex hull of a set of points in plane is the shape taken by a rubber band stretched around the nails pounded into the plane at each point<br />Convex hull of a set of points S is the set of all convex combinations of points of S <br />Convex hull of S is denoted by convS, <br /> sometimes the notation <br />(S) is also used<br />By Ravikirankalal<br />
- 6. Extreme Points<br />The extreme points of a set S of points in the plane are the vertices of the convex hull at which the interior angle is less than π<br /> Also a point is extreme iff there exists a line through that point that other wise does not touch the convex hull<br />By Ravikirankalal<br />
- 7. Extreme Edges<br />for each i do <br />for each j ≠ i do <br /> for each k ≠ i ≠ j do <br /> if pkis not left or on (pi ,pj)<br /> then (pi ,pj)isnot extreme<br />There are three nested loops in this algorithm<br /> Hence the order is O(n3)<br /> For each of the n2 pair of points, the test for extremeness costs n<br />The vertices that are extreme can now be found<br />By Ravikirankalal<br />
- 8. Applications<br />Computer Visualization, Ray Tracing, Video Games.<br />Geographical Information Systems (GIS) - Computing Accessibility Maps<br />Visual Pattern Matching - Detecting Car License Plates<br />Path Finding - Embedded AI of Mars mission Rovers<br />Replacement of Bounding Boxes<br />By Ravikirankalal<br />
- 9. Bounding box<br />By Ravikirankalal<br />
- 10. 7<br />A<br />B<br />Convex Hull: Divide & Conquer<br /><ul><li>Preprocessing: sort the points by x-coordinate
- 11. Divide the set of points into two sets A and B:
- 12. A contains the left n/2 points,
- 13. B contains the right n/2 points
- 14. Recursively compute the convex hull of A
- 15. Recursively compute the convex hull of B
- 16. Merge the two convex hulls</li></ul>By Ravikirankalal<br />
- 17. Merging in O(n) time<br />8<br /><ul><li>Find upper and lower tangents in O(n) time
- 18. Compute the convex hull of AB:
- 19. walk counterclockwise around the convex hull of A, starting with left endpoint of lower tangent
- 20. when hitting the left endpoint of the upper tangent, cross over to the convex hull of B
- 21. walk counterclockwise around the convex hull of B
- 22. when hitting right endpoint of the lower tangent we’re done
- 23. This takes O(n) time</li></ul>4<br />5<br />3<br />6<br />2<br />7<br />1<br />A<br />B<br />By Ravikirankalal<br />
- 24. Finding the lower tangent in O(n) time <br />9<br />3<br />a = rightmost point of A<br /> b = leftmost point of B<br /> while T=ab not lower tangent to both convex hulls of A and B do{<br /> while T not lower tangent to convex hull of A do{ a=a-1 } while T not lower tangent to convex hull of B do{ b=b+1 } }<br />4=b<br />4<br />2<br />3<br />5<br />5<br />a=2<br />6<br />1<br />7<br />1<br />0<br />0<br />A<br />B<br />By Ravikirankalal<br />
- 25. Convex Hull: Runtime<br />10<br />O(n log n) just once<br /><ul><li>Preprocessing: sort the points by x-coordinate
- 26. Divide the set of points into two sets A and B:
- 27. A contains the left n/2 points,
- 28. B contains the right n/2 points
- 29. Recursively compute the convex hull of A
- 30. Recursively compute the convex hull of B
- 31. Merge the two convex hulls</li></ul>O(1)<br />T(n/2)<br />T(n/2)<br />O(n)<br />By Ravikirankalal<br />
- 32. Convex Hull: Runtime<br />11<br /><ul><li>RuntimeRecurrence:</li></ul>T(n) = 2 T(n/2) + cn<br /><ul><li> Solves to T(n) = (n log n)</li></ul>By Ravikirankalal<br />
- 33. Quickhull<br />QuickHull uses a divide and conquer approach similar to the QuickSort algorithm.<br />Benchmarks showed it is quite fast in most average cases.<br />Recursive nature allows a fast and yet clean implementation.<br />By Ravikirankalal<br />
- 34. Initial input<br />The initial input to the algorithm is an arbitrary set of points. <br />By Ravikirankalal<br />
- 35. First two points on the convex hull<br />Starting with the given set of points the first operation done is the calculation of the two maximal points on the horizontal axis.<br />By Ravikirankalal<br />
- 36. Recursively divide<br />Next the line formed by these two points is used to divide the set into two different parts.<br />Everything left from this line is considered one part, everything right of it is considered another one.<br />Both of these parts are processed recursively.<br />By Ravikirankalal<br />
- 37. Max distance search<br />To determine the next point on the convex hull a search for the point with the greatest distance from the dividing line is done.<br />This point, together with the line start and end point forms a triangle.<br />By Ravikirankalal<br />
- 38. Point exclusion<br />All points inside this triangle can not be part of the convex hull polygon, as they are obviously lying in the convex hull of the three selected points. <br />Therefore these points can be ignored for every further processing step.<br />By Ravikirankalal<br />
- 39. Recursively divide<br />Having this in mind the recursive processing can take place again.<br />Everything right of the triangle is used as one subset, everything left of it as another one.<br />By Ravikirankalal<br />
- 40. Abort condition<br />At some point the recursively processed point subset does only contain the start and end point of the dividing line.<br />If this is case this line has to be a segment of the searched hull polygon and the recursion can come to an end.<br />By Ravikirankalal<br />
- 41. Running time<br />The running time of Quickhull, as with QuickSort, depends on how evenly the points are split at each stage.<br />T(n) = 1 if n = 1<br />T(n1) + T (n2) otherwise where n1+n2<=n<br />If we assume that the points are ``evenly'' distributed, the running time will solve to O(n log n).<br />if the splits are not balanced, then the running time can easily increase to O(n^2). <br />By Ravikirankalal<br />
- 42. Think of wrapping a gift. Put the paper in contact with the gift and continue to wrap around from one surface to the next until you get all the way around.<br />By Ravikirankalal<br />
- 43. Algorithm: Gift Wrapping<br />Find the lowest point (smallest y coordinate)<br />Let i0 be its index, and set i ← i0<br />repeat<br /> for each j ≠ i do <br /> compute counterclockwise angle θfrom previous hull edge<br /> Let k be the index of the point with the smallest θ<br /> Output (pi ,pk)as a hull edge<br /> i ← k<br />until i =i0<br /><ul><li>We use the lowest point as the anchor
- 44. The order is O(n2)
- 45. The cost is O(n) for each hull edge
- 46. The point set is wrapped by a string that bends the that bends with </li></ul> minimum angle from previous to next hull edge<br />By Ravikirankalal<br />
- 47. Jarvis March - Example<br />p10<br />p6<br />p9<br />p5<br />p7<br />p12<br />p3<br />p4<br />p11<br />p1<br />p8<br />p2<br />p0<br />By Ravikirankalal<br />
- 48. Jarvis March - Example<br />p10<br />p6<br />p9<br />p5<br />p7<br />p12<br />p3<br />p4<br />p11<br />p1<br />p8<br />p2<br />p0<br />By Ravikirankalal<br />
- 49. Jarvis March - Example<br />p10<br />p6<br />p9<br />p5<br />p7<br />p12<br />p3<br />p4<br />p11<br />p1<br />p8<br />p2<br />p0<br />By Ravikirankalal<br />
- 50. Jarvis March - Example<br />p10<br />p6<br />p9<br />p5<br />p7<br />p12<br />p3<br />p4<br />p11<br />p1<br />p8<br />p2<br />p0<br />By Ravikirankalal<br />
- 51. Jarvis March - Example<br />p10<br />p6<br />p9<br />p5<br />p7<br />p12<br />p3<br />p4<br />p11<br />p1<br />p8<br />p2<br />p0<br />By Ravikirankalal<br />
- 52. Jarvis March - Example<br />p10<br />p6<br />p9<br />p5<br />p7<br />p12<br />p3<br />p4<br />p11<br />p1<br />p8<br />p2<br />p0<br />By Ravikirankalal<br />
- 53. Jarvis March - Example<br />p10<br />p6<br />p9<br />p5<br />p7<br />p12<br />p3<br />p4<br />p11<br />p1<br />p8<br />p2<br />p0<br />By Ravikirankalal<br />
- 54. Running time<br />we can find the point q in O(n) time.<br />After repeating this h times, we will return back to the starting point and we are done.<br />Thus, the overall running time is O(nh).<br />Worst case efficiency will be n2.<br />By Ravikirankalal<br />
- 55. thanQ<br />By Ravikirankalal<br />

No public clipboards found for this slide

Be the first to comment