[Math] Trigonometry algorithm: polygon offsetting

algorithmsgeometrypolygonstrigonometry

I'm having trouble working out an algorithm required for polygon offsetting.
I think it's best explained by the illustration…
Polygon Offsetting Image

I have worked out a solution for when $ML=\delta$ (see below) but I'd like a more general solution to this problem.

Edit: Updated the solution with thanks for the help below.

enter image description here

Best Answer

a drawing of polygon offsetting

Let $m$ be the midpoint of $eb$, then extend $Ym$ and $cb$ to meet at $o$. We obtain two similar right triangles sharing an angle of $\beta/2$ at $o$. Then $$om=\frac\delta{\sin\beta/2}-ML$$ $$ob=\frac{om}{\cos\beta/2}=\frac\delta{\sin\beta/2\cos\beta/2}-\frac{ML}{\cos\beta/2}$$ $$cb=oc-ob=\frac\delta{\tan\beta/2}-\frac\delta{\sin\beta/2\cos\beta/2}+\frac{ML}{\cos\beta/2}$$ $$=\frac{\delta\cos\beta/2}{\sin\beta/2}-\frac\delta{\sin\beta/2\cos\beta/2}+\frac{ML}{\cos\beta/2}$$ $$=\frac{\delta(\cos^2\beta/2-1)+ML\sin\beta/2}{\sin\beta/2\cos\beta/2}$$ $$=\frac{ML\sin\beta/2-\delta\sin^2\beta/2}{\sin\beta/2\cos\beta/2}$$ $$=\frac{ML-\delta\sin\beta/2}{\cos\beta/2}.$$