Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computational Geometry The systematic study of algorithms and data structures for geometric objects, with a focus on exact algorithms that are asymptotically.

Similar presentations


Presentation on theme: "Computational Geometry The systematic study of algorithms and data structures for geometric objects, with a focus on exact algorithms that are asymptotically."— Presentation transcript:

1 Computational Geometry The systematic study of algorithms and data structures for geometric objects, with a focus on exact algorithms that are asymptotically fast. Applications in Computer graphics VLSI design CAD/CAM Robotics Geographic Information Systems Geometric Modeling

2 Example 1 Proximity Closest café on campus? Voronoi diagram Delaunay triangulation

3 Example 2 Path Planning Robot How can a robot find a short route to the destination that avoids all obstacles?

4 Line Segments & Vectors p = (x, y ) 1 2 O = (0, 0)x y 1 2 Points (vectors): p, p, p p = p p 1 2 1 2 2 1 p = (x x, y y ) 1 2 Line segment: p p = p p 2 1 1 2

5 Cross (Vector) Product x y (0, 0) p p 1 p + p 1 2 2 p p is the signed area of the parallelogram. 1 2 p p = x y x y = p p = |p | |p | sin 1 2 1 2 2 1 2 1 1 2 p and p are collinear iff p p = 0. 1 2 1 2

6 Turning of Consecutive Segments Counterclockwise Clockwise No turn (collinear) p p p 0 1 2 p p p 0 1 2 pp p 0 12 p p p p > 0 0 1 0 2 p p p p < 0 0 1 0 2 p p p p = 0 0 1 0 2 Segments p p and p p. Move from p to p then to p. 0 1 1 2 0 1 2

7 Dot (Inner) Product x y (0, 0) p p 1 2 p p = x x + y y = p p = |p | |p | cos 1 2 1 2 1 2 2 1 1 2

8 A Segment & a Collinear Point p q r r p q q,r p Cross product is zero: pr pq = 0. // p, q, r collinear Does a line segment pq contain a collinear point r? Check the sign of the dot product rp rq Sign of rp rq + 0

9 Two Segments Intersect? One method: solve for the intersection point of the two lines containing the two line segments, and then check whether this point lies on both segments. In practice, the two input segments often do not intersect. Stage 1: quick rejection if their bounding boxes do not intersect Case 1: bounding boxes do not intersect; neither will the segments. bounding boxes (x, y ) 2 (x, y ) 1 3 4 x x y y 4 1 3 2 if and only if L M L right of M? L left of M? L above M? L below M?

10 Bounding Box Case 2: Bounding boxes intersect; the segments may or may not intersect. Needs to be further checked in Stage 2.

11 Stage 2 Two line segments do not intersect if and only if one segment lies entirely to one side of the line containing the other segment. p 1 p 2 p 3 p 4 ( p p ) ( p p ) and ( p p ) ( p p ) are both positive! 3 2 1 2 4 2 1 2

12 Necessary and Sufficient Condition p p 1 2 p p 3 4 Two line segments intersect iff each of the two pairs of cross products below have different signs (or one cross product in the pair is 0). (p p ) ( p p ) and ( p p ) ( p p ) 1 4 3 4 2 4 3 4 3 2 1 2 4 2 1 2 p 1 p 2 p 3 p 4 3 1 // the line through p p // intersects p p. 4 23 // the line through p p // intersects p p. 4 12


Download ppt "Computational Geometry The systematic study of algorithms and data structures for geometric objects, with a focus on exact algorithms that are asymptotically."

Similar presentations


Ads by Google