Computational Geometry. Lecture 1: Introduction and Convex Hulls



Similar documents
1 Computational Geometry

Solving Geometric Problems with the Rotating Calipers *

Arrangements And Duality

Shortest Path Algorithms

Closest Pair Problem

EE602 Algorithms GEOMETRIC INTERSECTION CHAPTER 27

Triangulation by Ear Clipping

Fast approximation of the maximum area convex. subset for star-shaped polygons

Approximation of an Open Polygonal Curve with a Minimum Number of Circular Arcs and Biarcs

Algebra Academic Content Standards Grade Eight and Grade Nine Ohio. Grade Eight. Number, Number Sense and Operations Standard

Largest Fixed-Aspect, Axis-Aligned Rectangle

INCIDENCE-BETWEENNESS GEOMETRY

Pre-Algebra Academic Content Standards Grade Eight Ohio. Number, Number Sense and Operations Standard. Number and Number Systems

E XPLORING QUADRILATERALS

Disjoint Compatible Geometric Matchings

Geometry Chapter Point (pt) 1.1 Coplanar (1.1) 1.1 Space (1.1) 1.2 Line Segment (seg) 1.2 Measure of a Segment

1. A student followed the given steps below to complete a construction. Which type of construction is best represented by the steps given above?

Everyday Mathematics. Grade 4 Grade-Level Goals CCSS EDITION. Content Strand: Number and Numeration. Program Goal Content Thread Grade-Level Goal

Volumes of Revolution

1 if 1 x 0 1 if 0 x 1

Everyday Mathematics. Grade 4 Grade-Level Goals. 3rd Edition. Content Strand: Number and Numeration. Program Goal Content Thread Grade-Level Goals

Cabri Geometry Application User Guide

Vector storage and access; algorithms in GIS. This is lecture 6

2.1. Inductive Reasoning EXAMPLE A

Geometry Enduring Understandings Students will understand 1. that all circles are similar.

37 Basic Geometric Shapes and Figures

MA 408 Computer Lab Two The Poincaré Disk Model of Hyperbolic Geometry. Figure 1: Lines in the Poincaré Disk Model

1. A plane passes through the apex (top point) of a cone and then through its base. What geometric figure will be formed from this intersection?

GEOMETRY. Constructions OBJECTIVE #: G.CO.12

Activity Set 4. Trainer Guide

Computational Geometry: Line segment intersection

TOWARDS AN AUTOMATED HEALING OF 3D URBAN MODELS

Chapter 18 Symmetry. Symmetry of Shapes in a Plane then unfold

Performance Based Learning and Assessment Task Triangles in Parallelograms I. ASSESSSMENT TASK OVERVIEW & PURPOSE: In this task, students will

Random Map Generator v1.0 User s Guide

We can display an object on a monitor screen in three different computer-model forms: Wireframe model Surface Model Solid model

Intersection of a Line and a Convex. Hull of Points Cloud

Planar Curve Intersection

39 Symmetry of Plane Figures

Off-line Model Simplification for Interactive Rigid Body Dynamics Simulations Satyandra K. Gupta University of Maryland, College Park

alternate interior angles

Closest Pair of Points. Kleinberg and Tardos Section 5.4

Angle - a figure formed by two rays or two line segments with a common endpoint called the vertex of the angle; angles are measured in degrees

Algorithms for Computing Convex Hulls Using Linear Programming

In mathematics, there are four attainment targets: using and applying mathematics; number and algebra; shape, space and measures, and handling data.

Shortest Inspection-Path. Queries in Simple Polygons

MA 323 Geometric Modelling Course Notes: Day 02 Model Construction Problem

Lecture 2: Homogeneous Coordinates, Lines and Conics

Line Segment Intersection

Number Sense and Operations

Angles that are between parallel lines, but on opposite sides of a transversal.

Geometry Course Summary Department: Math. Semester 1

28 Closest-Point Problems

Grade 7 & 8 Math Circles Circles, Circles, Circles March 19/20, 2013

Computer Graphics. Geometric Modeling. Page 1. Copyright Gotsman, Elber, Barequet, Karni, Sheffer Computer Science - Technion. An Example.

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

SolidWorks Implementation Guides. Sketching Concepts

GEOMETRY COMMON CORE STANDARDS

Reflection and Refraction

Curriculum Map by Block Geometry Mapping for Math Block Testing August 20 to August 24 Review concepts from previous grades.

EVERY DAY COUNTS CALENDAR MATH 2005 correlated to

Lesson 18: Looking More Carefully at Parallel Lines

Shortcut sets for plane Euclidean networks (Extended abstract) 1

5.4 Closest Pair of Points

INTERSECTION OF LINE-SEGMENTS

Diffuse Reflection Radius in a Simple Polygon

WORK SCHEDULE: MATHEMATICS 2007

Selected practice exam solutions (part 5, item 2) (MAT 360)

Investigating Area Under a Curve

Geometry: Unit 1 Vocabulary TERM DEFINITION GEOMETRIC FIGURE. Cannot be defined by using other figures.

GEOMETRY CONCEPT MAP. Suggested Sequence:

Circle Name: Radius: Diameter: Chord: Secant:

Strictly Localized Construction of Planar Bounded-Degree Spanners of Unit Disk Graphs

Visualizing Triangle Centers Using Geogebra

Intersection of Convex Objects: The Method of Separating Axes

Illinois State Standards Alignments Grades Three through Eleven

Grade 5 Math Content 1

Tangent circles in the hyperbolic disk

56 questions (multiple choice, check all that apply, and fill in the blank) The exam is worth 224 points.

Section 13.5 Equations of Lines and Planes

Grade 8 Mathematics Geometry: Lesson 2

Oracle8i Spatial: Experiences with Extensible Databases

Chapter 1. Creating Sketches in. the Sketch Mode-I. Evaluation chapter. Logon to for more details. Learning Objectives

PYTHAGOREAN TRIPLES KEITH CONRAD

Hydrogeological Data Visualization

Geometry and Measurement

Discovering Math: Exploring Geometry Teacher s Guide

Duplicating Segments and Angles

HOLES 5.1. INTRODUCTION

MODERN APPLICATIONS OF PYTHAGORAS S THEOREM

The Essentials of CAGD

Glencoe. correlated to SOUTH CAROLINA MATH CURRICULUM STANDARDS GRADE 6 3-3, , , 4-9

Angles and Quadrants. Angle Relationships and Degree Measurement. Chapter 7: Trigonometry

Basic Geometry Review For Trigonometry Students. 16 June 2010 Ventura College Mathematics Department 1

Datum > Curve KIM,ME,NIU

Session 7 Bivariate Data and Analysis

Chapter 3.1 Angles. Geometry. Objectives: Define what an angle is. Define the parts of an angle.

Everyday Mathematics GOALS

Lesson 1: Introducing Circles

Transcription:

Lecture 1: Introduction and convex hulls 1

Geometry: points, lines,... Plane (two-dimensional), R 2 Space (three-dimensional), R 3 Space (higher-dimensional), R d A point in the plane, 3-dimensional space, higher-dimensional space. p = (p x,p y ), p = (p x,p y,p z ), p = (p 1,p 2,...,p d ) A line in the plane: y = m x + c; representation by m and c A half-plane in the plane: y m x + c or y m x + c Represent vertical lines? Not by m and c... 2

Geometry: line segments A line segment pq is defined by its two endpoints p and q: (λ p x + (1 λ) q x, λ p y + (1 λ) q y ) where 0 λ 1 Line segments are assumed to be closed = with endpoints, not open Two line segments intersect if they have some point in common. It is a proper intersection if it is exactly one interior point of each line segment 3

Polygons: simple or not A polygon is a connected region of the plane bounded by a sequence of line segments simple polygon polygon with holes convex polygon non-simple polygon The line segments of a polygon are called its edges, the endpoints of those edges are the vertices Some abuse: polygon is only boundary, or interior plus boundary interior exterior 4

Other shapes: rectangles, circles, disks A circle is only the boundary, a disk is the boundary plus the interior Rectangles, squares, quadrants, slabs, half-lines, wedges,... 5

Relations: distance, intersection, angle The distance between two points is generally the Euclidean distance: (px q x ) 2 + (p y q y ) 2 Another option: the Manhattan distance: p x q x + p y q y Question: What is the set of points at equal Manhattan distance to some point? (px q x ) 2 + (p y q y ) 2 p x q x p y q y 6

Relations: distance, intersection, angle The distance between two geometric objects other than points usually refers to the minimum distance between two points that are part of these objects Question: How can the distance between two line segments be realized? 7

Relations: distance, intersection, angle The intersection of two geometric objects is the set of points (part of the plane, space) they have in common Question 1: How many intersection points can a line and a circle have? Question 2: What are the possible outcomes of the intersection of a rectangle and a quadrant? 8

Relations: distance, intersection, angle Question 3: What is the maximum number of intersection points of a line and a simple polygon with 10 vertices (trick question)? 9

Relations: distance, intersection, angle Question 4: What is the maximum number of intersection points of a line and a simple polygon boundary with 10 vertices (still a trick question)? 10

Relations: distance, intersection, angle Question 5: What is the maximum number of edges of a simple polygon boundary with 10 vertices that a line can intersect? 11

Description size A point in the plane can be represented using two reals A line in the plane can be represented using two reals and a Boolean (for example) A line segment can be represented by two points, so four reals A circle (or disk) requires three reals to store it (center, radius) A rectangle requires four reals to store it y = m x + c false, m, c x = c true,.., c 12

Description size A simple polygon in the plane can be represented using 2n reals if it has n vertices (and necessarily, n edges) A set of n points requires 2n reals A set of n line segments requires 4n reals A point, line, circle,... requires O(1), or constant, storage. A simple polygon with n vertices requires O(n), or linear, storage 13

Computation time Any computation (distance, intersection) on two objects of O(1) description size takes O(1) time! Question: Suppose that a simple polygon with n vertices is given; the vertices are given in counterclockwise order along the boundary. Give an efficient algorithm to determine all edges that are intersected by a given line. How efficient is your algorithm? Why is your algorithm efficient? 14

Algorithms, efficiency Recall from your algorithms and data structures course: A set of n real numbers can be sorted in O(nlogn) time A set of n real numbers can be stored in a data structure that uses O(n) storage and that allows searching, insertion, and deletion in O(log n) time per operation These are fundamental results in 1-dimensional computational geometry! 15

Computational geometry scope In computational geometry, problems on input with more than constant description size are the ones of interest Computational geometry (theory): Study of geometric problems on geometric data, and how efficient geometric algorithms that solve them can be Computational geometry (practice): Study of geometric problems that arise in various applications and how geometric algorithms can help to solve well-defined versions of such problems 16

Computational geometry theory Computational geometry (theory): Classify abstract geometric problems into classes depending on how efficiently they can be solved smallest enclosing circle closest pair any intersection? find all intersections 17

Computational geometry practice Application areas that require geometric algorithms are computer graphics, motion planning and robotics, geographic information systems, CAD/CAM, statistics, physics simulations, databases, games, multimedia retrieval,... Computing shadows from virtual light sources Spatial interpolation from groundwater pollution measurements Computing a collision-free path between obstacles Computing similarity of two shapes for shape database retrieval 18

Computational geometry history Early 70s: First attention for geometric problems from algorithms researchers 1976: First PhD thesis in computational geometry (Michael Shamos) 1985: First Annual ACM Symposium on. Also: first textbook 1996: CGAL: first serious implementation effort for robust geometric algorithms 1997: First handbook on computational geometry (second one in 2000) 19

Convexity A shape or set is convex if for any two points that are part of the shape, the whole connecting line segment is also part of the shape Question: Which of the following shapes are convex? Point, line segment, line, circle, disk, quadrant? 20

Convex hull For any subset of the plane (set of points, rectangle, simple polygon), its convex hull is the smallest convex set that contains that subset 21

Convex hull problem Give an algorithm that computes the convex hull of any given set of n points in the plane efficiently The input has 2n coordinates, so O(n) size Question: Why can t we expect to do any better than O(n) time? 22

Convex hull problem Assume the n points are distinct The output has at least 4 and at most 2n coordinates, so it has size between O(1) and O(n) The output is a convex polygon so it should be returned as a sorted sequence of the points, clockwise (CW) along the boundary Question: Is there any hope of finding an O(n) time algorithm? 23

Developing an algorithm To develop an algorithm, find useful properties, make various observations, draw many sketches to gain insight p q Property: The vertices of the convex hull are always points from the input Consequently, the edges of the convex hull connect two points of the input Property: The supporting line of any convex hull edge has all input points to one side all points lie right of the directed line from p to q, if the edge from p to q is a CW convex hull edge 24

Developing an algorithm To develop an algorithm, find useful properties, make various observations, draw many sketches to gain insight Property: The vertices of the convex hull are always points from the input Consequently, the edges of the convex hull connect two points of the input Property: The supporting line of any convex hull edge has all input points to one side all points lie right of the directed line from p to q, if the edge from p to q is a CW convex hull edge q p 25

Developing an algorithm Algorithm SlowConvexHull(P) Input. A set P of points in the plane. Output. A list L containing the vertices of CH(P) in clockwise order. 1. E /0. 2. for all ordered pairs (p,q) P P with p not equal to q 3. do valid true 4. for all points r P not equal to p or q 5. do if r lies left of the directed line from p to q 6. then valid false 7. if valid then Add the directed edge pq to E 8. From the set E of edges construct a list L of vertices of CH(P), sorted in clockwise order. 26

Developing an algorithm Question: How must line 5 be interpreted to make the algorithm correct? Question: How efficient is the algorithm? 27

Developing an algorithm Another approach: incremental, from left to right Let s first compute the upper boundary of the convex hull this way (property: on the upper hull, points appear in x-order) Main idea: Sort the points from left to right (= by x-coordinate). Then insert the points in this order, and maintain the upper hull so far 28

Developing an algorithm Observation: from left to right, there are only right turns on the upper hull 29

Developing an algorithm Initialize by inserting the leftmost two points 30

Developing an algorithm If we add the third point there will be a right turn at the previous point, so we add it 31

Developing an algorithm If we add the fourth point we get a left turn at the third point 32

Developing an algorithm... so we remove the third point from the upper hull when we add the fourth 33

Developing an algorithm If we add the fifth point we get a left turn at the fourth point 34

Developing an algorithm... so we remove the fourth point when we add the fifth 35

Developing an algorithm If we add the sixth point we get a right turn at the fifth point, so we just add it 36

Developing an algorithm We also just add the seventh point 37

Developing an algorithm When adding the eight point... we must remove the seventh point 38

Developing an algorithm... we must remove the seventh point 39

Developing an algorithm... and also the sixth point 40

Developing an algorithm... and also the fifth point 41

Developing an algorithm After two more steps we get: 42

The pseudo-code Algorithm ConvexHull(P) Input. A set P of points in the plane. Output. A list containing the vertices of CH(P) in clockwise order. 1. Sort the points by x-coordinate, resulting in a sequence p 1,...,p n. 2. Put the points p 1 and p 2 in a list L upper, with p 1 as the first point. 3. for i 3 to n 4. do Append p i to L upper. 5. while L upper contains more than two points and the last three points in L upper do not make a right turn 6. do Delete the middle of the last three points from L upper. 43

The pseudo-code p 1, p 2, p 10, p 13, p 14 Then we do the same for the lower convex hull, from right to left We remove the first and last points of the lower convex hull... and concatenate the two lists into one p 14, p 12, p 8, p 4, p 1 44

Algorithm analysis Algorithm analysis generally has two components: proof of correctness efficiency analysis, proof of running time 45

Correctness Are the general observations on which the algorithm is based correct? Does the algorithm handle degenerate cases correctly? Here: Does the sorted order matter if two or more points have the same x-coordinate? What happens if there are three or more collinear points, in particular on the convex hull? 46

Efficiency Identify of each line of pseudo-code how much time it takes, if it is executed once (note: operations on a constant number of constant-size objects take constant time) Consider the loop-structure and examine how often each line of pseudo-code is executed Sometimes there are global arguments why an algorithm is more efficient than it seems, at first 47

The pseudo-code Algorithm ConvexHull(P) Input. A set P of points in the plane. Output. A list containing the vertices of CH(P) in clockwise order. 1. Sort the points by x-coordinate, resulting in a sequence p 1,...,p n. 2. Put the points p 1 and p 2 in a list L upper, with p 1 as the first point. 3. for i 3 to n 4. do Append p i to L upper. 5. while L upper contains more than two points and the last three points in L upper do not make a right turn 6. do Delete the middle of the last three points from L upper. 48

Efficiency The sorting step takes O(nlogn) time Adding a point takes O(1) time for the adding-part. Removing points takes constant time for each removed point. If due to an addition, k points are removed, the step takes O(1 + k) time Total time: O(nlogn) + n i=3 O(1 + k i ) if k i points are removed when adding p i Since k i = O(n), we get O(nlogn) + n i=3 O(n) = O(n 2 ) 49

Efficiency Global argument: each point can be removed only once from the upper hull This gives us the fact: Hence, n i=3 k i n O(nlogn) + n i=3 O(1 + k i ) = O(nlogn) + O(n) = O(nlogn) 50

Final result The convex hull of a set of n points in the plane can be computed in O(nlogn) time, and this is optimal 51

Other approaches: divide-and-conquer Divide-and-conquer: split the point set in two halves, compute the convex hulls recursively, and merge A merge involves finding extreme vertices in every direction 52

Other approaches: divide-and-conquer Alternatively: split the point set in two halves on x-coordinate, compute the convex hulls recursively, and merge A merge now comes down to finding two common tangent lines 53

Convex hulls in 3D For a 3-dimensional point set, the convex hull is a convex polyhedron It has vertices (0-dim.), edges (1-dim.), and facets (2-dim.) in its boundary, and a 3-dimensional interior The boundary is a planar graph, so it has O(n) vertices, edges and facets 54

Convex hulls in 4D For a 4-dimensional point set, the convex hull is a convex polyhedron It has vertices (0-dim.), edges (1-dim.), 2-facets (2-dim.), and 3-facets (3-dim.) in its boundary, and a 4-dimensional interior Its boundary can have Θ(n 2 ) facets in the worst case! 55