Hmm, I don't have time to check if my solution is accurate, but if you measure the angles at each corner (measured from the vertical line downwards), the first angle is always:
And subsequent angles follow the pattern:
So I guess the i-th vertical line always has the length:
where $\ell$ is the length of the polygon's sides.
Moreover, there are such verticals so you can stop the algorithm after that many.
Will check this more carefully tomorrow, I'm on the go now. I wonder if applying your formula works out to find the pattern mentioned in my most recent comment.
reply