Why Graham-Scan Needs to Sort Vertices Before Scanning

Slides:



Advertisements
Similar presentations
2/9/06CS 3343 Analysis of Algorithms1 Convex Hull  Given a set of pins on a pinboard  And a rubber band around them  How does the rubber band look when.
Advertisements

Parallel Algorithms in Computational Geometry
Jarvis March Graham Scan Chan’s Algorithm
Chan’s algorithm CS504 Presentation.
Planar Convex Hull 2013 / 5 / 9 Group 4 Sungheon Park Jeongho Son CS504 Presentation [CS504 Presentation]
algorithms and data structures
Convex Hull obstacle start end Convex Hull Convex Hull
CS16: Introduction to Data Structures & Algorithms
The Divide-and-Conquer Strategy
Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Dr. Sumanta Guha Slide Sources: CLRS “Intro.
Convex Hulls May Shmuel Wimer Bar Ilan Univ., Eng. Faculty Technion, EE Faculty.
1. Find the measure of the supplement of a 92° angle. 2. Evaluate (n – 2)180 if n = Solve = 60.
Geometry Chapter Polygons. Convex Polygon – a polygon with a line containing a side with a point in the interior of the polygon.
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.
Andrew's Monotone Chain Convex Hull Algorithm. Andrew's Monotone Chain Scan A left-to-right variant of Graham's scan Discovered by Andrew in 1979 Using.
Computational Geometry for the Tablet PC
Informal Definition : Let S is set of nails sticking out from a board. the convex hull can be visualized as the shape formed by a tight rubber band that.
1 Today’s Material Computational Geometry Problems –Closest Pair Problem –Convex Hull Jarvis’s March, Graham’s scan –Farthest Point Problem.
Algorithms and Data Structures Lecture 13. Agenda: Plane Geometry: algorithms on polygons - Verification if point belongs to a polygon - Convex hull.
5/17/2015 1:32 AMConvex Hull1 obstacle start end.
1.4 Exercises (cont.) Definiton: A set S of points is said to be affinely (convex) independent if no point of S is an affine combination of the others.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001 Lecture 2 Chapter 2: Polygon Partitioning.
Lection 1: Introduction Computational Geometry Prof.Dr.Th.Ottmann 1 History: Proof-based, algorithmic, axiomatic geometry, computational geometry today.
Computational Geometry
Advanced Algorithm Design and Analysis (Lecture 9) SW5 fall 2004 Simonas Šaltenis E1-215b
CSE53111 Computational Geometry TOPICS q Preliminaries q Point in a Polygon q Polygon Construction q Convex Hulls Further Reading.
Triangulating a monotone polygon
Convex Hull. What is the Convex Hull? Imagine a set of points on a board with a nail hammered into each point. Now stretch a rubber band over all the.
Chapter 8.1 Notes: Find Angle Measures in Polygons Goal: You will find interior and exterior angle measures in polygons.
Computational Geometry (35/33) Line Segments and cross-product Segment intersection and Sweep Line Convex Hull and Graham’s Scan, Jarvis’s march Divide-and-Conquer.
Computational Geometry Course Summary (First Half) Spring 2008 Pay special attention to: algorithm details (able to explain correctness and carry out a.
Question # 1 For $100 15$1,000,000 14$500,000 13$250,000 12$125,000 11$64,000 10$32,000 9$16,000 8$8,000 7$4,000 6$2,000 5$1,000 4$500 3$300 2$200 1$100.
1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.
Multitouch and Collision Detection MOBILE SOFTWARE DEVELOPMENT.
Chapter 8.1 Notes: Find Angle Measures in Polygons Goal: You will find angle measures in polygons.
Type your question here. Type Answer Type your question here. Type Answer.
Convex Hull. University of Manchester biologists used lasers to measure the minimum amount of skin required to wrap around the skeletons of modern-day.
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.
COMPUTATIONAL GEOMETRY AND MATRIX MULTIPLICATION Mohammed Zeeshan Farooqui Minhaj Uddin.
Convex Hull 2012/10/23. Convex vs. Concave A polygon P is convex if for every pair of points x and y in P, the line xy is also in P; otherwise, it is.
Do Now. Section 8.2 Angles in Polygons Polygon Interior Angles Theorem The sum of the measures of the interior angles of a convex polygon with n sides.
CS6234 Advanced Algorithms - Convex hull. Terminologies – ◦ Convex hull of a set Q of points is the smallest convex polygon P for which each point in.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last time Several convex hull algorithms. Lower bound of O(n log n) –O(n log h) for output sensitive.
2.1: IDENTIFYING POLYGONS Click anywhere to begin.
Ch 1.6 CLASSIFY POLYGONS. In this section we will… Look at what makes something a polygon. Identify polygons by their sides and angles Identify polygons.
Angles When the sides of a polygon are extended, other angles are formed. The original angles are the interior angles. The angles that form linear pairs.
# of sides # of triangles Sum of measures of interior angles 31 1(180)= (180)= (180)= (180)=720 n n-2(n-2) 180.
8.1 Find Angle Measures in Polygons Hubarth Geometry.
The YELLOW Cross Lesson 5 Lesson 4 Review Lesson Extension
2.6 Solving Systems of Linear Inequalities
Types of Polygons Polygon- a flat closed figure made of straight line segments Circle the figures that are polygons. Cross out the figures 
that are.
Andrew's Monotone Chain Convex Hull Algorithm
Click here for the answer. Click here for the answer.
Convex Hull.
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
Angles of a Polygon Diagonal of a polygon – A segment that connects any two nonconsecutive vertices. The number of triangles formed by drawing diagonals.
العدد تذكيره وتأنيثه مقدمة
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
Convex Sets & Concave Sets
Computational Geometry for the Tablet PC
How to Use a Protractor.
Convex Hull 1/1/ :28 AM Convex Hull obstacle start end.
Standardized Test Practice
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Standard:.
Convex Hulls Given a set of points (x1,y1),(x2,y2),…,(xn,yn), the convex hull is the smallest convex polygon containing all the points.
Convex Hull obstacle start end 4/30/2019 5:21 PM Convex Hull
Computational Geometry Algorithms
Clipping Polygons Lecture 31 Fri, Nov 9, 2007.
Presentation transcript:

Why Graham-Scan Needs to Sort Vertices Before Scanning Bill Thies November 12, 2004 6.046 Recitation Supplement

Graham Scan: Sorting Step The first stage of Graham-Scan sorts the points by their polar angle from the bottom-left vertex, p0: In recitation, we asked: would the scanning phase of Graham-Scan work on any simple polygon? That is, can you omit this sorting phase if you start from a simple polygon? The answer is NO. p0

Graham Scan: Sorting Step The first stage of Graham-Scan sorts the points by their polar angle from the bottom-left vertex, p0: In recitation, we asked: would the scanning phase of Graham-Scan work on any simple polygon? That is, can you omit this sorting phase if you start from a simple polygon? The answer is NO. p0

Graham Scan: Sorting Step The first stage of Graham-Scan sorts the points by their polar angle from the bottom-left vertex, p0: In recitation, we asked: would the scanning phase of Graham-Scan work on any simple polygon? That is, can you omit this sorting phase if you start from a simple polygon? The answer is NO. p6 p3 p4 p5 p2 p1 p0

Graham Scan: Sorting Step The first stage of Graham-Scan sorts the points by their polar angle from the bottom-left vertex, p0: In recitation, we asked: would the scanning phase of Graham-Scan work on any simple polygon? That is, can you omit this sorting phase if you start from a simple polygon? The answer is NO. p6 p3 p4 p5 Simple polygon (not convex) p2 p1 p0

Graham Scan on Simple Polygons The first stage of Graham-Scan sorts the points by their polar angle from the bottom-left vertex, p0: In recitation, we asked: would the scanning phase of Graham-Scan work on any simple polygon? That is, can you omit this sorting phase if you start from a simple polygon? The answer is NO. p6 p3 p4 p5 Simple polygon (not convex) p2 p1 p0

Counter-Example Consider the same set of points with the following simple polygon:

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 Stack p4 p6 p5 p1 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p2 p1 p0 Stack p4 p6 p5 p1 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p4 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p4 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p4 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p5 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p5 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p6 p5 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0

Counter-Example Consider the same set of points with the following simple polygon: Run Graham’s Scan starting from p0 p3 p2 p6 p5 p3 p2 p1 p0 Stack p4 p6 p5 p1 p0 p0 At end, get convex hull = <p0, p1, p2, p3, p5, p6> But actually, convex hull = <p0, p1, p2, p3>

Counter-Example Consider the same set of points with the following simple polygon: p3 p2 p6 p5 p3 p2 p1 p0 Stack p4 p6 p5 original p1 p0 p0 What went wrong? Vertex p3 was not “visible” from p0, so the line p3->p5 crossed p6->p0 when building the convex hull. That is, the polygon became non-simple during course of the algorithm.

Graham-Scan Builds Star-Shaped Polygons When vertices are sorted by polar angle from p0, all other vertices are visible from p0 in resulting polygon: A polygon with a point visible from each vertex is called star-shaped (CLRS p. 957, Ex. 33.3-4). Graham-Scan works for all star-shaped polygons, but not for all simple ones p6 p3 p4 p5 p2 p1 p0

For More Information There do exist linear-time algorithms for building the convex hull of a simple polygon. Many of the first algorithms proposed were actually incorrect! See here for an interesting history: http://cgm.cs.mcgill.ca/~athens/cs601/intro.html Is the question we considered a million-dollar question? Probably not, but it can be worth up to $200! Click here for a good time: http://answers.google.com/answers/threadview?id=137349