-1

I am trying to find an algorithm that would take a sequence of edge lengths as input and form a convex polygon with these edges. I know that such convex does not always exist, but I am working with data where it should exist.

Basically I am trying to figure out the angles between the edges. When I know them, I can also calculate the coordinates of the corners.

Andres Traumann
  • 144
  • 1
  • 8
  • 1
    You need more information than the edge lengths and their order. Take 4 equal-length edges that form a square (convex polygon). Now decrease one of the angles as much as you like, forming a rhombus (still a convex polygon). Obviously there are infinitely many possibilities. – beaker Sep 06 '14 at 15:43
  • This is better suited for math.stackexchange.com. – Abhishek Bansal Sep 06 '14 at 15:44

1 Answers1

0

Greedily place edges end-to-end until adding the next edge would consume more than half of the available length. This gives you one side of the triangle. Another side of the triangle will be the next edge, and the third side will be all remaining edges. You can work out the trigonometry.

tmyklebu
  • 13,915
  • 3
  • 28
  • 57