Efficient Computation of Visibility Polygons
Determining visibility in planar polygons and arrangements is an important subroutine for many algorithms in computational geometry. In this paper, we report on new implementations, and corresponding experimental evaluations, for two established and one novel algorithm for computing visibility polygons. These algorithms will be released to the public shortly, as a new package for the Computational Geometry Algorithms Library (CGAL).
💡 Research Summary
The paper presents three exact implementations of visibility‑polygon algorithms for planar polygons, to be released as a new CGAL package, and evaluates them experimentally. The first implementation follows the classic Joe‑Simpson algorithm, which runs in linear time O(n) for simple polygons. It processes the polygon boundary sequentially, maintaining a stack that represents the current visibility polygon. The implementation uses a state machine and a winding counter to correctly handle polygons that wind more than 360°, and it produces the final stack of vertices defining V(q). The second implementation is Asano’s rotational‑sweep algorithm, which runs in O(n log n) time and O(n) space. All vertices are sorted by polar angle around the query point q, and a balanced binary tree stores the set of edges intersected by the rotating ray L. Whenever the closest edge in the tree changes, a new vertex of the visibility polygon is emitted. Crucially, the ordering of edges along L is decided without constructing explicit intersection points; at most five orientation predicates are required, which fits perfectly with CGAL’s exact‑kernel arithmetic. The third contribution is a novel “triangular expansion” algorithm. After a preprocessing step that triangulates the input polygon (using CGAL’s constrained Delaunay triangulation), the algorithm locates the triangle containing q and recursively expands the view through each triangle edge. The recursion maintains two reflex vertices that bound the current visibility cone; each step adds at most one new vertex after a constant‑time orientation test. In the worst case the algorithm may visit O(n²) triangle‑edge combinations (e.g., a polygon with Θ(n) holes arranged to split the view into Θ(n) cones), but for simple polygons the runtime collapses to O(n). Empirically, the algorithm behaves almost output‑sensitive: it processes only the triangles actually seen, which is often a tiny fraction of the whole triangulation. All three implementations use exact arithmetic, handle degenerate configurations, and optionally output one‑dimensional “antennae” when the query point lies on a collinear set of vertices.
The experimental study was conducted on an Intel Core i7‑3740QM (2.70 GHz) under 64‑bit Linux, using CGAL 4.3. Three test sets were used: a large simple polygon (“Norway”, ≈20 981 vertices), a moderate‑size polygon with holes (“Cathedral”, ≈1 209 vertices), and a synthetic worst‑case instance with Θ(n) holes that forces the triangular expansion algorithm into its quadratic behavior. Results show that for realistic data (Norway and Cathedral) the triangular expansion algorithm outperforms the other two by roughly two orders of magnitude in average query time (≈0.18 ms per query versus ≈1.35 ms for Asano and ≈5.6 ms for Joe‑Simpson). The preprocessing overhead of triangulation is modest, and the total time (including preprocessing) remains well below that of the other methods. In the synthetic worst‑case, however, the O(n log n) rotational sweep eventually becomes faster as the input size grows, confirming the theoretical bound.
Overall, the paper makes three concrete contributions: (1) it fills a gap in CGAL by providing exact, robust implementations of classic visibility‑polygon algorithms; (2) it introduces a new triangulation‑based algorithm that, despite a quadratic worst‑case bound, delivers superior practical performance on typical geometric inputs; and (3) it supplies a thorough experimental comparison that validates the efficiency claims and highlights the trade‑offs between preprocessing cost, worst‑case guarantees, and average‑case speed. These results are valuable for any computational‑geometry application that relies on fast visibility queries, such as art‑gallery problem solvers, motion planning, and interactive graphics.
Comments & Academic Discussion
Loading comments...
Leave a Comment