# Construct irregular convex polygon given a list of sides

I want to construct a convex irregular polygon given a list of sides.

With the condition that the longest side is =< than the sum of the other sides.

I realise there are many possible polygons which can be formed, I would appreciate any pointers.

I have considered a brute force approach using a type of random walk through the angles until the first and last points of the polygon meet, but that does seem silly

Many Thanks

Start with a line segment $$A_1A_2$$ of length $$\ell_1$$.
Assume we already have points $$A_1,\ldots,A_k$$ for some $$k\le n-2$$ and $$|A_1A_k|<\ell_{k}+\cdots+\ell_n$$. Choose arbitrary $$\ell$$ with $$|A_1A_k|-\ell_{k}<\ell<\ell_{k+1}+\cdots+\ell_n$$ and construct $$A_{k+1}$$ such that $$|A_kA_{k+1}|=\ell_{k}$$ and $$|A_{k+1}A_1|=\ell$$.
Repeat until you have $$A_{n-1}$$ with $$|A_1A_{n-1}|<\ell_{n-1}+\ell_n$$, and construct $$A_N$$ such that $$|A_{n-1}A_n|=\ell_{n-1}$$ and $$|A_{n}A_1|=\ell_{n}$$.
This will construct a simple polygon with the correct side lengths, but not neccesarily convex. As long as you find a vertex $$A_k$$ with angle $$>180^\circ$$, replace it with its reflection at line $$A_{k-1}A_{k+1}$$. This will terminate after finitely many steps (why?), which means that you reached a convex polygon.