CSE53111 Computational Geometry TOPICS q Preliminaries q Point in a Polygon q Polygon Construction q Convex Hulls Further Reading.

Slides:



Advertisements
Similar presentations
Computer Graphics- SCC 342
Advertisements

CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
 Distance Problems: › Post Office Problem › Nearest Neighbors and Closest Pair › Largest Empty and Smallest Enclosing Circle  Sub graphs of Delaunay.
1/13/15CMPS 3130/6130: Computational Geometry1 CMPS 3130/6130: Computational Geometry Spring 2015 Convex Hulls Carola Wenk.
Computing Convex Hulls CLRS 33.3
Convex Hull obstacle start end Convex Hull Convex Hull
CS16: Introduction to Data Structures & Algorithms
Motion Planning CS 6160, Spring 2010 By Gene Peterson 5/4/2010.
What is Computational Geometry? Study of Data Structures and Algorithms for Geometric Problems 1970 ’ s: Need for Computational Geometry Recognized; Progress.
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.
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 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.
Computational Geometry
Convex Hull Problem Presented By Erion Lin. Outline Convex Hull Problem Voronoi Diagram Fermat Point.
Advanced Algorithm Design and Analysis (Lecture 10) SW5 fall 2004 Simonas Šaltenis E1-215b
Computational Geometry for the Tablet PC
THE WORLD OF POLYGONS LESSON 4.
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]
November 4, Algorithms and Data Structures Lecture XIV Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Query Processing in Databases Dr. M. Gavrilova.  Introduction  I/O algorithms for large databases  Complex geometric operations in graphical querying.
17. Computational Geometry Chapter 7 Voronoi Diagrams.
Convex Hulls Computational Geometry, WS 2006/07 Lecture 2 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für.
1 Lecture 8: Voronoi Diagram Computational Geometry Prof. Dr. Th. Ottmann Voronoi Diagrams Definition Characteristics Size and Storage Construction Use.
Prune-and-search Strategy
Introduction Outline The Problem Domain Network Design Spanning Trees Steiner Trees Triangulation Technique Spanners Spanners Application Simple Greedy.
Lection 1: Introduction Computational Geometry Prof.Dr.Th.Ottmann 1 History: Proof-based, algorithmic, axiomatic geometry, computational geometry today.
Computational Geometry
Geometric Algorithms1 segment intersection orientation point inclusion simple closed path.
Advanced Algorithm Design and Analysis (Lecture 9) SW5 fall 2004 Simonas Šaltenis E1-215b
Computational Geometry Convex Hulls Robust Geometric Primitives Degeneracy and Stability Nick Pilkington.
9/7/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries Carola Wenk.
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.
Part 6: Graphics Output Primitives (4) 1.  Another useful construct,besides points, straight line segments, and curves for describing components of a.
UNC Chapel Hill M. C. Lin Linear Programming Reading: Chapter 4 of the Textbook Driving Applications –Casting/Metal Molding –Collision Detection Randomized.
Line Arrangement Chapter 6. Line Arrangement Problem: Given a set L of n lines in the plane, compute their arrangement which is a planar subdivision.
© The McGraw-Hill Companies, Inc., Chapter 6 Prune-and-Search Strategy.
CMPS 3120: Computational Geometry Spring 2013
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.
Lecture 15 Computational Geometry Geometry sweeping Geometric preliminaries Some basics geometry algorithms.
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.
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
Convex Hulls Guo Qi, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
UNC Chapel Hill M. C. Lin Geometric Data Structures Reading: Chapter 10 of the Textbook Driving Applications –Windowing Queries Related Application –Query.
3. Polygon Triangulation
Lecture 5 Basic geometric objects
Introduction to Polygons
Computer Graphics Filled Area Primitives II Lecture 09 Taqdees A
Convex Hull R.L. Graham’s Algorithm Computer Graphics.
Query Processing in Databases Dr. M. Gavrilova
Determining the horizontal and vertical trace of the line
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
Computational Geometry (35/33)
Convex Sets & Concave Sets
Computational Geometry for the Tablet PC
Prof. Harriet Fell Fall 2011 Lecture 9 – September 26, 2011
CMPS 3130/6130: Computational Geometry Spring 2017
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
Computational Geometry
Convex Hull - most ubiquitous structure in computational geometry
Presentation transcript:

CSE53111 Computational Geometry TOPICS q Preliminaries q Point in a Polygon q Polygon Construction q Convex Hulls Further Reading

CSE53112 Geometric Algorithms Geometric Algorithms find applications in such areas as Computer Graphics Computer Aided Design VLSI Design GIS Robotics We will study algorithms dealing with points, lines, line segments, and polygons In particular, the algorithms will Determine whether a point is inside a Polygon Construct a Polygon Determine Convex Hulls

CSE53113 Preliminaries: A point p is represented as a pair of coordinates (x,y) A line is represented by a pair of points A path is a sequence of points p 1,p 2,... p n and the line segments connecting them, p 1 -p 2, p 2 -p 3,..., p k-1 -p k. A closed path whose last point is the same as the first is a polygon. A simple polygon is one whose corresponding path does not intersect itself. It encloses a region in the plane. A convex Polygon is a polygon such that any line segment connecting two points inside the polygon is itself entirely in the polygon. The convex hull of a set of points is defined as the smallest convex polygon enclosing all the given points.

CSE53114 A line segment connecting two points: The points are inside the polygon The line segment is not entirely in the polygon This is not a convex polygon p(x 1,y 1 ) q(x 2,y 2 ) r(x 3,y 3 ) s(x 4,y 4 )

CSE53115 Determining whether a point is inside a polygon Given a simple polygon polygon P, and a point q, determine whether the point is inside or outside the polygon. (a non-convex polygon)

CSE53116 Procedure Point_in_a_Polygon(P,q) Input : P ( a simple polygon with vertices p 1,p 2, … p n, and edges e 1,e 2,e 3, … e n and q (x 0,y 0 ) a point. Output: INSIDE ( a Boolean variable, True if q is inside P, and false otherwise) Count  0; for all edges e i of the polygon do if the line x = x 0 intersects e i then y i  y coordinate of the intersection between lines e i and x=x 0 ; if y i > y 0 then Count  Count +1; if count is odd then INSIDE  TRUE; else INSIDE  FALSE This does not work if the line passes through terminal points of edges

CSE53117 It takes constant time to perform an intersection between two line segments. The algorithm computes n such intersections, where n is the size on the polygon. Total running time of the algorithm, O(n).

CSE53118 Constructing a Simple Polygon Given a set of points in the plane, connect them in a simple closed path. Consider a large circle that contains all the points. Scan the area of C by a rotating line. Connect the points in the order they are encountered in the scan.

CSE53119 Procedure Simple_Polygon Input : p 1,p 2,... p n (points in the polygon) Output : P ( a simple polygon whose vertices p 1,p 2,... p n are in some order) p1  the point with the max ‘x’ value. 1. for i  2 to n 2.  i  angle between line p 1 -p i and the x-axis; 3. sort the points according to the angles (use the corresponding priority for the point and do a heapsort) 4. P is the polygon defined by the list of points in the sorted order. Complexity : Complexity of the sorting algorithm.

CSE Convex Hulls The convex hull of a set of points is defined as the smallest convex polygon enclosing all the points in the set. The convex hull is the smallest region encompassing a set of points. A convex hull can contain as little as three and as many as all the points as vertices. Problem Statement : Compute the convex hull of n given points in the plane. There are two algorithms Gift Wrapping O(n 2 ) Graham's Scan O(nlogn)

CSE p1p1 p2p2 p3p3 p4p4 p5p5 p6p6 L

CSE Procedure Gift_Wrapping(p 1,p 2,... p n ) Input : p 1,p 2,... p n ( a set of points in the plane) Output : P (the convex hull of p 1,p 2,... p n ) 1. P  {0} or  ; 2. p  a point in the set with the largest x-coordinate; 3. Add p to P; 4. L  line containing p and parallel to the x-axis; 5. while  P  < n do 6. q  point such that the angle between the line -p-q- and L is minimal among all points; 7. add q to P; 8. L  line -p-q-; 9. p  q;

CSE Graham's Scan: Given a set of n points in the plane, ordered according to the algorithm Simple Polygon, we can find a convex path among the first k points whose corresponding convex polygon encloses the first k points. q m-1 p1p1 p k+1 qmqm

CSE Procedure Graham's Scan(p 1,p 2,... p n ) Input : p 1,p 2,... p n (a set of points in the plane) Output : q 1,q 2,... q n ( the convex hull of p 1,p 2,... p n ) p1  the point in the set with the largest x-coordinate (and smallest y-coordinate if there are more than one point with the same x-coordinate) Construct Simple Polygon and arrange points in order Let order be p 1,p 2,... p n q 1  p 1 ; q 2  p 2 ; q 3  p 3 ; (initially P consists of p 1,p 2,and p 3 ) m  3; for k  4 to n do while the angle between lines -q m-1 -q m - and -q m -p k -  180 o do m  m-1; m  m+1; q m  p k ; [Internal to the polygon]

CSE p1p1 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 q1:p1 q2:p2 q3:p3 m:3 p4p4 q1q1 q2q2 q3q3 p5p5 p6p6 p7p7 p8p8 -q2-q3- and -q3-p4- k =4 The angle is < 180

CSE q4q4 q1q1 q2 q3q3 p5p5 p6p6 p7p7 p8p8 q m :p4 m:4 -q3-q4- and -q4-p5- q4q4 q1q1 q2 q3q3 q5q5 p6p6 p7p7 p8p8 q m :p5 m:5 k =5 k=6

CSE Angle between -q4-q5- and -q5-p6- is greater than 180 Therefore m = m-1 = 4 We skip p5 Angle between -q3-q4- and -q4-p6- is greater than 180 Therefore m = m-1 = 3 We skip p4 q4q4 q1q1 q2 q3q3 q5q5 p6p6 p7p7 p8p8 k=6 -q3-q4- and -q4-p6- q1q1 q2 q3q3 p6p6 p7p7 p8p8 q4q4 k=6

CSE q1q1 q2 q3q3 p6p6 p7p7 p8p8 Angle between -q2-q3- and -q3-p6- is less than 180 Therefore m = m+1 = 4 and q4 = p6 k=6

CSE q1q1 q2 q3q3 q4q4 p7p7 p8p8 k=7 q1q1 q2 q3q3 q4q4 q5q5 p8p8 k=8

CSE q1q1 q2 q3q3 q4q4 q5q5 q6q6

CSE Procedure Graham's Scan(p 1,p 2,... p n ) Input : p 1,p 2,... p n (a set of points in the plane) Output : q 1,q 2,... q n ( the convex hull of p 1,p 2,... p n ) p1  the point in the set with the largest x-coordinate (and smallest y-coordinate if there are more than one point with the same x-coordinate) Construct Simple Polygon and arrange points in order Let order be p 1,p 2,... p n q 1  p 1 ; q 2  p 2 ; q 3  p 3 ; (initially P consists of p 1,p 2,and p 3 ) m  3; for k  4 to n do while the angle between lines -q m-1 -q m - and -q m -p k -  180 o do m  m-1; m  m+1; q m  p k ; [Internal to the polygon]

CSE Exercise Problems 1. Let P be a simple (not necessarily convex) polygon enclosed in a given rectangle R, and q be an arbitrary point inside R. Design an efficient algorithm to find a line segment connecting q to any point outside R such that the number of edge of P that this line intersects is minimum. 2. Let P be a set of n points in a plane. We define the depth of a point p in P as the number of convex hulls that need to be ‘peeled’ (removed) for p to become a vertex of the convex hull. Design an O(n 2 ) algorithm to find the depths of all points in P. 3. Given a set of n points in the plane P. A straight forward or brute force algorithm will take O(n 2 ) to compute a pair of closest points. Give an O(nlog 2 n) algorithm find a pair of closest points. You get a bonus if you can give an O(n log n) algorithm