algorithms and data structures

Slides:



Advertisements
Similar presentations
Polygon Triangulation
Advertisements

Computational Geometry
Computational Geometry - Part II Mohammed Nadeem Ahmed Raghavendra Kyatham.
Advanced Topics in Algorithms and Data Structures Lecture 7.2, page 1 Merging two upper hulls Suppose, UH ( S 2 ) has s points given in an array according.
Jarvis March Graham Scan Chan’s Algorithm
Planar Convex Hull 2013 / 5 / 9 Group 4 Sungheon Park Jeongho Son CS504 Presentation [CS504 Presentation]
Brute-Force Triangulation
Computing Convex Hulls CLRS 33.3
Convex Hull obstacle start end Convex Hull Convex Hull
CS16: Introduction to Data Structures & Algorithms
C o m p u t i n g C O N V E X H U L L S by Kok Lim Low 10 Nov 1998 COMP Presentation.
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
The Divide-and-Conquer Strategy
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
CS4413 Divide-and-Conquer
Ruslana Mys Delaunay Triangulation Delaunay Triangulation (DT)  Introduction  Delaunay-Voronoi based method  Algorithms to compute the convex hull 
Convex Hulls May Shmuel Wimer Bar Ilan Univ., Eng. Faculty Technion, EE Faculty.
Advanced Topics in Algorithms and Data Structures Lecture 7.1, page 1 An overview of lecture 7 An optimal parallel algorithm for the 2D convex hull problem,
Convex Hulls in 3-space Jason C. Yang.
1 Convex Hull in Two Dimensions Jyun-Ming Chen Refs: deBerg et al. (Chap. 1) O’Rourke (Chap. 3)
Computational Geometry
Lecture 3: Reduce to known problem Convex Hull (section 33.3 of CLRS). Suppose we have a bunch of points in the plane, given by their x and y coordinates.
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.
What does that mean? To get the taste we will just look only at some sample problems... [Adapted from S.Suri]
CPCS 391 Computer Graphics 1 Lecture 5: Polygon Filling
Computational Geometry Piyush Kumar (Lecture 3: Convexity and Convex hulls) Welcome to CIS5930.
Query Processing in Databases Dr. M. Gavrilova.  Introduction  I/O algorithms for large databases  Complex geometric operations in graphical querying.
6/2/ :35 AMIncremental Convex Hull1 q w u e zt.
1 -1 Chapter 1 Introduction Why Do We Need to Study Algorithms? To learn strategies to design efficient algorithms. To understand the difficulty.
Chapter 4: Divide and Conquer The Design and Analysis of Algorithms.
Point Location Computational Geometry, WS 2007/08 Lecture 5 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
Convex Hull Computation ● Applications of Convex Hull Computation ● Definitions ● Basic Math Functions ● Algorithms Algorithm Speed Discovered By Brute.
Lection 1: Introduction Computational Geometry Prof.Dr.Th.Ottmann 1 History: Proof-based, algorithmic, axiomatic geometry, computational geometry today.
Geometric Algorithms1 segment intersection orientation point inclusion simple closed path.
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.
Polygon Scan Conversion and Z-Buffering
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
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.
5 -1 Chapter 5 The Divide-and-Conquer Strategy A simple example finding the maximum of a set S of n numbers.
1 Triangulation Supplemental From O’Rourke (Chs. 1&2) Fall 2005.
Fundamental Data Structures and Algorithms Klaus Sutner April 27, 2004 Computational Geometry.
Convex Hull. University of Manchester biologists used lasers to measure the minimum amount of skin required to wrap around the skeletons of modern-day.
1 / 41 Convex Hulls in 3-space Jason C. Yang. 2 / 41 Problem Statement Given P: set of n points in 3-space Return: –Convex hull of P: CH (P) –Smallest.
COMPUTATIONAL GEOMETRY AND MATRIX MULTIPLICATION Mohammed Zeeshan Farooqui Minhaj Uddin.
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.
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
Convex hulls in 3D Maciej Kot. Finding convex hull Given a set of points, find a convex hull that contains all of them and is minimal.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Polygon Triangulation
CMPS 3130/6130 Computational Geometry Spring 2017
Introduction to Polygons
Computer Graphics Filled Area Primitives II Lecture 09 Taqdees A
Convex Hull R.L. Graham’s Algorithm Computer Graphics.
Fill Area Algorithms Jan
Convex Hull.
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
Computational Geometry Capter:1-2.1
Polygon Triangulation
Agenda Polygon Terminology Types of polygons Inside Test
Convex Sets & Concave Sets
Agenda Polygon Terminology Types of polygons Inside Test
Convex Hull 1/1/ :28 AM Convex Hull obstacle start end.
Prof. Harriet Fell Fall 2011 Lecture 9 – September 26, 2011
Convex Hull obstacle start end 4/30/2019 5:21 PM Convex Hull
Computational Geometry Algorithms
Computational Geometry
Presentation transcript:

algorithms and data structures Convex Hulls algorithms and data structures Convexivity Package-Wrap Algorithm Graham Scan Dynamic Convex Hull Convex Hull

What is a Convex Hull? Let S be a set of points in the plane. Intuition: Imagine the points of S as being pegs; the convex hull of S is the shape of a rubber-band stretched around the pegs. Formal definition: the convex hull of S is the smallest convex polygon that contains all the points of S. Convex Hull

Convexity convex A polygon P is said to be convex if: Non convex P is non-intersecting; and for any two points p and q on the boundary of P, segment pq lies entirely inside P Non convex Convex Hull

Why Convex Hulls? Convex Hull

The Package Wrapping Algorithm Idea: Think of wrapping a package. Put the paper in contact with the package and continue to wrap around from one surface to the next until you get all the way around. Convex Hull

Package Wrap Question: Given the current point, how do we compute the next point to be wrapped? Set up an orientation tournament using the current point as the anchor-point. The next point is selected as the point that beats all other points at CCW orientation, i.e., for any other point, we have orientation(c, p, q) = CCW Convex Hull

Time Complexity of Package Wrap For every point on the hull we examine all the other points to determine the next point Notation: N: number of points M: number of hull points (M  N) Time complexity: (M N) Worst case: (N2) (All the points are on the hull, and thus M = N) Average case: (N log N ) — (N4/3) for points randomly distributed inside a square, M = (log N) on average for points randomly distributed inside a circle, M = (N1/3) on average Convex Hull

Package Wrap has worst-case time complexity O( N2 ) Which is bad... But in 1972, Nabisco needed a better cookie - so they hired R. L. Graham, who came up with... Convex Hull

The Graham Scan Algorithm Rave Reviews: “Almost linear!” Sedgewick “It’s just a sort!” Atul “Two thumbs up!” Siskel and Ebert Nabisco says... and history was made. Convex Hull

Graham Scan Form a simple polygon (connect the dots as before) Remove points at concave angles (one at a time, backtracking one step when any point is removed). Continue until you get all the way around. Convex Hull

Graham Scan How Does it Work? Start with the lowest point (anchor point) Convex Hull

Graham Scan: Phase 1 Now, form a closed simple path traversing the points by increasing angle with respect to the anchor point Convex Hull

Graham Scan: Phase 2 The anchor point and the next point on the path must be on the hull (why?) Convex Hull

Graham Scan: Phase 2 keep the path and the hull points in two sequences elements are removed from the beginning of the path sequence and are inserted and deleted from the end of the hull sequence orientation is used to decide whether to accept or reject the next point Convex Hull

(p,c,n) is a Convex Hull

Convex Hull

Time Complexity of Graham Scan Phase 1 takes time O(N logN) points are sorted by angle around the anchor Phase 2 takes time O(N) each point is inserted into the sequencen exactly once, and each point is removed from the sequence at most once Total time complexity O(N log N) Convex Hull

How to Increase Speed Wipe out a lot of the points you know won’t be on the hull! This is called interior elimination. One approach: Find the farthest points in the SW, NW, NE, and SE directions Eliminate the points inside the quadrilateral (SW, NW, NE, SE) only O(√N) points are left on average, if points are uniformly distributed on a unit square! Do Package Wrap or Graham Scan on the remaining points Convex Hull

Dynamic Convex Hull The basic convex hull algorithms were fairly interesting, but you may have noticed that you can’t draw the hull until after all of the points have been specified. Is there an interactive way to add points to the hull and redraw it while maintaining an optimal time complexity? Convex Hull

Two Halves = One Hull For this algorithm, we consider a convex hull as being two parts: An upper hull... and a lower hull... Convex Hull

Adding points: Case 1 Upper Hull 1b: Case 1: the new point is within the horizontal span of the hull Upper Hull 1a: If the new point is above the upper hull, then it should be added to the upper hull and some upper-hull points may be removed. . Upper Hull 1b: If the new point is below the upper hull, no changes need to be made Convex Hull

Case 1 (cont.) The cases for the lower hull are similar. If the new point is below the lower hull, then it is added to the lower hull and some lower-hull points may be removed. Lower Hull 1b: If the added point is above the existing point, it is inside the existing lower hull, and no changes need be made. Convex Hull

Adding Points: Case 2 Case 2: the new point is outside the horizontal span of the hull We must modify both the upper and lower hulls accordingly. Convex Hull

Hull Modification In Case 1, we determine the vertices l and r of the upper or lower hulls immediately preceding/following the new point p in the x-order. If p has been added to the upper hull, examine the upper hull rightward starting at r. If p makes a CCW turn with r and its right neighbor, remove r. Continue until there are no more CCW turns. Repeat for point l examining the upper hull leftward. The computation for the bottom hull is similar Convex Hull