Description
Based on recent assignment at work, I have become interested in computational geometry. So, I am trying to implement a visibility polygon as to explore some fundamental concepts and ideas.
The objective is to derive a visibility polygon. I have implemented a mock-up module, but I struggle to get the actual polygon... I was wondering if somebody could throw in some pointers on how to proceed.
Code:
Module[
{module, vision, obstacle, bVision, bObstacle},
module = Polygon[{{0, 0}, {10, 0}, {10, 8}, {5, 8}, {5, 12}, {0, 12}}];
vision = Disk[{1, 1}, 5, {Pi/6, Pi/2}];
obstacle = Rectangle[{2, 1}, {6, 3}, RoundingRadius -> .5];
bVision = MeshCoordinates @ BoundaryDiscretizeRegion @ RegionDifference[vision, obstacle];
bObstacle = MeshCoordinates @ BoundaryDiscretizeRegion @ obstacle;
Graphics[{
{FaceForm @ White, EdgeForm @ {Black, Thick}, module},
{FaceForm @ White, EdgeForm @ {Black, Thick}, vision},
{FaceForm @ White, EdgeForm @ {Blue, Thick}, obstacle},
{Red, PointSize -> 0.015, Point @ bVision},
{Green, PointSize -> 0.015, Point @ bObstacle},
(*The idea was to use these lines for RegionIntersection...The idea failed...*)
Line @ {{1, 1}, #} & /@ bVision
}, ImageSize -> {300, 300}]
]
Visibility Region of a Polygon
. $\endgroup$