Problem with visibility polygon computation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with visibility polygon computation

Natanael Ramos
Hi all,

I'm using CGAL (v. 4.14-2) to compute the visibility region (polygon) within a simple polygon from one of its vertices, using the Simple_polygon_visibility_2 class.
On a particular combination of polygon/vertex, I'm getting the following assertion error:

terminate called after throwing an instance of 'CGAL::Assertion_exception'
  what():  CGAL ERROR: assertion violation!
Expr: k+1<vertices.size()
File: /usr/include/CGAL/Simple_polygon_visibility_2.h
Line: 678

This occurs in the method scan_edges of the class Simple_polygon_visibility_2, it seems like there should be some intersection with the given segment/ray, but none was found.

When I run the same code with the class Triangular_expansion_visibility_2, it seems to work, giving the output:

regularized visibility region of q has 8 edges:
[7968/1 492/1 -> 7938/1 428/1]
[7884/1 408/1 -> 7968/1 492/1]
[8040/1 428/1 -> 7884/1 408/1]
[1318831/163 428/1 -> 8040/1 428/1]
[550099518/67867 31141784/67867 -> 1318831/163 428/1]
[8090/1 456/1 -> 550099518/67867 31141784/67867]
[7968/1 446/1 -> 8090/1 456/1]
[7938/1 428/1 -> 7968/1 446/1]

I'm attaching a minimal work example, together with the input file.

The input file has in each line the polygon vertex id, followed by its x- and-coordinates. The query point is the one with id 1716.

Could anyone help me with this issue?

Thank you all in advance.

CMakeLists.txt (1K) Download Attachment
vis_poly.cpp (4K) Download Attachment
polygon (124K) Download Attachment