1 / 30

Computational Geometry

Computational Geometry. Robin Visser. Terminology. Point Line Line segment Ray. Line – Line Intersection. Given two lines, calculate their intersection. Can do a similar thing for line segments; must just check whether intersection lies within the range of segment. CCW Function.

Download Presentation

Computational Geometry

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computational Geometry Robin Visser

  2. Terminology • Point • Line • Line segment • Ray

  3. Line – Line Intersection • Given two lines, calculate their intersection. • Can do a similar thing for line segments; must just check whether intersection lies within the range of segment.

  4. CCW Function • Determine whether a given set of three ordered points go counter-clockwise or clockwise.Use this: If 0, then collinear If positive, then “left turn” If negative, then “right turn”

  5. Convex Hull • Jarvis March (“Gift Wrapping” algorithm)- Runs in O(nh) (Worst case: O(n2) ) • Graham Scan- Runs in O(n log n)

  6. Jarvis March • Pick a point on convex hull. • Loop through all points and find the one that forms the minimum sized anticlockwise angle off the horizontal axis from the previous point. • Continue until you encounter the first point.

  7. Graham Scan • Pick a point on convex hull. • Sort all other points angularly around this point. • Add the first two points to the hull. • For every next point, check if that point, along with the preceding two, form a “right turn” or a “left turn”. • If “right turn”, remove second last point, if “left turn”, move on to next point. • Continue until you encounter the first point.

  8. Graham Scan

  9. Graham Scan

  10. Graham Scan

  11. Graham Scan

  12. Graham Scan

  13. Graham Scan

  14. Graham Scan

  15. Graham Scan

  16. Graham Scan

  17. Graham Scan

  18. Graham Scan

  19. Graham Scan

  20. Graham Scan

  21. Graham Scan

  22. Graham Scan

  23. Graham Scan

  24. Graham Scan

  25. Graham Scan

  26. Point in Polygon • Extend point in random direction (forming a ray) • Find number intersections with polygon. • If even  outside • If odd  inside

  27. Point in Polygon • Extend point in random direction (forming a ray) • Find number intersections with polygon. • If even  outside • If odd  inside

  28. Point in Polygon • Extend point in random direction (forming a ray) • Find number intersections with polygon. • If even  outside • If odd  inside

  29. Area of Polygon • Formula for the area of a polygon given n vertices in order:

  30. Questions?

More Related