This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: AMS 345/CSE 355 (Fall, 2010) Joe Mitchell COMPUTATIONAL GEOMETRY Homework Set # 2 – Solution Notes (1). Suppose that you are given a simple polygon P , specified (as usual) as a list of n vertices, v , v 1 , . . . , v n − 1 , given in counterclockwise order about the polygon. Your goal is to find a diagonal of P , any diagonal, v i v j . Describe an efficient algorithm to compute a diagonal, ideally in worst- case linear time, without resorting to computing a triangulation of P . (Since Chazelle’s (highly complex) algorithm computes a triangulation in linear time, we know that it is possible; but much simpler methods are also possible!) Make your algorithm as efficient as possible (ideally O ( n ) ) in the worst case (you need not worry about constants; “efficient” is measured in the usual Big-Oh notation). What is the running time? (While your algorithm need not be written in code, try to write it very clearly and succinctly, step by step.) METHOD 1: We can give a simple linear-time algorithm based on the proof that a simple polygon (with n ≥ 4) has a diagonal (Lemma 1.2.2). First, we find a strictly convex vertex, v , in linear time ( O ( n )) by looping through the vertices of P and finding the one with smallest y- coordinate, breaking ties by picking the one with largest x-coordinate (as in Lemma 1.2.1). Let a be the predecessor of v (in the ccw order about P ) and let b be the successor of v (in the ccw order about P ). Now, we loop through all n − 3 vertices v i negationslash = v, a, b , checking each to see if it lies in the (closed) triangle Δ avb ; we can do this by calling Left( a, v, v i ), Left( v, b, v i ), and LeftOn( b, a, v i ). (Note that v i cannot be on the segment av or the segment vb , but it may lie on the segment ab .) If no such....
View Full Document
This note was uploaded on 03/13/2011 for the course AMS 345 taught by Professor Mitchell,j during the Spring '08 term at SUNY Stony Brook.
- Spring '08