Graduate Algorithms CS F-19 Computational Geometry

Size: px
Start display at page:

Download "Graduate Algorithms CS F-19 Computational Geometry"

Transcription

1 Graduate Algorithms CS F-19 Comutational Geometry David Galles Deartment of Comuter Science University of San Francisco

2 19-0: Cross Products Given any two oints 1 = (x 1,y 1 ) and = (x,y ) Cross Product: 1 = x 1 y x y 1 1 = x 1 y x y 1 = 1 (x y 1 x 1 y ) = 1

3 19-1: Cross Products Cross Product 1 as Signed Area Area is ositive if 1 is below Area is negative if 1 is above

4 19-: Cross Products Given two vectors that share an origin: 0 1 and 0 Is 0 clockwise or counterclockwise relative to 0?

5 19-3: Cross Products Counterclockwise 0 Clockwise

6 19-4: Cross Products Given two vectors that share an origin: 0 1 and 0 Is 0 clockwise or counterclockwise relative to 0? ( 1 0 ) ( 0 ) is ositive, 0 is counterclockwise from 0 1

7 19-5: Cross Products Given two line segments 0 1 and 1, which direction does angle 0 1 turn? Left Turn Right Turn

8 19-6: Cross Products Given two line segments 0 1 and 1, which direction does angle 0 1 turn? ( 0 ) ( 1 0 ) is ositive, left turn ( 0 ) ( 1 0 ) is negative, right turn ( 0 ) ( 1 0 ) is zero, no turn (colinear)

9 19-7: Line Segment Intersection Given two line segments 1 and 3 4, do they intersect? How could we determine this?

10 19-8: Line Segment Intersection Given two line segments 1 and 3 4, do they intersect? Each segment straddles the line containing the other An endoint of one segment lies on the other segment

11 19-9: Line Segment Intersection and 4 straddle line defined by 1 and 1 and straddle line defined by 3 and 4

12 19-10: Line Segment Intersection and 4 straddle line defined by 1 and 1 and do not straddle line defined by 3 and 4

13 19-11: Line Segment Intersection and 4 do not straddle line defined by 1 and 1 and do not straddle line defined by 3 and 4

14 19-1: Line Segment Intersection 3 4 1

15 19-13: Line Segment Intersection Counterclockwise Clockwise

16 19-14: Line Segment Intersection Clockwise Clockwise

17 19-15: Line Segment Intersection 3 and 4 straddle line define by 1 and if: 1 3 is counterclockwise of 1 and 1 4 is clockwise of 1 ( 1 ) ( 3 1 ) > 0 and ( 1 ) ( 4 1 ) < is clockwise of 1 and 1 4 is counterclockwise of 1 ( 1 ) ( 3 1 ) < 0 and ( 1 ) ( 4 1 ) > 0

18 19-16: Line Segment Intersection How can we determine if 3 is on the segment 1?

19 19-17: Line Segment Intersection How can we determine if 3 is on the segment 1? 3 is on the line defined by 1 and 3 is in the roer range along that line

20 19-18: Line Segment Intersection 3 1

21 19-19: Line Segment Intersection 3 1

22 19-0: Line Segment Intersection How can we determine if 3 is on the segment 1? 3 is on the line defined by 1 and ( 1 ) ( 3 1 ) = 0 3 is in the roer range along that line 3 x 1 x&& 3 x x or 3 x 1 x&& 3 x x 3 y 1 y&& 3 y y or 3 y 1 y&& 3 y y

23 19-1: Line Segment Intersection Given a set of n line segments, do any of them intersect? What is a brute force method for solving this roblem? How long does it take (if there are n total line segments)

24 19-: Line Segment Intersection Given a set of n line segments, do any of them intersect? What is a brute force method for solving this roblem? Check each air of line segments, see if they intersect using the revious technique How long does it take (if there are n total line segments) Each of the n segments needs to be comarted to n 1 other segments, for a total time of O(n ) We can do better!

25 19-3: Line Segment Intersection Basic idea: Assume that there are no vertical line segments Swee a vertical line across the segments Segment A is above segment B at the line, and as we move the line to the right, Segment B becomes above Segment A, then the segments have crossed

26 19-4: Line Segment Intersection Segment A Segment B Segment B is above Segment A

27 19-5: Line Segment Intersection Segment A Segment B Segment A is above Segment B The two segments must have crossed

28 19-6: Line Segment Intersection Maintain an ordered list of the segments that intersect with the current swee line Whenever two segments become adjacent on this list, check to see if they intersect Only need to check endoints of segments

29 19-7: Line Segment Intersection Maintian a data structure that lets us: Insert a segment s into T Delete a segment s from T Find the segment above s in T Find the segment below s in T Use a red-black tree, using cross roducts to see if segment 1 is above segment at a certain oint

30 19-8: Line Segment Intersection Sort endoints of segments from left to right Break ties: Left endoints before right endoints lowest y-coordinate first for each oint in endoint list if is the left endoint of a segment s Insert s into T if there is a segment above s in T that intersects s or a segment below s in T that intersects s return true if is the right endoint of a segment s if there is a segment above s and below s in T and these segments intersect return true Delete s from T return false

31 19-9: Convex Hull a b d c a a b a b c a b d c

32 19-30: Convex Hull a b c e d a a b a b c a b c d a b e c d a e c d a e d a d

33 19-31: Convex Hull Given a set of oints, what is the smallest convex olygon that contains all oints Alternately, if all of the oints were nails in a board, and we laced a rubber band around all of them, what shae would it form?

34 19-3: Convex Hull

35 19-33: Convex Hull

36 19-34: Convex Hull Several comutational geometry roblems have finding the convex hull as a subroblem Like many grah algorithms have finding a toological sort as a subroblem For instance: Finding the two furthest oints Must lie on the convex hull

37 19-35: Convex Hull Graham s Scan Algorithm Go through all the oints in order Push oints onto a stack Po off oints that don t form art of the convex hull When we re done, stack contains the oints in the convex hull

38 19-36: Convex Hull Gram-Scan Let 0 be the oint with the minimum y-coordinate Sort the oints by increasing olar angle around 0 Push 0, 1, and on the stack S for i 3 to n do while angle formed by to two oints on S doesn t turn left do Po Push( i ) return S

39 19-37: Graham s Scan

40 19-38: Graham s Scan

41 19-39: Graham s Scan Stack

42 19-40: Graham s Scan Stack

43 19-41: Graham s Scan Stack

44 19-4: Graham s Scan Stack

45 19-43: Graham s Scan Stack

46 19-44: Graham s Scan Stack

47 19-45: Graham s Scan Stack

48 19-46: Graham s Scan Stack

49 19-47: Graham s Scan Stack

50 19-48: Graham s Scan Stack

51 19-49: Graham s Scan Stack

52 19-50: Graham s Scan Stack

53 19-51: Graham s Scan Stack

54 19-5: Graham s Scan Stack

55 19-53: Graham s Scan Stack

56 19-54: Graham s Scan Stack

57 19-55: Graham s Scan Stack

58 19-56: Graham s Scan Stack

59 19-57: Graham s Scan Time required: O(nlgn) to sort oints by olar degree Note that you don t need to calculate the olar degree, just determine if one vector is clockwise or counterclockwise of another can be done with a single cross roduct Each element is added to the stack once, and removed at most once (each taking constant time) for a total time of O(n) Total: O(nlgn)

60 19-58: Convex Hull Different Convex Hull algorithm Idea: Attach a string to the lowest oint Rotate string counterclockwise, unti it hits a oint this oint is in the Convex Hull Kee going until the highest oint is reached Continue around back to initial oint

61 19-59: Jarvis s March

62 19-60: Jarvis s March

63 19-61: Jarvis s March

64 19-6: Jarvis s March

65 19-63: Jarvis s March

66 19-64: Jarvis s March

67 19-65: Jarvis s March

68 19-66: Jarvis s March

69 19-67: Jarvis s March

70 19-68: Jarvis s March

71 19-69: Jarvis s March

72 19-70: Jarvis s March How do we determine which oint wras next? When we re going from lowest to highest oint, the smallest olar angle between revious oint and the next oint When going from highest oint back to lowest oint, smallest olar angle (from negative)

73 19-71: Jarvis s March

74 19-7: Jarvis s March

75 19-73: Jarvis s March

76 19-74: Jarvis s March

77 19-75: Jarvis s March

78 19-76: Jarvis s March

79 19-77: Jarvis s March

80 19-78: Jarvis s March

81 19-79: Jarvis s March

82 19-80: Jarvis s March We don t need to actually comute olar angles We just need to comare them, which can be done with a cross roduct From oint k, comaring angles from i and j (going u) Is k i clockwise of k j? (is ( i k ) ( j k ) ositive)?

83 19-81: Jarvis s March Time for Jarvis s march: For each vertex in the convex hull, we need to look at u to n other vertices to find the next vertex in the convex hull. Total time: O(nh), where h is the number of vertices in the convex hull Is this better or worst than Graham s Scan

84 19-8: Closest Pair of Points We have a large number of oints 1,..., n Want to determine which air of oints i, j is closest together How long would a brute force solution take? Can you think of another way?

85 19-83: Closest Pair of Points Divide & Conquer Divide the list oints in half (by a vertical line) Recursively determine the closest air in each half... and then what?

86 19-84: Closest Pair of Points Divide & Conquer Divide the list oints in half (by a vertical line) Recursively determine the closest air in each half Smallest distance between oints is the minimum of: Smallest distance in left half of oints Smallest distance in right half of oints Smallest distance that crosses from left to right

87 19-85: Closest Pair of Points

88 19-86: Closest Pair of Points

89 19-87: Closest Pair of Points To find smallest distance that crosses from left to right: If we comare all n elements in the left sublist with all n elements in the right sublist, how much time would that take?

90 19-88: Closest Pair of Points To find smallest distance that crosses from left to right: If we comare all n elements in the left sublist with all n elements in the right sublist, how much time would that take? Θ(n ), no better than brute force solution!

91 19-89: Closest Pair of Points To find smallest distance that crosses from left to right: Letδ be the smallest distance in the two sublists Examine only the oints that are within δ of the centerline

92 19-90: Closest Pair of Points

93 19-91: Closest Pair of Points δ δ

94 19-9: Closest Pair of Points δ δ

95 19-93: Closest Pair of Points δ δ

96 19-94: Closest Pair of Points δ δ

97 19-95: Closest Pair of Points How many oints can be in the δ δ rectangle? δ δ

98 19-96: Closest Pair of Points How many oints can be in the δ δ rectangle? δ δ

99 19-97: Closest Pair of Points Create two lists of the oints: One sorted by x-coordiate One sorted by y-coordinate Call Find-Smallest using these two lists Find-Smallest(XList,YList)

100 19-98: Closest Pair of Points FindSmallest(L x,l y ) if L x 3 do brute force search on 3 oints Slit list L x in half Put first 1/ in L XL Put second 1/ in L XR Slit list L Y in half For each oint in L y : If L XL, ut in L YL If L XR, ut in L YR δ FindSmallest(L XL,L YL ) δ Min(δ, FindSmallest(L XR,L YR )) δ FindSmallestAcross(L YR,L YR,δ) return δ

101 19-99: Closest Pair of Points Time: Sorting: O(n lg n) using mergesort Recursive call: T(1) = T() = T(3) = c 1 T(n) = T(n/)+c n Θ(nlgn) by the Master Method Total time: O(n lg n)

Cross products. p 2 p. p p1 p2. p 1. Line segments The convex combination of two distinct points p1 ( x1, such that for some real number with 0 1,

Cross products. p 2 p. p p1 p2. p 1. Line segments The convex combination of two distinct points p1 ( x1, such that for some real number with 0 1, CHAPTER 33 Comutational Geometry Is the branch of comuter science that studies algorithms for solving geometric roblems. Has alications in many fields, including comuter grahics robotics, VLSI design comuter

More information

Cross products Line segments The convex combination of two distinct points p

Cross products Line segments The convex combination of two distinct points p CHAPTER Comutational Geometry Is the branch of comuter science that studies algorithms for solving geometric roblems. Has alications in many fields, including comuter grahics robotics, VLSI design comuter

More information

COT5405: GEOMETRIC ALGORITHMS

COT5405: GEOMETRIC ALGORITHMS COT5405: GEOMETRIC ALGORITHMS Objects: Points in, Segments, Lines, Circles, Triangles Polygons, Polyhedra R n Alications Vision, Grahics, Visualizations, Databases, Data mining, Networks, GIS Scientific

More information

Computational geometry

Computational geometry Computational geometry Inge Li Gørtz CLRS Chapter 33.0, 33.1, 33.3. Computational Geometry Geometric problems (this course Euclidean plane). Does a set of line segments intersect, dividing plane into regions,

More information

Convex Hulls. Helen Cameron. Helen Cameron Convex Hulls 1/101

Convex Hulls. Helen Cameron. Helen Cameron Convex Hulls 1/101 Convex Hulls Helen Cameron Helen Cameron Convex Hulls 1/101 What Is a Convex Hull? Starting Point: Points in 2D y x Helen Cameron Convex Hulls 3/101 Convex Hull: Informally Imagine that the x, y-lane is

More information

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8 CS 410/584,, Computational Geometry Algorithms for manipulation of geometric objects We will concentrate on 2-D geometry Numerically robust try to avoid division Round-off error Divide-by-0 checks Techniques

More information

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8!

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8! CS 410/584, Algorithm Design & Analysis, Computational Geometry! Algorithms for manipulation of geometric objects We will concentrate on 2-D geometry Numerically robust try to avoid division Round-off

More information

CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk

CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk 8/29/06 CS 6463: AT Computational Geometry 1 Convex Hull Problem Given a set of pins on a pinboard and a rubber band around them.

More information

CSE 5311 Notes 13: Computational Geometry

CSE 5311 Notes 13: Computational Geometry CSE 5311 Notes 13: Computational Geometry (Last updated 4/17/17 4:39 PM) SMALLEST ENCLOSING DISK See section 4.7 of de Berg ( http://dx.doi.org.ezproxy.uta.edu/10.1007/978-3-540-77974-2 ) Algorithm MINIDISC(P)

More information

Convex Hull Algorithms

Convex Hull Algorithms Convex Hull Algorithms Design and Analysis of Algorithms prof. F. Malucelli Villa Andrea e Ceriani Simone Outline Problem Definition Basic Concepts Bruteforce Algorithm Graham Scan Algorithm Divide and

More information

Computational Geometry 2D Convex Hulls. Joseph S. B. Mitchell Stony Brook University

Computational Geometry 2D Convex Hulls. Joseph S. B. Mitchell Stony Brook University Computational Geometry 2D Convex Hulls Joseph S. B. Mitchell Stony Brook University Comparing O(n), O(n log n), O(n 2 ) n n log n n² 2 10 10³ 10 2 10 10 4 2 20 10 6 2 20 10 6 20 2 20 2 10 7 2 40 10 12

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms CS245-2015S-10 Sorting David Galles Department of Computer Science University of San Francisco 10-0: Main Memory Sorting All data elements can be stored in memory at the

More information

5.4 Closest Pair of Points

5.4 Closest Pair of Points 5.4 Closest Pair of Points Closest pair. Given n points in the plane, find a pair with smallest Euclidean distance between them. Fundamental geometric primitive. Graphics, computer vision, geographic information

More information

Last time. Today: Convex Hull Brute Force Inside(q,abc) Intersect(ab,cd) Orient(a,b,c).

Last time. Today: Convex Hull Brute Force Inside(q,abc) Intersect(ab,cd) Orient(a,b,c). Last time Convex Hull Brute Force Inside(q,abc) Intersect(ab,cd) Orient(a,b,c). Today: More efficient convex hull algorithms and absolute bounds. Two (of many) algorithms. One (of one) interesting reduction.

More information

Advanced Algorithm Homework 4 Results and Solutions

Advanced Algorithm Homework 4 Results and Solutions Advanced Algorithm Homework 4 Results and Solutions ID 1 2 3 4 5 Av Ex 2554 6288 9919 10 6 10 10 9.5 8.9 10-1 4208 10 10 9 8.5 10 9.5 9 0996 10 10 10 10 10 10 10 8239 10 10 10 10 10 10 10 7388 8 8.5 9

More information

Geometric Algorithms. 1. Objects

Geometric Algorithms. 1. Objects Geometric Algorithms 1. Definitions 2. Line-Segment properties 3. Inner Points of polygons 4. Simple polygons 5. Convex hulls 6. Closest pair of points 7. Diameter of a point set 1. Objects 2-dimensional

More information

Plan for Today. Finish recurrences. Inversion Counting. Closest Pair of Points

Plan for Today. Finish recurrences. Inversion Counting. Closest Pair of Points Plan for Today Finish recurrences Inversion Counting Closest Pair of Points Divide and Conquer Divide-and-conquer. Divide problem into several parts. Solve each part recursively. Combine solutions to sub-problems

More information

Lecture 3: Geometric Algorithms(Convex sets, Divide & Conquer Algo.)

Lecture 3: Geometric Algorithms(Convex sets, Divide & Conquer Algo.) Advanced Algorithms Fall 2015 Lecture 3: Geometric Algorithms(Convex sets, Divide & Conuer Algo.) Faculty: K.R. Chowdhary : Professor of CS Disclaimer: These notes have not been subjected to the usual

More information

Stacks API and finding the convex hull. CS Spring 2017

Stacks API and finding the convex hull. CS Spring 2017 Stacks API and finding the convex hull CS 146 - Spring 2017 Today Collision detection Convex hull Graham scan algorithm DFS traversal The stack API push() pop()

More information

3D convex hulls. Computational Geometry [csci 3250] Laura Toma Bowdoin College

3D convex hulls. Computational Geometry [csci 3250] Laura Toma Bowdoin College 3D convex hulls Computational Geometry [csci 3250] Laura Toma Bowdoin College Convex Hulls The problem: Given a set P of points, compute their convex hull 2D 3D 2D 3D polygon polyhedron Polyhedron region

More information

CS4733 Class Notes. 1 2-D Robot Motion Planning Algorithm Using Grown Obstacles

CS4733 Class Notes. 1 2-D Robot Motion Planning Algorithm Using Grown Obstacles CS4733 Class Notes 1 2-D Robot Motion Planning Algorithm Using Grown Obstacles Reference: An Algorithm for Planning Collision Free Paths Among Poyhedral Obstacles by T. Lozano-Perez and M. Wesley. This

More information

The convex hull 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.

The convex hull 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. CS 312, Winter 2007 Project #1: Convex Hull Due Dates: See class schedule Overview: In this project, you will implement a divide and conquer algorithm for finding the convex hull of a set of points and

More information

Computational Geometry Overview from Cormen, et al.

Computational Geometry Overview from Cormen, et al. UMass Lowell Computer Science 91.503 Graduate Algorithms Prof. Karen Daniels Spring, 2014 Computational Geometry Overview from Cormen, et al. Chapter 33 (with additional material from other sources) 1

More information

Geometric Dilation. A polygonal chain C. detour of C on the pair (p, q): where C q p the path on C connecting p and q. detour of C

Geometric Dilation. A polygonal chain C. detour of C on the pair (p, q): where C q p the path on C connecting p and q. detour of C Geometric Dilation A olygonal chain C detour of C on the air (, ): δ(, ) = C, where C the ath on C connecting and. detour of C δ C = max, C δ(, ). More general: A connected lanar grah G(V, E) Gemetric

More information

Computational Geometry. HKU ACM ICPC Training 2010

Computational Geometry. HKU ACM ICPC Training 2010 Computational Geometry HKU ACM ICPC Training 2010 1 What is Computational Geometry? Deals with geometrical structures Points, lines, line segments, vectors, planes, etc. A relatively boring class of problems

More information

CSE 421 Closest Pair of Points, Master Theorem, Integer Multiplication

CSE 421 Closest Pair of Points, Master Theorem, Integer Multiplication CSE 421 Closest Pair of Points, Master Theorem, Integer Multiplication Shayan Oveis Gharan 1 Finding the Closest Pair of Points Closest Pair of Points (non geometric) Given n points and arbitrary distances

More information

Voronoi Diagram and Convex Hull

Voronoi Diagram and Convex Hull Voronoi Diagram and Convex Hull The basic concept of Voronoi Diagram and Convex Hull along with their properties and applications are briefly explained in this chapter. A few common algorithms for generating

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 13 Divide and Conquer Closest Pair of Points Convex Hull Strassen Matrix Mult. Adam Smith 9/24/2008 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova,

More information

Constrained Empty-Rectangle Delaunay Graphs

Constrained Empty-Rectangle Delaunay Graphs CCCG 2015, Kingston, Ontario, August 10 12, 2015 Constrained Emty-Rectangle Delaunay Grahs Prosenjit Bose Jean-Lou De Carufel André van Renssen Abstract Given an arbitrary convex shae C, a set P of oints

More information

Computational Geometry 2D Convex Hulls

Computational Geometry 2D Convex Hulls Computational Geometry 2D Convex Hulls Joseph S. B. Mitchell Stony Brook University Chapter 2: Devadoss-O Rourke Convexity p p Set X is convex if p,q X pq X q q convex non-convex Point p X is an extreme

More information

Planar convex hulls (I) Computational Geometry [csci 3250] Laura Toma Bowdoin College

Planar convex hulls (I) Computational Geometry [csci 3250] Laura Toma Bowdoin College Planar convex hulls (I) Computational Geometry [csci 3250] Laura Toma Bowdoin College Convex Hull Given a set P of points in 2D, their convex hull is the smallest convex polygon that contains all points

More information

Computational Geometry. Algorithm Design (10) Computational Geometry. Convex Hull. Areas in Computational Geometry

Computational Geometry. Algorithm Design (10) Computational Geometry. Convex Hull. Areas in Computational Geometry Computational Geometry Algorithm Design (10) Computational Geometry Graduate School of Engineering Takashi Chikayama Algorithms formulated as geometry problems Broad application areas Computer Graphics,

More information

CSCE 411 Design and Analysis of Algorithms

CSCE 411 Design and Analysis of Algorithms CSCE 411 Design and Analysis of Algorithms Set 3: Divide and Conquer Slides by Prof. Jennifer Welch Spring 2014 CSCE 411, Spring 2014: Set 3 1 General Idea of Divide & Conquer 1. Take your problem and

More information

Prof. Gill Barequet. Center for Graphics and Geometric Computing, Technion. Dept. of Computer Science The Technion Haifa, Israel

Prof. Gill Barequet. Center for Graphics and Geometric Computing, Technion. Dept. of Computer Science The Technion Haifa, Israel Computational Geometry (CS 236719) http://www.cs.tufts.edu/~barequet/teaching/cg Chapter 1 Introduction 1 Copyright 2002-2009 2009 Prof. Gill Barequet Center for Graphics and Geometric Computing Dept.

More information

Computational Geometry

Computational Geometry Lecture 1: Introduction and convex hulls Geometry: points, lines,... Geometric objects Geometric relations Combinatorial complexity Computational geometry Plane (two-dimensional), R 2 Space (three-dimensional),

More information

Divide-and-Conquer. The most-well known algorithm design strategy: smaller instances. combining these solutions

Divide-and-Conquer. The most-well known algorithm design strategy: smaller instances. combining these solutions Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances recursively 3. Obtain solution to original

More information

Polygon Triangulation

Polygon Triangulation If triangles had a god, they would give him three sides. Charles Louis de Secondat Montesquie (1721) Down with Euclid! Death to triangles! Jean Dieudonné (1959) P Polygon Triangulation P.1 Introduction

More information

CSC Design and Analysis of Algorithms

CSC Design and Analysis of Algorithms CSC 8301- Design and Analysis of Algorithms Lecture 6 Divide and Conquer Algorithm Design Technique Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide a problem instance into two

More information

CS 373: Combinatorial Algorithms, Fall Name: Net ID: Alias: U 3 / 4 1

CS 373: Combinatorial Algorithms, Fall Name: Net ID: Alias: U 3 / 4 1 CS 373: Combinatorial Algorithms, Fall 2000 Homework 1 (due November 16, 2000 at midnight) Starting with Homework 1, homeworks may be done in teams of up to three people. Each team turns in just one solution,

More information

CSC Design and Analysis of Algorithms. Lecture 6. Divide and Conquer Algorithm Design Technique. Divide-and-Conquer

CSC Design and Analysis of Algorithms. Lecture 6. Divide and Conquer Algorithm Design Technique. Divide-and-Conquer CSC 8301- Design and Analysis of Algorithms Lecture 6 Divide and Conquer Algorithm Design Technique Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide a problem instance into two

More information

3D convex hulls. Computational Geometry [csci 3250] Laura Toma Bowdoin College

3D convex hulls. Computational Geometry [csci 3250] Laura Toma Bowdoin College 3D convex hulls Computational Geometry [csci 3250] Laura Toma Bowdoin College Convex Hull in 3D The problem: Given a set P of points in 3D, compute their convex hull convex polyhedron 2D 3D polygon

More information

Visibility Graph. How does a Mobile Robot get from A to B?

Visibility Graph. How does a Mobile Robot get from A to B? Robot Path Planning Things to Consider: Spatial reasoning/understanding: robots can have many dimensions in space, obstacles can be complicated Global Planning: Do we know the environment apriori? Online

More information

Advanced Algorithms Computational Geometry Prof. Karen Daniels. Spring, 2010

Advanced Algorithms Computational Geometry Prof. Karen Daniels. Spring, 2010 UMass Lowell Computer Science 91.504 Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010 Lecture 3 O Rourke Chapter 3: 2D Convex Hulls Thursday, 2/18/10 Chapter 3 2D Convex Hulls

More information

Geometry. Zachary Friggstad. Programming Club Meeting

Geometry. Zachary Friggstad. Programming Club Meeting Geometry Zachary Friggstad Programming Club Meeting Points #i n c l u d e typedef complex p o i n t ; p o i n t p ( 1. 0, 5. 7 ) ; p. r e a l ( ) ; // x component p. imag ( ) ; // y component

More information

CS 532: 3D Computer Vision 14 th Set of Notes

CS 532: 3D Computer Vision 14 th Set of Notes 1 CS 532: 3D Computer Vision 14 th Set of Notes Instructor: Philippos Mordohai Webpage: www.cs.stevens.edu/~mordohai E-mail: Philippos.Mordohai@stevens.edu Office: Lieb 215 Lecture Outline Triangulating

More information

MA/CSSE 473 Day 17. Divide-and-conquer Convex Hull. Strassen's Algorithm: Matrix Multiplication. (if time, Shell's Sort)

MA/CSSE 473 Day 17. Divide-and-conquer Convex Hull. Strassen's Algorithm: Matrix Multiplication. (if time, Shell's Sort) MA/CSSE 473 Day 17 Divide-and-conquer Convex Hull Strassen's Algorithm: Matrix Multiplication (if time, Shell's Sort) MA/CSSE 473 Day 17 Student Questions Exam 2 specification Levitin 3 rd Edition Closest

More information

521493S Computer Graphics Exercise 3 (Chapters 6-8)

521493S Computer Graphics Exercise 3 (Chapters 6-8) 521493S Comuter Grahics Exercise 3 (Chaters 6-8) 1 Most grahics systems and APIs use the simle lighting and reflection models that we introduced for olygon rendering Describe the ways in which each of

More information

Lecture 4: Geometric Algorithms (Convex Hull, Voronoi diagrams)

Lecture 4: Geometric Algorithms (Convex Hull, Voronoi diagrams) Advanced Algorithms Fall 2015 Lecture 4: Geometric Algorithms (Convex Hull, Voronoi diagrams) Faculty: K.R. Chowdhary : Professor of CS Disclaimer: These notes have not been subjected to the usual scrutiny

More information

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute Module 07 Lecture - 38 Divide and Conquer: Closest Pair of Points We now look at another divide and conquer algorithm,

More information

Parallel Convex Hull using MPI. CSE633 Fall 2012 Alex Vertlieb

Parallel Convex Hull using MPI. CSE633 Fall 2012 Alex Vertlieb Parallel Convex Hull using MPI CSE633 Fall 2012 Alex Vertlieb What is a Convex Polygon? Convex Not Convex If you can draw a straight line from one point in the polygon to another and have the line exit

More information

CS S-11 Sorting in Θ(nlgn) 1. Base Case: A list of length 1 or length 0 is already sorted. Recursive Case:

CS S-11 Sorting in Θ(nlgn) 1. Base Case: A list of length 1 or length 0 is already sorted. Recursive Case: CS245-2015S-11 Sorting in Θ(nlgn) 1 11-0: Merge Sort Recursive Sorting Base Case: A list of length 1 or length 0 is already sorted Recursive Case: Split the list in half Recursively sort two halves Merge

More information

1/60. Geometric Algorithms. Lecture 1: Introduction. Convex Hulls

1/60. Geometric Algorithms. Lecture 1: Introduction. Convex Hulls 1/60 Geometric Algorithms Lecture 1: Introduction Convex Hulls Geometric algorithms scope 2/60 Geometry algorithms (practice): Study of geometric problems that arise in various applications and how algorithms

More information

CS Data Structures and Algorithm Analysis

CS Data Structures and Algorithm Analysis CS 483 - Data Structures and Algorithm Analysis Lecture VI: Chapter 5, part 2; Chapter 6, part 1 R. Paul Wiegand George Mason University, Department of Computer Science March 8, 2006 Outline 1 Topological

More information

Computational Geometry. Geometry Cross Product Convex Hull Problem Sweep Line Algorithm

Computational Geometry. Geometry Cross Product Convex Hull Problem Sweep Line Algorithm GEOMETRY COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Computational

More information

Computational Geometry TOPICS Preliminaries Point in a Polygon Polygon Construction Convex Hulls

Computational Geometry TOPICS Preliminaries Point in a Polygon Polygon Construction Convex Hulls Computational Geometry TOPICS Preliminaries Point in a Polygon Polygon Construction Convex Hulls CSE5311 Kumar 1 Geometric Algorithms Geometric Algorithms find applications in such areas as Computer Graphics

More information

Spring 2016 Algorithms Midterm Exam (Show your work to get full credit!)

Spring 2016 Algorithms Midterm Exam (Show your work to get full credit!) Spring 2016 Algorithms Midterm Exam (Show your work to get full credit!) March 18, 2016 "Plagiarism is the intentional or unintentional use of the words or ideas of another without acknowledging their

More information

Range Searching. Data structure for a set of objects (points, rectangles, polygons) for efficient range queries.

Range Searching. Data structure for a set of objects (points, rectangles, polygons) for efficient range queries. Range Searching Data structure for a set of objects (oints, rectangles, olygons) for efficient range queries. Y Q Deends on tye of objects and queries. Consider basic data structures with broad alicability.

More information

Advanced Algorithms. Problem solving Techniques. Divide and Conquer הפרד ומשול

Advanced Algorithms. Problem solving Techniques. Divide and Conquer הפרד ומשול Advanced Algorithms Problem solving Techniques. Divide and Conquer הפרד ומשול 1 Divide and Conquer A method of designing algorithms that (informally) proceeds as follows: Given an instance of the problem

More information

Lecture 7: Computational Geometry

Lecture 7: Computational Geometry Lecture 7: Computational Geometry CS 491 CAP Uttam Thakore Friday, October 7 th, 2016 Credit for many of the slides on solving geometry problems goes to the Stanford CS 97SI course lecture on computational

More information

2-D Geometry for Programming Contests 1

2-D Geometry for Programming Contests 1 2-D Geometry for Programming Contests 1 1 Vectors A vector is defined by a direction and a magnitude. In the case of 2-D geometry, a vector can be represented as a point A = (x, y), representing the vector

More information

We will then introduce the DT, discuss some of its fundamental properties and show how to compute a DT directly from a given set of points.

We will then introduce the DT, discuss some of its fundamental properties and show how to compute a DT directly from a given set of points. Voronoi Diagram and Delaunay Triangulation 1 Introduction The Voronoi Diagram (VD, for short) is a ubiquitious structure that aears in a variety of discilines - biology, geograhy, ecology, crystallograhy,

More information

Figure 2.1: An example of a convex set and a nonconvex one.

Figure 2.1: An example of a convex set and a nonconvex one. Convex Hulls 2.1 Definitions 2 Convexity is the key to understanding and simplifying geometry, and the convex hull plays a role in geometry akin to the sorted order for a collection of numbers. So what

More information

5. DIVIDE AND CONQUER I

5. DIVIDE AND CONQUER I 5. DIVIDE AND CONQUER I mergesort counting inversions closest pair of points randomized quicksort median and selection Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013

More information

Ch5. Divide-and-Conquer

Ch5. Divide-and-Conquer Ch5. Divide-and-Conquer 1 5.1 Mergesort Sorting Sorting. Given n elements, rearrange in ascending order. Applications. Sort a list of names. Organize an MP3 library. obvious applications Display Google

More information

CSE 546, Fall, 2016 Homework 1

CSE 546, Fall, 2016 Homework 1 CSE 546, Fall, 2016 Homework 1 Due at the beginning of class Thursday, Sept. 15 at 2:30pm. Accepted without penalty until Friday, noon, in my mailbox in the Dept. office, third floor of Jolley. Notes about

More information

CSS 503 Program 1: Parallelizing a Convex-Hull Program with Multi-Processes Professor: Munehiro Fukuda Due date: see the syllabus

CSS 503 Program 1: Parallelizing a Convex-Hull Program with Multi-Processes Professor: Munehiro Fukuda Due date: see the syllabus CSS 503 Program 1: Parallelizing a Convex-Hull Program with Multi-Processes Professor: Munehiro Fukuda Due date: see the syllabus 1. Purpose In this programming assignment, we will parallelize a convex

More information

Computational Geometry

Computational Geometry Computational Geometry Range queries Convex hulls Lower bounds Planar subdivision search Line segment intersection Convex polygons Voronoi diagrams Minimum spanning trees Nearest neighbors Triangulations

More information

Hidden-Surface Removal.

Hidden-Surface Removal. Hidden-Surface emoval. Here we need to discover whether an object is visible or another one obscures it. here are two fundamental approaches to remove the hidden surfaces: ) he object-space approach )

More information

Last time: Disparity. Lecture 11: Stereo II. Last time: Triangulation. Last time: Multi-view geometry. Last time: Epipolar geometry

Last time: Disparity. Lecture 11: Stereo II. Last time: Triangulation. Last time: Multi-view geometry. Last time: Epipolar geometry Last time: Disarity Lecture 11: Stereo II Thursday, Oct 4 CS 378/395T Prof. Kristen Grauman Disarity: difference in retinal osition of same item Case of stereo rig for arallel image lanes and calibrated

More information

Chapter 4. Divide-and-Conquer. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Chapter 4. Divide-and-Conquer. Copyright 2007 Pearson Addison-Wesley. All rights reserved. Chapter 4 Divide-and-Conquer Copyright 2007 Pearson Addison-Wesley. All rights reserved. Divide-and-Conquer The most-well known algorithm design strategy: 2. Divide instance of problem into two or more

More information

Closest Pair of Points. Cormen et.al 33.4

Closest Pair of Points. Cormen et.al 33.4 Closest Pair of Points Cormen et.al 33.4 Closest Pair of Points Closest pair. Given n points in the plane, find a pair with smallest Euclidean distance between them. Fundamental geometric problem. Graphics,

More information

A 0 A 1... A i 1 A i,..., A min,..., A n 1 in their final positions the last n i elements After n 1 passes, the list is sorted.

A 0 A 1... A i 1 A i,..., A min,..., A n 1 in their final positions the last n i elements After n 1 passes, the list is sorted. CS6402 Design and Analysis of Algorithms _ Unit II 2.1 UNIT II BRUTE FORCE AND DIVIDE-AND-CONQUER 2.1 BRUTE FORCE Brute force is a straightforward approach to solving a problem, usually directly based

More information

CSE 512 Course Project Operation Requirements

CSE 512 Course Project Operation Requirements CSE 512 Course Project Operation Requirements 1. Operation Checklist 1) Geometry union 2) Geometry convex hull 3) Geometry farthest pair 4) Geometry closest pair 5) Spatial range query 6) Spatial join

More information

Optics Alignment. Abstract

Optics Alignment. Abstract Otics Alignment Yi Qiang Duke University, Durham, NC 27708 Xiaohui Zhan Massachusetts Institute of Technology, Cambridge, MA 02139 (Dated: July 9, 2010) Abstract yqiang@jlab.org zhanxh@jlab.org 1 I. INTRODUCTION

More information

Lecture 2: Fixed-Radius Near Neighbors and Geometric Basics

Lecture 2: Fixed-Radius Near Neighbors and Geometric Basics structure arises in many alications of geometry. The dual structure, called a Delaunay triangulation also has many interesting roerties. Figure 3: Voronoi diagram and Delaunay triangulation. Search: Geometric

More information

Chapter 2: Divide and Conquer

Chapter 2: Divide and Conquer Chapter : Divide and Conquer Anna Brandenberger, Anton Malakhveitchouk January 6, 018 This is the second chapter of the augmented transcript of a lecture given by Luc Devroye on the 11th of January 018

More information

COS 226 Lecture 15: Geometric algorithms. Warning: intuition may mislead (continued)

COS 226 Lecture 15: Geometric algorithms. Warning: intuition may mislead (continued) CS 226 ecture 15: eometric algorithms Warning: intuition may mislead (continued) Important applications involve geometry models of physical world computer graphics mathematical models x: Find intersections

More information

Sieving Interior Collinear Points for Convex Hull Algorithms

Sieving Interior Collinear Points for Convex Hull Algorithms 90 Int'l Conf. Foundations of Computer Science FCS'15 Sieving Interior Collinear Points for Convex Hull Algorithms Dr. Michael Scherger Department of Computer Science Texas Christian University Fort Worth,

More information

Divide and Conquer. Algorithm Fall Semester

Divide and Conquer. Algorithm Fall Semester Divide and Conquer Algorithm 2014 Fall Semester Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances

More information

Computer Science Spring 2005 Final Examination, May 12, 2005

Computer Science Spring 2005 Final Examination, May 12, 2005 Computer Science 302 00 Spring 2005 Final Examination, May 2, 2005 Name: No books, notes, or scratch paper. Use pen or pencil, any color. Use the backs of the pages for scratch paper. If you need more

More information

CMSC 754 Computational Geometry 1

CMSC 754 Computational Geometry 1 CMSC 754 Computational Geometry 1 David M. Mount Department of Computer Science University of Maryland Spring 2007 1 Copyright, David M. Mount, 2007, Dept. of Computer Science, University of Maryland,

More information

CS 372: Computational Geometry Lecture 3 Line Segment Intersection

CS 372: Computational Geometry Lecture 3 Line Segment Intersection CS 372: Computational Geometry Lecture 3 Line Segment Intersection Antoine Vigneron King Abdullah University of Science and Technology September 9, 2012 Antoine Vigneron (KAUST) CS 372 Lecture 3 September

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 12: Sorting Algorithms MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Outline 2 Last week Implementation of the three tree depth-traversal algorithms Implementation of the BinarySearchTree

More information

Lecture 3: Art Gallery Problems and Polygon Triangulation

Lecture 3: Art Gallery Problems and Polygon Triangulation EECS 396/496: Computational Geometry Fall 2017 Lecture 3: Art Gallery Problems and Polygon Triangulation Lecturer: Huck Bennett In this lecture, we study the problem of guarding an art gallery (specified

More information

Divide and Conquer 1

Divide and Conquer 1 Divide and Conquer A Useful Recurrence Relation Def. T(n) = number of comparisons to mergesort an input of size n. Mergesort recurrence. T(n) if n T n/2 T n/2 solve left half solve right half merging n

More information

CMSC 754 Computational Geometry 1

CMSC 754 Computational Geometry 1 CMSC 754 Comutational Geometry 1 David M. Mount Deartment of Comuter Science University of Maryland Fall 2002 1 Coyright, David M. Mount, 2002, Det. of Comuter Science, University of Maryland, College

More information

CSE 421 Greedy Alg: Union Find/Dijkstra s Alg

CSE 421 Greedy Alg: Union Find/Dijkstra s Alg CSE 1 Greedy Alg: Union Find/Dijkstra s Alg Shayan Oveis Gharan 1 Dijkstra s Algorithm Dijkstra(G, c, s) { d s 0 foreach (v V) d[v] //This is the key of node v foreach (v V) insert v onto a priority queue

More information

Why Graham-Scan Needs to Sort Vertices Before Scanning

Why Graham-Scan Needs to Sort Vertices Before Scanning 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

More information

Lecture 2: Divide and Conquer

Lecture 2: Divide and Conquer Lecture 2: Divide and Conquer Paradigm Convex Hull Median finding Paradigm Given a problem of size n divide it into subproblems of size n, a 1, b >1. Solve each b subproblem recursively. Combine solutions

More information

Lecture 13 Geometry and Computational Geometry

Lecture 13 Geometry and Computational Geometry Lecture 13 Geometry and Computational Geometry Euiseong Seo (euiseong@skku.edu) 1 Geometry a Branch of mathematics concerned with questions of shape, size, relative position of figures, and the properties

More information

Triangulation and Convex Hull. 8th November 2018

Triangulation and Convex Hull. 8th November 2018 Triangulation and Convex Hull 8th November 2018 Agenda 1. Triangulation. No book, the slides are the curriculum 2. Finding the convex hull. Textbook, 8.6.2 2 Triangulation and terrain models Here we have

More information

Divide-and-Conquer. Dr. Yingwu Zhu

Divide-and-Conquer. Dr. Yingwu Zhu Divide-and-Conquer Dr. Yingwu Zhu Divide-and-Conquer The most-well known algorithm design technique: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances independently

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms CS245-2015S-08 Priority Queues Heaps David Galles Department of Computer Science University of San Francisco 08-0: Priority Queue ADT Operations Add an element / key pair

More information

Divide-and-Conquer Algorithms

Divide-and-Conquer Algorithms Divide-and-Conquer Algorithms Divide and Conquer Three main steps Break input into several parts, Solve the problem in each part recursively, and Combine the solutions for the parts Contribution Applicable

More information

Lecture 12 March 4th

Lecture 12 March 4th Math 239: Discrete Mathematics for the Life Sciences Spring 2008 Lecture 12 March 4th Lecturer: Lior Pachter Scribe/ Editor: Wenjing Zheng/ Shaowei Lin 12.1 Alignment Polytopes Recall that the alignment

More information

CS 428: Fall Introduction to. Geometric Transformations. Andrew Nealen, Rutgers, /15/2010 1

CS 428: Fall Introduction to. Geometric Transformations. Andrew Nealen, Rutgers, /15/2010 1 CS 428: Fall 21 Introduction to Comuter Grahics Geometric Transformations Andrew Nealen, Rutgers, 21 9/15/21 1 Toic overview Image formation and OenGL (last week) Modeling the image formation rocess OenGL

More information

Unit 1, Lesson 1: Moving in the Plane

Unit 1, Lesson 1: Moving in the Plane Unit 1, Lesson 1: Moving in the Plane Let s describe ways figures can move in the plane. 1.1: Which One Doesn t Belong: Diagrams Which one doesn t belong? 1.2: Triangle Square Dance m.openup.org/1/8-1-1-2

More information

Computational Geometry

Computational Geometry Casting a polyhedron CAD/CAM systems CAD/CAM systems allow you to design objects and test how they can be constructed Many objects are constructed used a mold Casting Casting A general question: Given

More information

SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 6. Sorting Algorithms

SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 6. Sorting Algorithms SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 6 6.0 Introduction Sorting algorithms used in computer science are often classified by: Computational complexity (worst, average and best behavior) of element

More information

CS 450: COMPUTER GRAPHICS 2D TRANSFORMATIONS SPRING 2016 DR. MICHAEL J. REALE

CS 450: COMPUTER GRAPHICS 2D TRANSFORMATIONS SPRING 2016 DR. MICHAEL J. REALE CS 45: COMUTER GRAHICS 2D TRANSFORMATIONS SRING 26 DR. MICHAEL J. REALE INTRODUCTION Now that we hae some linear algebra under our resectie belts, we can start ug it in grahics! So far, for each rimitie,

More information