announcements
play

Announcements Computational Geometry for Thursday, March 2 the - PDF document

Announcements Computational Geometry for Thursday, March 2 the Tablet PC ABET Program review Give important feedback on the CSE 481b program Free Donuts! Lecture 17 Overview Tablet Geometry Computational Basic


  1. Announcements Computational Geometry for � Thursday, March 2 the Tablet PC � ABET Program review � Give important feedback on the CSE 481b program � Free Donuts! Lecture 17 Overview Tablet Geometry � Computational � Basic structure – Geometry on the Stroke: sequence of Tablet PC points � Geometric primitives � Himetric coordinates � Intersections � Sampled 150 times per second � Polygons � Convexity � Coordinates stored in � Voronoi Diagram an array Points Computational Geometry Basic geometry p 2 � Algorithms for geometric computation � Point p � p � Numerical issues with coordinates p 1 � Line segment � Importance of degenerate cases � (p 1 , p 2 ) � Distance � Examples of degenerate cases p 3 � Dist(p 1 , p 2 ) p 2 � Basic Test � Three lines intersecting at a point � LeftOf(p 1 , p 2 , p 3 ) � Segments overlapping � CCW(p 1 , p 2 , p 3 ) p 1 � Three points co-linear 1

  2. Counter Clockwise Test Segment intersection � CCW(p 1 , p 2 , p 3 ) � Find intersection of (p 1 ,p 2 ) and (p 3 ,p 4 ) � Q = α p 1 + (1- α )p 2 public static bool CcwTest(Point p1, Point p2, Point p3){ � Q = β p 3 + (1- β )p 4 int q1 = (p1.Y - p2.Y)*(p3.X - p1.X); � Solve for α , β int q2 = (p2.X - p1.X)*(p3.Y - p1.Y); return q1 + q2 < 0; � Two equations, two unknowns } p 2 � Intersect if 0 < α < 1 and 0 < β < 1 � Derived points � In general, try to avoid computing derived points in geometric algorithms p 1 p 3 Making intersection test more Problem efficient � Determine if two line segments (p 1 , p 2 ) and (p 3 ,p 4 ) � Take care of easy cases intersect just using CCW Tests using coordinate comparisons � Only use CCW tests if bounding boxes intersect Student Submission Segment intersection Computing intersections algorithm � How many self intersections can a � Run time O(nlog n + Klog n) for finding K intersections � Sweepline Algorithm single stroke with n points have? 3 6 5 1 2 7 4 Student Submission 2

  3. Sweepline Algorithm Sweepline example 3 � Event queue � Start Segment 6 � Start Segment (S 2 ) � Insert in list � End Segment (E 2 ) � Check above and below 5 1 for intersection � Intersection (I 2,4 ) � End Segment � Move sweepline to next 2 7 event � Remove from list 4 � Check newly adjacent � Maintain vertical order segments for intersection of segments as line � Intersection sweeps across � Reorder segments � Check above and below for intersection Activity: Identify when each of the intersections is detected Polygons � Sequence of points representing a D closed path A F � Simple polygon – closed path with no C self intersections E B Student Submission Describe an algorithm to test if a point q is in a polygon P Polygon inclusion test � Is the point q inside the Polygon P? 3

  4. Convexity Convex polygons � Defn: Set S is convex if whenever p 1 , � P = {p 0 , p 1 , . . . p n-1 } and p 2 are in S, the segment (p 1 , p 2 ) is � P is convex if contained in S � CCW(p i , p i+1 , p i+2 ) for all i � Interpret subscripts mod n � Also holds for CW (depending on how points are ordered) Problem: Test if a point q is inside a Convex hull convex polygon P using CCW Tests � Smallest enclosing convex figure � Rubber band “algorithm” Student Submission Compute the Convex Hull Algorithms � Convex hull algorithms: O(nlog n) � Related to sorting � Insertion algorithm � Gift Wrapping (Jarvis’s march) � Divide and Conquer � Graham Scan Student Submission 4

  5. Convex Hull Algorithms Gift wrapping Divide and Conquer Polar sort the red points around q (Start with p, number the points in CCW Graham Scan order) � Polar sort the points around a point inside the hull � Scan points in CCW order � Discard any point that causes a CW turn p q � If CCW advance � If !CCW, discard current point and back up Student Submission Graham Scan Algorithm GS Example to walk through � Stack of vertices x � Possible hull vertices y � z – next vertex � y – top of stack z � x – next on stack � If CCW(x, y, z) � Push(z) x � If (! CCW(x, y, z)) z y � Pop stack 5

  6. Student submission: Give order Voronoi Diagram vertices are discarded in the scan � Given a set of points: subdivide space into the regions closest to each point p Student Submission Algorithms for Computing the Compute the Voronoi Diagram Voronoi Student Submission 6

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend