This dynamic figure is inspired by the polynomial cages discussed in here.
An octagon is set in a triangle. On each side of the triangle, there should be at least two vertices of the triangle. Adjust the vertices to minimize th \[ \sum_{s\in S}(\ell(s)-L)^2+\sum_{a\in A} (a-\alpha)^2, \] where \(S\) is the set of all vertices, \(A\) is the set of all angles, and \[ \alpha=\frac{\pi(8-2)}{8},\quad L=0, \] are the average of the angles and \(L=0\).