Line Segment Intersection

Similar documents
Arrangements And Duality

Computational Geometry. Lecture 1: Introduction and Convex Hulls

Triangulation by Ear Clipping

Shortest Inspection-Path. Queries in Simple Polygons

Persistent Data Structures and Planar Point Location

HOLES 5.1. INTRODUCTION

Line Segment Intersection

Data Structures Fibonacci Heaps, Amortized Analysis

Disjoint Compatible Geometric Matchings

Computational Geometry: Line segment intersection

DEGREE CONSTRAINED TRIANGULATION. Roshan Gyawali

INTERSECTION OF LINE-SEGMENTS

INCIDENCE-BETWEENNESS GEOMETRY

Catalan Numbers. Thomas A. Dowling, Department of Mathematics, Ohio State Uni- versity.

Connectivity and cuts

EE602 Algorithms GEOMETRIC INTERSECTION CHAPTER 27

Graph Theory Problems and Solutions

Analysis of Algorithms, I

Topological Treatment of Platonic, Archimedean, and Related Polyhedra

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

Graph Theory Lecture 3: Sum of Degrees Formulas, Planar Graphs, and Euler s Theorem Spring 2014 Morgan Schreffler Office: POT 902

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

CMPSCI611: Approximating MAX-CUT Lecture 20

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

Mathematical Induction. Mary Barnes Sue Gordon

Contents. 2 Lines and Circles Cartesian Coordinates Distance and Midpoint Formulas Lines Circles...

Shortcut sets for plane Euclidean networks (Extended abstract) 1

Zachary Monaco Georgia College Olympic Coloring: Go For The Gold

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

SolidWorks Implementation Guides. Sketching Concepts

Solving Geometric Problems with the Rotating Calipers *

The minimum number of distinct areas of triangles determined by a set of n points in the plane

Midterm Practice Problems

Constrained Tetrahedral Mesh Generation of Human Organs on Segmented Volume *

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Final Review Geometry A Fall Semester

Seminar. Path planning using Voronoi diagrams and B-Splines. Stefano Martina

SPERNER S LEMMA AND BROUWER S FIXED POINT THEOREM

Shortest Path Algorithms

2.3 WINDOW-TO-VIEWPORT COORDINATE TRANSFORMATION

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

39 Symmetry of Plane Figures

Pseudo-Triangulations a Survey

A fast and robust algorithm to count topologically persistent holes in noisy clouds

MATH STUDENT BOOK. 8th Grade Unit 6

Analysis of Algorithms I: Binary Search Trees

CS311H. Prof: Peter Stone. Department of Computer Science The University of Texas at Austin

Solutions to Homework 6

Pro/ENGINEER Wildfire 5.0 Introduction to Surface Modeling

Data Structure [Question Bank]

x 2 f 2 e 1 e 4 e 3 e 2 q f 4 x 4 f 3 x 3

The Graphical Method: An Example

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

Pro/ENGINEER Wildfire 4.0 Basic Design

1 if 1 x 0 1 if 0 x 1

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

each college c i C has a capacity q i - the maximum number of students it will admit

Topology. Shapefile versus Coverage Views

Actually Doing It! 6. Prove that the regular unit cube (say 1cm=unit) of sufficiently high dimension can fit inside it the whole city of New York.

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

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

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Persistent Data Structures

The number of generalized balanced lines

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

8.1 Min Degree Spanning Tree

Binary Search Trees CMPSC 122

5.1 Bipartite Matching

Data Structures and Algorithms Written Examination

Computer Graphics CS 543 Lecture 12 (Part 1) Curves. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Optimal 3D Angular Resolution for Low-Degree Graphs

arxiv: v1 [math.co] 7 Mar 2012

Graphical degree sequences and realizations

CK-12 Geometry: Parts of Circles and Tangent Lines

Geometry 1. Unit 3: Perpendicular and Parallel Lines

arxiv: v1 [cs.cg] 15 Sep 2014

Introduction to Graph Theory

Internet Packet Filter Management and Rectangle Geometry

The GeoMedia Fusion Validate Geometry command provides the GUI for detecting geometric anomalies on a single feature.

GRAPH THEORY LECTURE 4: TREES

HowTo Rhino & ICEM. 1) New file setup: choose Millimeter (automatically converts to Meters if imported to ICEM)

New York State Student Learning Objective: Regents Geometry

Finding and counting given length cycles

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

1 The Line vs Point Test

Linear Programming. Solving LP Models Using MS Excel, 18

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

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Max-Min Representation of Piecewise Linear Functions

SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH

Sequential Data Structures

E XPLORING QUADRILATERALS

Introduction to ANSYS ICEM CFD

6.3 Conditional Probability and Independence

Social Media Mining. Graph Essentials

Math 2443, Section 16.3

2. Select Point B and rotate it by 15 degrees. A new Point B' appears. 3. Drag each of the three points in turn.

Guessing Game: NP-Complete?

Largest Fixed-Aspect, Axis-Aligned Rectangle

Transcription:

Line Segment Intersection The intersection problem: 1 Given 2 object (in 2/3D), find out whether they intersect, and if so, what is the point of intersection. The objects may be complex, like circles. The complexity will be a function of a dimension. It is common to break down complex shapes, like polygons, into simpler shapes (like into sets of edges / vertices). Given line segments in the plance, report all points where a pair of line segments intersect. Naïve Algorithm This can be done naively in ( ) time check each pair in the set (provided we can check intersection of 2 lines in constant time). This is ( ). We would like an output-sensitive algorithm, that is an algorithm with complexity based on the number of intersection points. Lower bound The lower bound is ( ), where is the number of intersection output. See lecture notes for reduction, proving it cannot be ( ). Primitive operation: Given segments we can detect whether they intersect in constant time: ( ) ( ), - ( ) ( ), - An intersection occurs if ( ) ( ) for some in the range above (if they are not in, - it means there is an intersection of the lines on which reside, but not on the segments themselves). This function is given from this point on as a known constant operation. Plane Sweep Algorithm Note: in class the direction of movement of the sweep line is presented as horizontal, not vertical as in the book. Let * + be a set of line segments. The main elements of plane sweep: Sweep line : simulating the sweeping along the y-axis from to. Line segments are stored in order they intersect. Events: event points are those in which has a content change (with respect to what segments intersect it and in what order). Event points: Endpoint events: known in advance, the points in which intersects a new segment / stops intersecting it. Intersection events: where encounters points of intersection of 2 segments.

2 When 2 segments are adjacent on, there is a chance they intersect. We hold a binary search tree to hold the order of segments currently intersecting, and this data structure will be updated along the algorithm. When a new segment is encountered: we need to check if it intersect with its predecessor and successor in the binary tree. Assumptions: No segments are vertical. This can be implemented by giving a minor -slope with respect to all other segments. No two segments intersect in more than 1 point. There are no more than 2 segments that intersect at any intersection point. Detecting intersections: An intersection can happen iff at some point of time they become adjacent with respect to. We need to show this condition is sufficient: Lemma: Given two segments and, which intersect in a single point (and assuming no other line segment passes through this point) there is a placement of the sweep line prior to this event, such that and are adjacent along the sweep line (and hence will be tested for intersection). 1) Event queue: Will hold the set of future events sorted according to increasing x-coordinate. Each event will be identified whether it is a start/end endpoint or an intersection point. Should support: - Insertion of new events - Extracting the minimum We will use a priority queue. When we insert to the priority queue we need to make sure the same event doesn t get inserted more than once (hence the need of both x and y coordinates of each event point inserted). An example where this might happen: At each of the red lines the two long black lines become adjacent w.r.t. again and again and their intersection point is checked every time, resulting with the same event. Storing events in order: since two event points may have the same x coordinate, we need to sort all points lexicographically, by ( ) order (sort by x, and if it equals, sort by y).

2) Sweep line status: 3 A data structure that will hold the segments that intersect in order in which they intersect it. We use a binary search tree. The relative order between segments stays the same until an intersection point of 2 points, in which their order will change and the status will need to be updated. Let a segment have the line equation ( ), this is actually the key for the status binary tree. As is moving, we can plug in its value into any of the equations stored in the status tree, to know the actual coordinate of that particular segment at that location of. This has to be done at every event that is encountered. Operations that are needed to be supported: Delete a line segment Insert a line segment Swap positions between two line segments right after passes their intersection point. Determining the predecessor and successor of any segment in the tree. Using a balanced binary search tree will derive a ( ) time for any such operation. The algorithm: Insert all endpoints of all segments in as events in the queue. The status is initially empty. While the Q is not empty, extract-min: o The event is a segment left endpoint: insert the segment into the status, based on the y coordinate at the current position of (in order with all segments currently in the status and their value at the current y position). Then check intersections of that segment with its pred and succ in the status. o The event is a segment right endpoint: delete the segment from the status, and for its previous pred and succ apply intersection tests, each with its pred and succ. o The event is an intersection point: swap the two line segments in order along the sweep line, and for the new upper and lower apply intersection tests, each with its new pred and succ.

Running time: 4 The running time is dominated by the time it takes updating the event priority queue and status binary tree data structures. There are at most elements intersecting, thus any operation will take ( ) in the status tree. Since all duplicate events are disregarded, the size of the queue will be at most 2 endpoint events for each segment + intersection events, so each operation: ( ( )), and since this is ( ) ( ). For every event there are constant accesses to any of the data structures. Therefore the total running time is: (( ) ) ( ) Planar Graphs, Polygons and Art Galleries We are usually interested in intersections of more complex shapes than line segments. Planar Straight Line Graph (PSLG): (or planar subdivision): A graph in the plane with straight line edges that can intersect only at endpoints. The graph subdivides the plane into regions. Components: o 1-D vertices o 2-D edges o 3-D faces There will always be an unbound face. Euler s Condition: In the 2-D space and a given subdivision with vertices edges and faces, the formula states: For any subdivision, also referred as Euler s characteristic. In general for an arbitrary genus with handle: (in ) If the graph is disconnected with connected components: Theorem A planar graph with vertices has at most ( ) edges and at most ( ) faces asymptotically, edges and faces.

Proof: 5 We can assume any face is a triangle, otherwise we can add more edges to triangulate any face. Assume we have and edges, and we triangulate to achieve faces and edges, respectively. Observations: Every edge is adjacent to 2 triangles (faces) Every face is adjacent to exactly 3 edges faces Therefore Plugging this into Euler s formula: ( ) ( ) And in a similar process we will get ( ). Doubly-connected edge list: A PSLG will be represented in a DCEL: A vertex stores coordinates, pointer to one of its incident edges for which it is its origin. Each edge is split into two oppositely directed edges (twins) each pointing to the origin of the other. Each edge also points to its left face Each edge holds a pointer to next and prev edges. Face list, for each face we store one edge (from that we can get the boundary of the face). Simple polygons: A polygonal curve is a finite sequence of consecutive line segments (edges) joined end to end. It is closed if (its vertices), and it is simple if it does not self-intersect.

The art gallery problem 6 For two points in a polygon, we say they see each other if lies entirely within the interior of. The problem: find the number of points we can place inside the polygon (represented with vertices) such that all edges are visible from the inside by at least one of the points (analogy: need to place guards within an art gallery). If the polygon is convex, the answer is simply 1. It gets more interesting if the polygon is not convex. The right value is:, and it is based on polygon triangulation, dual graphs and graph coloring. Art-Gallery Theorem Given a polygon with vertices, there exists a guarding set with at most guards. Lemma 1: every simple polygon with vertices has a triangulation with diagonals and triangles (in our case faces) Proof: any -vertex polygon ( ) has a diagonal, and it can break it into 2 polygons with vertices that share 2 vertices, therefore, thus there are ( ) ( ) triangles. Lemma 2: given a triangulation graph of a simple polygon, it is 3-colorable. Proof: for every planar graph G there is another planar graph called its dual. In the dual graph, the vertices are the faces of G and an edge exists between faces that have a shared edge in G. Triangulation, which is a planar graph, will create a tree in the dual. A cycle will happen only if G has a hole in it (but we started with a simple polygon, therefore there will not be a hole). Note that any triangle removed still leaves a tree. We recursively remove triangles until we reach 1 triangle, and then it is 3-colorable. We then add triangles back, and each addition we color the added vertex, getting a 3-coloring. Theorem proof: When we 3-color the graph, each color will be used at most times. Therefore we can pick a color, and pick its nodes and there place our guards. Running time: Linear: The triangulation is linear ( triangles). Forming the dual graph is linear and everything is linear.