GScanJMarch

# GScanJMarch - Read Chapter 1 from text by BKOS The...

This preview shows pages 1–6. Sign up to view the full content.

Read Chapter 1 from text by BKOS. The procedure SlowConvexHull(P) [pp.3-4] is a brute force algorithm taking O(n 3 ) time. The algorithm on p.6 called ConvexHull(P) is a modification of Graham’s Scan algorithm which is presented its original form below. Read the rest of the chapter Sections 1.2 and 1.3. Extreme Point Lemma : A point is non-extreme iff it is inside some closed triangle whose vertices are points of the set, and is not itself a corner of that triangle. Proof of this lemma and an algorithm taking O(n 4 ) time are left as exercises. An edge with two extreme vertices is called an extreme edge. Develop an O(n 3 ) algorithm to determine the extreme edges of S.

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

View Full Document
Convex hulls Graham’s scan Concept A point within a triangle of S cannot be a vertex of the convex hull. Previous algorithm determined if a point p was within a triangle of S by trying (as many as) all of the triangles for each point p . Can we find out if p is within a triangle of S more efficiently? Graham’s scan does so. This algorithm is from one of the first papers specifically concerned with finding an efficient geometric algorithm (1972). The essential idea: if a point p is not a vertex of the convex hull, then it is internal to some triangle Op 1 p 2 , where O is an internal point and p 1 and p 2 are hull vertices. But if we are trying to find the hull vertices, where do p 1 and p 2 come from? We shall see. The algorithm consists of preparation and scan. Single shot algorithm (there is only one H ( S ) for a given S ).
Convex hulls Graham’s scan Centroid The centroid of a finite set of points p 1 , p 2 , …, p N is their arithmetic mean ( p 1 + p 2 + … + p N ) / N . (Computed for each coordinate separately.) Lexicographic sort Sorting on multiple keys associated with objects to be sorted. Compare objects to be sorted on first key; and sort accordingly. If first keys are equal, sort on second key. If second keys are equal, … farther faster fastest father p 1 = (-3,-1) p 2 = (-2,1.5) p 2 = (2,1) c = (-1,0.5)

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

View Full Document
Convex hulls Graham’s scan Polar angles The polar angle of a point p is the angle from the x axis through the origin to the point, ascending counterclockwise. 0 x y p 1 p 2 θ 1 θ 2
Convex hulls Graham’s scan 0 x y p 1 p 2 θ 1 θ 2 Comparing polar angles Given two points p 1 and p 2 in the plane, which has the greater polar angle? p 2 forms a strictly small polar angle with the x axis than p 1 iff triangle 0 p 2 p 1 has a positive signed area. Area(triangle 0

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

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

{[ snackBarMessage ]}

### Page1 / 20

GScanJMarch - Read Chapter 1 from text by BKOS The...

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

View Full Document
Ask a homework question - tutors are online