Generalizing Pythagorean Theorem: equations defining edges of a (convex) $n$-gon with $n-2$ prescribed angles? Let $n\geq 3$ be an integer and $0<\alpha_1, \dots ,\alpha_{n-2}<1$. Let's say a tuple of positive numbers $(e_1,\dots, e_n)$ is nice if there is a convex $n$-gon $A_1\dots A_n$  such that $\hat A_i=\pi\alpha_i$ and edge lengths $\overline{A_iA_{i+1}}=e_i$.
(The convexity condition probably will make things rather more complicated, so I will be happy to drop that)
Pythagorean theorem says that with $n=3$ and $\alpha_1=1/2$, the nice tuples are precisely the intersection of the variety $e_2^2=e_1^2+e_3^2$ with the positive orthant. Of course similar result holds for any $\alpha_1$ and $n=3$.
Question: what about $n>3$? My guess is the set of nice tuples is still the intersection of an algebraic scheme with the positive orthant (or some polytope in it). If so, what is known about the equations defining such schemes (obviously they are homogenous, but what about things like degrees)? Any reference for such kind of problems?
(Update Apr 2021): I asked Hendrik Lenstra and he confirmed that the statement mentioned by Henri Cohen below appeared as a Proposition in his thesis (which unfortunately he has no copies left). Also according to Lenstra, it might have appeared in Nieuw Archief voor Wiskunde, but quite probably in Dutch, and I have not been able to track it down.
 A: Not an answer but related: This reminds me of a nice exercise of Hendrik Lenstra: if $P$ is a polygon
(not necessarily convex) with all edge lengths equal and all but two
consecutive (important!) angles rational multiples of $\pi$, then so are
the last two.
A: One has $$\overrightarrow{A_nA_1} + \cdots + \overrightarrow{A_{n-2}A_{n-1}} = \overrightarrow{A_nA_{n-1}}.$$
Taking the squared norm of both sides one arrives at
$$\sum_{i=1}^{n-1} e_{i-1}^2 + 2 \sum_{1\le i < j\le n-1}e_{i-1}e_{j-1}\cos\sum_{k=i}^{j-1}(\pi-\alpha_i) = e_{n-1}^2,$$
which is the equation we are looking for.
For $n=4$ I studied this equation some years ago from a different viewpoint: given the side lengths of a quadrilateral, how are two of its adjacent angles related? The above equation answers this question. It turns out that it can be rewritten as follows:
$$a_1^2a_2^2x_{22} + a_1^2x_{20} + a_2^2x_{02} + 2a_1a_2x_{11} + x_{00} = 0,$$ where
\begin{gather*}
a_1=\cot\frac{\alpha_1}2, \quad a_2 = \cot\frac{\alpha_2}2,\\
x_{22} = (e_1-e_2-e_3-e_4)(e_1-e_2+e_3-e_4),\\
x_{20} = (e_1+e_2+e_3-e_4)(e_1+e_2-e_3-e_4),\\
x_{02} = (e_1-e_2+e_3-e_4)(e_1-e_2-e_3+e_4),\\
x_{11} = -4e_2e_4,\\
x_{00} = (e_1+e_2-e_3+e_4)(e_1+e_2+e_3+e_4).
\end{gather*}
