How can I tell what is the first segment to the right of AB? So we start walking from A, reach B and then I need to go most right - to C. But how do I find this mathematically? Bear in mind that there could be more segments from B in any direction. (some of them or all of them could be to the left of B - in my image C and D are to the right)
We do have all coordinates of vertices - x and y!
I am thinking to
- find if C and D are to the right or left of line going trough AB,
- if both are to the right, draw a perpendicular from C to AB and a perpendicular from D to AB and the shortest distance from A to the perpendiculars is the winner?