title: Check if line is lying inside of polygon
body: <p>In my problem I have an conveyor belt on which a piece of luggage is moving in counterclockwise direction (so left is inside every time when moving alongside the luggage). I know have a line that is possibly lying inside of the conveyor belt. The conveyor belt is modelled by lines with their start and end point as well as the line to check is. The starting point of the line to check is equal to the starting point of one of the conveyor belt's lines (conveyor belt is a simple polygon). My approach was to check if the clockwise angle around this point (starting from the line being part of the conveyor belt) is greater than 180 degrees (than it would be inside) but that doesn't work for all cases. I can minimize the number of failures by laying the line alongside the previous starting point (of the previous line of the conveyor belt) but there are still some cases where this doesn't work.</p>
  
  <p>Thanks for your help, I'll provide any further information needed if I can.</p>
  
  <p>EDIT:
  It would work for the following with alpha being 333 degrees but beta only 171; the blue line is thus outside of the (black) conveyor belt:<a href="https://i.stack.imgur.com/AXOYk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AXOYk.png" alt="enter image description here"></a></p>
  
  <p>However it wouldn't work for other examples. Imagine the upper part of this image on the right side, too (would look like a castle then ;), a line starting from the blue right point to the then upper right hand corner (would be coordinate (3,2)), would have an alpha value less than 180 (145) and thus it would be considered lying outside though it is actually inside.</p>