Geometric Algorithms1 segment intersection orientation point inclusion simple closed path.

Slides:



Advertisements
Similar presentations
Review Chapter 4 Sections 1-6.
Advertisements

Computer Graphics- SCC 342
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
Computer Graphics Scan Conversion Polygon Faculty of Physical and Basic Education Computer Science Dep Lecturer: Azhee W. MD.
Convex Hull obstacle start end Convex Hull Convex Hull
Think, Think, Think. Algebra I Seminar. How Much Do you Remember? The Coordinate Plane X-axis, Y-axis Slope Y-intercept Ordered Pairs Slope Intercept.
Viewing & Clipping In 2D. 2 of 44 Contents Windowing Concepts Clipping –Introduction –Brute Force –Cohen-Sutherland Clipping Algorithm Area Clipping –Sutherland-Hodgman.
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
Classes of Polygons Planar polygons Non-planar polygons Simple
Computational Geometry
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.
Graphs Chapter 1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA A A AAA A.
4.1 Introduction to Linear Equations in Two Variables
Rectangular Coordinate System
Learn to locate and graph points on the coordinate plane.
The Rectangular Coordinate System
Holt CA Course The Coordinate Plane Preparation for AF1.0 Students write verbal expressions and sentences as algebraic expressions and equations;
Graphing Points in Four Quadrants
Preview Warm Up California Standards Lesson Presentation.
The Coordinate Plane. A coordinate plane is formed when two number lines intersect. The coordinate plane is used to locate points. The two number lines.
November 4, Algorithms and Data Structures Lecture XIV Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Chapter 4: Straight Line Drawing Ronald Kieft. Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?
Graphing Linear Equations in Two Variables The Graph of a linear equation in two variables is the graph of all the ordered pairs (x,y) that satisfy the.
Creating and Graphing Linear Equations in Two Variables ~Adapted from Walch Education.
Computational Geometry
Chapter 1.7 Midpoint and Distance in a Coordinate Plane
Bell Ringer 10/8/14.
Advanced Algorithm Design and Analysis (Lecture 9) SW5 fall 2004 Simonas Šaltenis E1-215b
CSE53111 Computational Geometry TOPICS q Preliminaries q Point in a Polygon q Polygon Construction q Convex Hulls Further Reading.
1. Show geometrically that given any two points in the hyperbolic plane there is always a unique line passing through them. § 23.1 Given point A(x1, y1)
coordinates, lines and increment
Equations of Lines Chapter 8 Sections
Part 6: Graphics Output Primitives (4) 1.  Another useful construct,besides points, straight line segments, and curves for describing components of a.
Lesson 4.1- The Coordinate Plane, pg. 192
Graphing on a Coordinate Plane
Multitouch and Collision Detection MOBILE SOFTWARE DEVELOPMENT.
Holt CA Course The Coordinate Plane Warm Up Warm Up Lesson Presentation Lesson Presentation California Standards California StandardsPreview.
MTH 091 Section 13.3 Graphing with x- and y-intercepts Section 13.4 Slope.
1 Dr. Scott Schaefer Intersecting Simple Surfaces.
12/23/ : Slopes of Lines 1 Expectation: You will calculate slopes of lines parallel and perpendicular to given lines.
Bell Work Simplify each expression 6x + (5x – 8) – 9 – (12 – 3x) 4(6n + 9) – 10n Solve the 2-step equation 8 + 2b = – 2r = 8 Answers 11x –
Rotations on the Coordinate Plane. Horizontal- left and right.
Grades: Given an ordered pair, students will be able to plot points with 95% accuracy. 2. Given an ordered pair, students will be able to tell.
COMPUTATIONAL GEOMETRY AND MATRIX MULTIPLICATION Mohammed Zeeshan Farooqui Minhaj Uddin.
Graphing Linear Equations 4.2 Objective 1 – Graph a linear equation using a table or a list of values Objective 2 – Graph horizontal or vertical lines.
WARM UP 1.Evaluate when x = -3 and y = Evaluate (2x)² when x = 5. 5 Minutes Remain x - y 4.
1 Differential Equations 6 Copyright © Cengage Learning. All rights reserved. 6.1 DE & Slope Fields BC Day 1.
Objective The student will be able to: graph ordered pairs on a coordinate plane.
Systems of Linear Equations. Solve a System of Equations by Graphing Objectives: Solve a System of Equations by Graphing Standards: Learn and apply geometric.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Graphs and Applications of Linear Equations
Computer Graphics CC416 Week 13 Clipping.
Intersecting Simple Surfaces
Fill Area Algorithms Jan
Preview Warm Up California Standards Lesson Presentation.
Convex Hull obstacle start end 11/21/2018 4:05 AM Convex Hull
Computer Graphics : Viewing In 2D
I. The Problem of Molding
Rotations on the Coordinate Plane
Graphing Linear Functions
2.3 Graph Equations of Lines
3.1 Reading Graphs; Linear Equations in Two Variables
Graphing Linear Equations
Convex Hull obstacle start end 4/30/2019 5:21 PM Convex Hull
The Distance & Midpoint Formulas
Algorithms and Data Structures Lecture XIV
Graphing Linear Equations
Computational Geometry
The two number lines are called the axes.
Presentation transcript:

Geometric Algorithms1 segment intersection orientation point inclusion simple closed path

Geometric Algorithms2 Basic Geometric Objects in the Plane segment : portion of a straight line between two points point : denoted by a pair of coordinates (x,y) polygon : circular sequence of points (vertices) and segments (edges)

Geometric Algorithms3 Some Geometric Problems Segment intersection Given two segments, do they intersect Inclusion in polygon Is a point inside or outside a polygon ? Simple closed path: given a set of points, find a non-intersecting polygon with vertices on the points.

Geometric Algorithms4 An Apparently Simple Problem: Segment Intersection Test whether segments (a,b) and (c,d) intersect. How do we do it? We could start by writing down the equations of the lines through the segments, then test whether the lines intersect, then... An alternative (and simpler) approach is based in the notion of orientation of an ordered triplet of points in the plane a b c d

Geometric Algorithms5 Orientation in the Plane The orientation of an ordered triplet of points in the plane can be -counterclockwise (left turn) -clockwise (right turn) -collinear (no turn) Examples: a b c counterclockwise ( left turn ) a c b clockwise ( right turn ) collinear ( no turn ) a b c

Geometric Algorithms6 Intersection and Orientation Two segments (p 1,q 1 ) and (p 2,q 2 ) intersect if and only if one of the following two conditions is verified general case: (p 1,q 1,p 2 ) and (p 1,q 1,q 2 ) have different orientations and (p 2,q 2,p 1 ) and (p 2,q 2,q 1 ) have different orientations special case: (p 1,q 1,p 2 ), (p 1,,q 1,q 2 ), (p 2,q 2,p 1 ), and (p 2,q 2,q 1 ) are all collinear and the x-projections of (p 1,q 1 ) and (p 2,q 2 ) intersect the y- projections of (p 1,q 1 ) and (p 2,q 2 ) intersect p 1 q 1 p 2 q 2

Geometric Algorithms7 Examples (General Case) general case: (p 1,q 1,p 2 ), and (p 1,q 1,q 2 ) have different orientations and (p 2,q 2,p 1 ) and (p 2,q 2,q 1 ) have different orientations (p 1,q 1,p 2 ), (p 1,q 1,q 2 ), (p 2,q 2,p 1 ), (p 2,q 2,q 1 ) (p 1,q 1,p 2 ), (p 1,q 1,q 2 ), (p 2,q 2,p 1 ), (p 2,q 2,q 1 )

Geometric Algorithms8 Examples (General Case) general case: (p 1,q 1,p 2 ), and (p 1,q 1,q 2 ) have different orientations and (p 2,q 2,p 1 ) and (p 2,q 2,q 1 ) have different orientations (p 1,q 1,p 2 ), (p 1,q 1,q 2 ), (p 2,q 2,p 1 ), (p 2,q 2,q 1 ) (p 1,q 1,p 2 ), (p 1,q 1,q 2 ), (p 2,q 2,p 1 ), (p 2,q 2,q 1 )

Geometric Algorithms9 Examples (Special Case) general case: (p 1,q 1,p 2 ), and (p 1,q 1,q 2 ) have different orientations and (p 2,q 2,p 1 ) and (p 2,q 2,q 1 ) have different orientations (p 1,q 1,p 2 ), (p 1,q 1,q 2 ), (p 2,q 2,p 1 ), (p 2,q 2,q 1 ) (p 1,q 1,p 2 ), (p 1,q 1,q 2 ), (p 2,q 2,p 1 ), (p 2,q 2,q 1 )

Geometric Algorithms10 How to Compute the Orientation slope of segment (p 1, p 2 ):  = (y 2 -y 1 ) / (x 2 -x 1 ) slope of segment (p 2,p 3 ):  = (y 3 -y 2 ) / (x 3 -x 2 ) Orientation test counterclockwise (left turn):  <  clockwise (right turn):  >  collinear (left turn):  =  The orientation depends on whether the expression (y 2 -y 1 ) (x 3 -x 2 )- (y 3 -y 2 ) (x 2 -x 1 ) is positive, negative, or zero. p 1 p 2 p 3 x 2  x 1 x 3  x 2

Geometric Algorithms11 Point Inclusion given a polygon and a point, is the point inside or outside the polygon? orientation helps solving this problem in linear time

Geometric Algorithms12 Point Inclusion — Part II Draw a horizontal line to the right of each point and extend it to infinity Count the number of times a line intersects the polygon. We have: -even number  point is outside -odd number  point is inside Why? a c e f g b d What about points d and g ?? Degeneracy!

Geometric Algorithms13 Degeneracy Degeneracies are input configurations that involve tricky special cases. When implementing an algorithm, degeneracies should be taken care of separately -- the general algorithm might fail to work. For example, in the previous example where we had to determine whether two segments intersect, we have degeneracy if two segments are collinear. The general algorithm of checking for orientation would fail to distinguish whether the two segments intersect. Hence, this case should be dealt with separately.

Geometric Algorithms14 Simple Closed Path — Part I Problem:Given a set of points... “Connect the dots” without crossings

Geometric Algorithms15 Simple Closed Path — Part II Pick the bottommost point a as the anchor point a For each point p, compute the angle q(p) of the segment (a,p) with respect to the x-axis: a p  (p)

16 Simple Closed Path — Part III Traversing the points by increasing angle yields a simple closed path: -The question is: how do we compute angles? -We could use trigonometry (e.g., arctan). -However, the computation would be inefficient since trigonometric functions are not in the normal instruction set of a computer and need a call to a math-library routine. -Observation:, we don’t care about the actual values of the angles. We just want to sort by angle. Idea: use orientation to compare angles without actually computing them!! a

Geometric Algorithms17 Simple Closed Path — Part IV Orientation can be used to compare angles without actually computing them... Cool! q(p) < q(q)  orientation of (a,p,q) is counterclockwise We can sort the points by angle by using any “sorting-by-comparison” algorithm (e.g., heapsort or merge-sort) and replacing angle comparisons with orientation tests We obtain an O(N log N)-time algorithm for the simple closed path problem on N points p a q