Convex Sets & Concave Sets

A planar region R is called convex if and only if for any pair of points p, q in R, the line segment pq lies completely in R. Otherwise, it is called concave. p p R1 q q Convex Concave R2

An Example ! 1 2 .

'#((er (and )hen Q is finite. its convex h#ll is the #ni*#e convex polygon whose vertices are from Q and that contains all points of Q. .Convex "#ll $he convex hull C"%Q& of a set Q is the smallest convex region that contains Q.

$he Convex "#ll +ro(lem Input. pn / of points Output.. Example p2 p2 p3 O#tp#t. p3 . p2 . p1 . p14. a list of vertices of C"%P& in co#ntercloc0wise order. p 5 . a set P . p2 . p2 . p1 . …. p6 p p1 p1 p! p5 p14 .

Edges of a Convex "#ll 7or every edge (oth endpoints p. or on the line segment pq. All other points in P lie to the same side of the line passing thro#gh p and q. q ∈ P. q r p .

99 O%n 2& easily improva(le to O%n lg n& ret#rn L q r '#nning time Θ (n3 ) ./ 99 set of directed edges of C"%P& that (o#nds the 99 points of P on the right. where p. 2 for every ordered pair %p. sorted in co#ntercloc0wise order.A Slow Convex "#ll Algorithm Slow8Convex8"#ll%P& E ← . pq / 99 pq and qp cannot (e (oth in E 7rom E constr#ct a list L of vertices of C"%P&. q ∈ P and p ≠ q // Θ%n & pairs do valid ← tr#e for every point r ≠ p or q 99 n −2 s#ch points do if r lies to the right of pq or collinear with p and q (#t not on pq p then valid ← false if valid then E ← E ∪ . q&.

Sign up to vote on this title
UsefulNot useful