For an arbitrary vertex in an arbitrary polygon how to determine which of the vertex's angles lies inside the polygon knowing only the coordinates?

61 Views Asked by At

Could someone explain to me how to do what the title states?

For an arbitrary vertex in an arbitrary polygon how to determine which of the vertex's 2 angles lies inside the polygon knowing only the vertices' coordinates?

  • the dimension is 2d, i.e. the polygon lies on the XY plane. There is no problem to add a dimension, if necessary
  • I know all the coordinates of the vertices.

My problem is that the polygon may be very arbitrary, e.g. like the below one, and how do I know which of the 2 angles lies inside the polygon (the blue one or the green one)?

arbitrary polygon example and the problem illustration

1

There are 1 best solutions below

2
On

If you have a list of the vertices taken clockwise (for instance): $$ (V_1, V_2, \dots, V_n) $$ then you must take $\alpha_k=\angle V_{k-1}V_kV_{k+1}$ so that side $V_{k-1}V_k$ is carried to side $V_kV_{k+1}$ by a counter-clockwise rotation of $\alpha_k$.

In practice, that means that if $(V_{k-1}-V_k)\times(V_{k+1}-V_k)>0$ then you must take $\alpha_k<180°$, if $(V_{k-1}-V_k)\times(V_{k+1}-V_k)<0$ then you must take $\alpha_k>180°$, where:

$$ u\times v=\det\pmatrix{u_x & u_y \\ v_x & v_y}. $$