E p 2 2 for all p q r p 3 such that r p q 3 if

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Input: a set P of points in IR2 Output: C H(P ) 1. E ←P 2 2. for all (p, q , r) ∈ P 3 such that r ∈ {p, q } / 3. if C C W (p, q , r ) ≤ 0 4. then remove (p, q ) from E 5. Write the remaining edges of E into L in counterclockwise order 6. Return L CONVEX HULL - Divide & Conquer ding p itself, and the p oints to the right of p, by comparing x-coordinates. Recurs the convex hulls of L and R. Finally, merge the two convex hulls into the final outp erge step requires a little explanation. We start by connecting the two hulls with a ✦ een the re tmost po in x the hull of L an Spl t P t to t o o se hu b etwCo mputighme dian int of -co ordinate withdthe leiftmosinp ointwf the ts ll e ✦oints p and q , resp ectively. (Yes, it’s the same p.) Actually, let’s add two cop p Compute Left an d Right Hulls recursively ent pq and call them bridges. Since p and q can ‘see’ each other, this creates a so -shap ed rglegon, which isHunlsx except p ossibly at the endp oints off the bridges. ✦...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online