Computational Geometry Algorithms

Slides:



Advertisements
Similar presentations
Computational Geometry The systematic study of algorithms and data structures for geometric objects, with a focus on exact algorithms that are asymptotically.
Advertisements

Computational Geometry - Part II Mohammed Nadeem Ahmed Raghavendra Kyatham.
algorithms and data structures
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.
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
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.
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.
What does that mean? To get the taste we will just look only at some sample problems... [Adapted from S.Suri]
Computational Geometry Piyush Kumar (Lecture 3: Convexity and Convex hulls) Welcome to CIS5930.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2007 Lecture 3 Chapter 3: 2D Convex Hulls Friday,
Convex Hull Computation ● Applications of Convex Hull Computation ● Definitions ● Basic Math Functions ● Algorithms Algorithm Speed Discovered By Brute.
Brute-Force Triangulation
Computational Geometry
Advanced Algorithm Design and Analysis (Lecture 9) SW5 fall 2004 Simonas Šaltenis E1-215b
ACM Schedule… 2/23 Geometry problems 3/2 Lab problems (geometry!) 3/30 "Mock" competition and lab session (4:15) 3/9 Final algorithm discussion… 3/16 [Spring.
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.
Part 6: Graphics Output Primitives (4) 1.  Another useful construct,besides points, straight line segments, and curves for describing components of a.
1 Computational Geometry Instructor: yedeshi
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.
Fundamental Data Structures and Algorithms Klaus Sutner April 27, 2004 Computational Geometry.
Fundamental Data Structures and Algorithms Margaret Reid-Miller 27 April 2004 Computational Geometry.
CMPS 3120: Computational Geometry Spring 2013
Vertices, Edges and Faces By Jordan Diamond. Vertices In geometry, a vertices is a special kind of point which describes the corners or intersections.
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.
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.
CLASSIFYING POLYGONS UNIT 1 LESSON 6. Classifying Polygons In geometry, a figure that lies in a plane is called a plane figure. A polygon is a closed.
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.
Convex Hulls Guo Qi, Chen Zhenghai, Wang Guanhua, Shen Shiqi, Himeshi De Silva.
Algorithms and Data Structures lecture C(hex) Computational geometry: planar rectangular range query, planar convex hull Szymon Grabowski
Introduction to Polygons
Convex Hull R.L. Graham’s Algorithm Computer Graphics.
Fill Area Algorithms Jan
Convex Hull.
Algorithms and Data Structures lecture C(hex) Computational geometry: planar rectangular range query, planar convex hull Szymon Grabowski
Copyright © The McGraw-Hill Companies, Inc
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
Computational Geometry (35/33)
Chapter 3 Image Slides Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Geometry.
Convex Sets & Concave Sets
Computational Geometry for the Tablet PC
Convex Hull 1/1/ :28 AM Convex Hull obstacle start end.
Assignment Pages: 10 – 12 (Day 1) Questions over Assignment? # 1 – 4
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
CHAPTER 33 Computational Geometry
CMPS 3130/6130: Computational Geometry Spring 2017
CMPS 3120: Computational Geometry Spring 2013
Copyright © The McGraw-Hill Companies, Inc
Convex Hull obstacle start end 4/30/2019 5:21 PM Convex Hull
CHAPTER 6 SKELETAL SYSTEM
Type to enter a caption. Computer Graphics Week 5 Lecture 1.
Geometry.
Computational Geometry
Convex Hull - most ubiquitous structure in computational geometry
Chapter 3 Introduction to Physical Design of Transportation Facilities.
Presentation transcript:

Computational Geometry Algorithms Week 10

Introduction Query 1: Do any of the lines intersect? Query 2: Is P0P1 clockwise or counterclockwise from P0P2? Query 3: What is the turning direction from P0P1 to P1P2 or if you traverse P0P1 and then P1P2, which direction do you turn? The input to a computational geometry problem is typically a description of a set of geometric objects, e.g., a set of points, a set of line segments, vertices of a polygon, etc. The output is often a response to a query about the object.

Real World Applications graphics robotics (e.g., path planning, object avoidance) VLSI design (e.g., component placement, packaging) statistics (e.g., nearest neighbor) simulations (e.g., moving particles) architecture (e.g., roof design) collision detection application read the Ghostbusters and Ghosts problem (33-3) on page 963 of your textbook . Ghost busters armed with proton pack shoots a stream at a ghost.

Copyright © The McGraw-Hill Companies, Inc Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright © The McGraw-Hill Companies, Inc Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Computing Cross Products Cross Product p1 (x1,y1) x p2 (x2,y2) = the determinant of the matrix = x1 y2 – x2 y1 P1 = (4, 0) p 2 = (2,4) P1 x p2 = 4.4 –2.0 = 16 If the cross product, p1 x p2, is positive then p1 is clockwise from p2. If the cross product, p1 x p2, is negative then p1 is counterclockwise from p2. A boundary condition arises if the cross product is 0, i.e., the vectors are pointing in the same or opposite directions (collinear

Computing Cross Products Example 1: p1 = (2,4) and p2 = (-2,-4), the cross product, p1 x p2, = 2.-4 - (-2.4) = -8 - (-8) = 0. Example 2: P1 = 4,5 P2 = 3,5 p3 = 5,3 p1 x p2 = X1Y2 - X2Y1 = 20 - 12 = +8 Therefore, p1 is clockwise from p2. p1 x p3 = X1Y3 - X3Y1 = 12 - 20 = -8 Therefore, p1 is counterclockwise from p3.

Computing Cross Products Query: whether consecutive line segments turn left or right If p1 x p2 > 0 then P1P3 turns left, i.e., p1 is clockwise from p3. If p1 x p2 < 0 then P1P2 turns right i.e., p1 is counterclockwise from p2.

Line Intersection Two lines segment intersect if and only if either of the following conditions hold: Each segment straddles the line containing the other. A segment P1P2 straddles a line if point p1 lies one side of the line and point p2 lies on the other side. 2. An end point of one segment lies on the other segment. P1 P4 P4 P1 P3 P3 P2 P2

Line Intersection Contd. Segment p3p4 straddles the line containing p1p2, but p1p2 does not straddle the line containing p3p4. p4 p1 p2 p3 Point P3 is collinear with p1p2, but is not between p1 and p2. The segments do not intersect. p4 p1 p3 p2

Copyright © The McGraw-Hill Companies, Inc Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright © The McGraw-Hill Companies, Inc Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Copyright © The McGraw-Hill Companies, Inc Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Finding the Convex Hull The convex hull, CH(Q), of a set Q of points is the smallest convex polygon P for which each point in Q is either on the boundary of P or in its interior Think of the points as pegs or nails sticking out of a board. The convex hull would be the shape formed by a tight string or rubber band being placed around the pegs so that all pegs are surrounded

Graham's Scan GRAHAM-SCAN(Q) Start with the lowest point p0 (Q(n)). Sort the remaining points based on the polar angle from p0 (Q(nlogn)). p1,p2,p3 … pn are the sorted points. Push (p0,S), Push(p1,S), Push(p2,S) for i = 3 to m while the angle formed by points NEXT-TO-TOP(S), TOP(S) and pi makes a non-left turn pop(S) push (pi,S) Return(S) Example: Text book Page 950 Time Complexity: (n logn)

Graham-Scan Example The sequence p1, p2, p3, .. P12 of points are numbered in increasing order of polar angles relative to p0. The initial stack containing p0, p1, p2.

Graham-Scan Example Contd. Stack S after each iteration of the for loop. Dashed lines show non-left turn which cause points to be popped from the stack.

Graham-Scan Example Contd. Stack S after each iteration of the for loop. Dashed lines show non-left turn which cause points to be popped from the stack.

Graham-Scan Example Contd.

Graham-Scan Example Contd.

Graham-Scan Example Contd. The convex hull returned by the procedure.

Jarvis' March Simulates wrapping a taut piece of paper around the set Q Start by taping the paper to the lowest point p0 Pull the paper to the right to make it taut (tight), you then pull it higher until the paper touches a point. This point must be a vertex on the convex hull Keeping the paper taut, you continue in this way around the set of vertices until you come back to the original point, p0. Time Complexity = (n h) h = number of vertices in CH. Faster than Graham’s Scan Figure 33.9 Page 956

Jarvis' March Jarvis-March(P) P = {p0, ..., pn-1} points p=p0, the lowest point while p not highest point find point pm with minimum polar angle from p add pm to convex hull p=pm while p!= p0

Example of Jarvis March The first vertex chosen is the lowest point p0. The next vertex, p1, has the smallest polar angle with respect to p0.Then P2 has the smallest polar angle with respect to p1. The right chain goes as high as the highest point p3. Then, the left chain is constructed by finding smallest polar angle with respect to negative x-axis. P3 P2 P4 P1 P0