QuickHull_DivideConquer

QuickHull_DivideConquer - Convex hulls Quickhull Quicksort...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Convex hulls Quickhull Quicksort The Quickhull algorithm is based on the Quicksort algorithm. Recall how quicksort operates: at each level of recursion, an array of numbers to be sorted is partitioned into two subarrays, such that each term of the first (left) subarray is not larger than each term of the second (right) subarray. LEFT RIGHT Two pointers to the array cells (LEFT and RIGHT) initially point to the opposite extreme ends of the array. LEFT and RIGHT move towards each other, one cell at a time. At any given time, one pointer is moving and one is not. If the numbers pointed to by LEFT and RIGHT violate the desired sort order, they are swapped, then the moving pointer is halted and the halted pointer becomes the moving pointer. When the two pointers point to the same cell, the array is split at that cell and the process recurses on the subarrays. Quicksort runs in expected O ( N log N ) time, if the subarrays are well balanced, but can require as much as O ( N 2 ) time in the worst case.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Convex hulls Quickhull Quickhull overview Quickhull operates in a similar manner. It recursively partitions the point set S, so as to find the convex hull for each subset. The hull at each level of the recursion is formed by concatenating the hulls found at the next level down . S
Background image of page 2
Convex hulls Quickhull Initial partition The initial partition of S is determined by a line L through the points l , r S with the smallest and largest absciss S (1) S is the subset of S on or above L . S (2) S is the subset of S on or below L . Note that { S (1) , S (2) } is not a strict partition of S , as S (1) S (2) { l , r }. This is not a difficulty. The idea now is to construct hulls H ( S (1) ) and H ( S (2) ), then concatenate them to get H ( S ). The process is the same for S (1) and S (2) , we consider S (1) . l r L S (1) S (2)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Convex hulls Quickhull Finding the “apex” Find the point h S (1) such that (1) triangle hlr has the maximum area of all triangles { plr : p S (1) }, and if there are > 1 triangles with maximum area, (2) the one where angle hlr is maximum. This condition ensures that h H ( S ). Why? Construct a line parallel to line L through h , call it L . There will be no points of S (1) (or S ) above L , by condition (1). There may be other points on L , but h will be the leftmost, by condition (2), hence it is not a convex combination of any two points of S. h H ( S ). “Apex” h can be found in O ( N ) time by checking each point of S (1) .
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 20

QuickHull_DivideConquer - Convex hulls Quickhull Quicksort...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online