Convex Sets Concave Sets Otherwise it is called

  • Slides: 33
Download presentation
Convex Sets & Concave Sets Otherwise, it is called concave. Convex Concave

Convex Sets & Concave Sets Otherwise, it is called concave. Convex Concave

An Example 4 1 2 3 Regions 1 & 2: convex Regions 3 &

An Example 4 1 2 3 Regions 1 & 2: convex Regions 3 & 4: concave

Convex Hull Rubber band

Convex Hull Rubber band

Degenerate Cases ♦ The convex hull of a single point is itself. ♦ The

Degenerate Cases ♦ The convex hull of a single point is itself. ♦ The convex hull of several collinear points is the line segment joining the two extreme points.

The Convex Hull Problem Example (direction of traversal about the outward axis with the

The Convex Hull Problem Example (direction of traversal about the outward axis with the interior on the left)

Edges of a Convex Hull q p

Edges of a Convex Hull q p

A Slow Convex Hull Algorithm

A Slow Convex Hull Algorithm

Floating Arithmetic is not Exact! Nearly colinear points p, q, r. q r p

Floating Arithmetic is not Exact! Nearly colinear points p, q, r. q r p p to the left of qr. q to the left of rp. r to the left of qp. All three accepted as edges! Not robust – the algorithm could fail with small numerical error.

Polar Angle polar angle p

Polar Angle polar angle p

Graham Scan This node will be a vertex of the convex hull.

Graham Scan This node will be a vertex of the convex hull.

Tie Breaking (1)

Tie Breaking (1)

Sorting by Polar Angle Labels are in the polar angle order.

Sorting by Polar Angle Labels are in the polar angle order.

No Polar Angle Evaluation if

No Polar Angle Evaluation if

Tie Breaking (2) if No square roots. Use dot product! and

Tie Breaking (2) if No square roots. Use dot product! and

Point Elimination Remove the rest since they cannot possibly be the hull vertices. furtherest

Point Elimination Remove the rest since they cannot possibly be the hull vertices. furtherest remove

Stack Initialization

Stack Initialization

Finish S

Finish S

Graham’s Scan finish start

Graham’s Scan finish start

The Graham Scan Algorithm

The Graham Scan Algorithm

Running time #operations Finding Why? time / operation total

Running time #operations Finding Why? time / operation total

Proof of Correctness Claim 1 Each point popped from stack S is not a

Proof of Correctness Claim 1 Each point popped from stack S is not a vertex of CH(P). Proof

Claim 2 Graham-Scan maintains the invariant that the points on stack S always form

Claim 2 Graham-Scan maintains the invariant that the points on stack S always form the vertices of a convex polygon in counterclockwise order. Proof The invariant still holds.

Correctness of Graham’s Scan

Correctness of Graham’s Scan

Jarvis’ March A “package wrapping” technique Right chain Left chain (lowest point)

Jarvis’ March A “package wrapping” technique Right chain Left chain (lowest point)

Running Time of Jarvis’s March Comparison between two polar angles can be done using

Running Time of Jarvis’s March Comparison between two polar angles can be done using cross product.