1
Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005
1
Computational Geometry
Exercise session #3
Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005
2
Session topics
- The plane sweep paradigm
- Visibility of a point
Problem description and motivation Solution with a rotating sweepline
- Maxima of a point set
- Homework number 2
Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005
3
The plane sweep paradigm
- Sweep the plane with a line, maintain the
status of the line, update it at scheduled event points, and maintain the sweep invariant.
- Details are problem-dependent, but general
approach is similar to all sweep algorithms.
- Required data structures:
The event structure The status structure The invariant structure (partial problem solution)
Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005
4
Example: line segment intersection
- Events
Endpoints of segments or detected intersection points. DAST: a balanced binary search tree ordered according to y coordinate (x coordinate breaks ties)
- Status
Segments intersection by horizontal line at current y coordinate. DAST: a balanced binary search tree according to segment
- rder on horizontal line.
- Invariant
All intersection points above line were reported. DAST: list of reported intersection points.
Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005
5
Visibility of a point
visible not visible weakly visible
p
Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005
6
Uses of point visibility
- Guarding: a guard can watch all visible
vertices from this point.
How many guards needed for guarding all vertices?
- Path planning: all visible vertices can be
reached by a straight line from the points,
- thers need polyline paths.