For an n sided polygon divided up into n triangles, i want the triangle "index" from a coordinate inside the polygon
Example:

The coordinates at the green dot should give 2, the red dot should give 5 and the blue dot should give 3
Coordinate range is from 0 to diameter of the polygon
The polygon is not necessarily a 6 sided polygon
Solved it using this(C# code but can probably be converted into math equation)
sector is the number of the sector, originRelativePos is position relative to the origin