Nothing Special   »   [go: up one dir, main page]

Skip to content

Polygon Visibility

Justin edited this page Mar 11, 2022 · 3 revisions

CGAL provides the polygon visibility algorithm for polygons.

This is provided through the PolygonVisibility class of which a static instance can be used as follows.


//To compute the visibility you need a polygon 
//and a point that is inside the polygon.
var point = new Point();
vat poly = new Polygon2<EIK>(points);

//Get the instance object.
var instance = PolygonVisibility<EIK>.Instance;

//If you know the input is good then checking 
//can be disabled which can increase perform.
//instance.CheckInput = false;

PolygonWithHoles2<EEK> region;
if(instance.ComputeVisibility(point, poly, out region))
{
    //The op was successful
    region.Print();
}

Below is a image of the visibility region.

PolygonVisibility

Clone this wiki locally