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

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.
Edit 2: Sorry, my solution made an incorrect assumption.
 A: 
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}.$$
A: I think you may have made a mistake in the final part of your calculation since
$$
\tan((\pi - \beta)/4) = \sec(\beta/2) - \tan(\beta/2) \neq \tan(\beta/4)
$$
The general equation that I obtain for the length of $CD$ is
$$
|\delta\tan(\beta/2) - \text{ML}\sec(\beta/2)|,
$$
which agrees with your corrected equation when $\text{ML} = \delta$.
