There is an axis-parallel (orthogonal) simply-connected polygon given as a list of corners. How can I know whether a certain vertical segment has the interior of the polygon on its east or on its west?
For example, in the following polygon:
(0,0) (0,1) (1,1) (1,0) (0,0)
The first segment, $(0,0)-(0,1)$, has the interior on its east, and the third segment, $(1,1)-(1,0)$, has the interior on its west. But in the following polygon:
(0,0) (0,1) (1,1) (1,0) (2,0) (2,2) (-1,2) (-1,0) (0,0)
The first three corners are just like the first polygon, but here the first segment, $(0,0)-(0,1)$, has the interior on its west.
The order of the input can be reversed:
(0,0) (1,0) (1,1) (0,1) (0,0)
In this case, the second segment has the interior on its west and the fourth has the interior on its east.
How can I know which case I am at?


This is an instance of what is generally known as the Point in Polygon problem. Assuming all your vertex coordinates are integral, you essentially want to find out if (-0.5, 0.5) or (0.5,0.5) are on the interior of the polygon.
One thing you need to do is decide on how you will deal with complicated cases like loops in the polygon edge. The usual course is to decide on the even-odd rule or the nonzero winding number rule. Or you could assume that the polygon has a noncrossing boundary.
Once you have all this decided, you cast a ray out from your test point and apply the counting rule you have chosen.