Polygon meets arc

Algorithm:

Explanation

This is a thing I wrote to find the simplest polygon that is within an arc, but not outside it. It was used as a basis for showing the playable area in snygg.

The code for finding these points boils down to finding the angle distance between the points on the outer radius (called sigma in the code):


where gen_points is the following algorithm (change with the radio button above):