lego geometry: Segments bent to a given angle make an n sided polygon

I swear this isn't homework. I'm actually ordering lego pieces from Pick-a-Brick. They have pipe segments that bend at 180 degrees (straight), 157.5, 135, 112.5, and 90 degrees. I need to know the number of sides of a polygon with those internal angles so that i know how many segments to order. If someone can show me the answer that's great, and if someone can show me how to find the answer that is better. I think i may want to make oval-like elongated polygons by mixing angles (I'm making a zeppelin :)

-
The 112.5 don't make a regular polygon. See Ross's answer. –  Cameron Buie Jun 28 '12 at 14:24

Note that all the angles differ from $180^\circ$ by multiples of $22.5^\circ$, which is $\frac{1}{16}$ of the required total rotation of $360^\circ$. So you can label the pieces as follows:

• $0$ ($180^\circ$)
• $1$ ($157.5^\circ$)
• $2$ ($135^\circ$)
• $3$ ($112.5^\circ$)
• $4$ ($90^\circ$).

A complete rotation is produced by joining together pieces whose labels sum to $16$, e.g., $1111111111111111$ or $4444$ or $13333$, with all angles rotating in the same direction. You can also produce non-convex polygons by using some counter-rotating angles, in which case their labels should be subtracted rather than added, e.g., $443(-3)443(-3)$. For a given arrangement of $N$ angles, if the polygon is intended to close, then there will be $N-2$ free length parameters left to assign. For instance, a triangle with fixed angles has a single scale parameter; four right angles produce a rectangle, for which two side lengths can be chosen freely.

-
Thanks a bunch! –  Jared Jun 29 '12 at 3:00

The external angles of a convex polygon add to 360 degrees. So if you make one with 157.5 degree bends, the external angle is 180-157.5=22.5 and you need 360/22.5=16 of them. You probably know that you need 4 90 degree bends to make a polygon. Yes, you can mix them as long as the sum works out. There will be constraints on the length of the sides to make the polygon close-think of a rectangle, for example.

-

Here are all the possible configurations, that make a complete polygon:

$$\begin{matrix} & & & 90^\circ\times4 \\ & & 112.5^\circ\times4 & 90^\circ\times1 \\ & 135^\circ\times1 & 112.5^\circ\times2 & 90^\circ\times2 \\ & 135^\circ\times2 & & 90^\circ\times3 \\ & 135^\circ\times2 & 112.5^\circ\times4 & \\ & 135^\circ\times3 & 112.5^\circ\times2 & 90^\circ\times1 \\ & 135^\circ\times4 & & 90^\circ\times2 \\ & 135^\circ\times5 & 112.5^\circ\times2 & \\ & 135^\circ\times6 & & 90^\circ\times1 \\ & 135^\circ\times8 & & \\ 157.5^\circ\times1 & & 112.5^\circ\times1 & 90^\circ\times3 \\ 157.5^\circ\times1 & & 112.5^\circ\times5 & \\ 157.5^\circ\times1 & 135^\circ\times1 & 112.5^\circ\times3 & 90^\circ\times1 \\ 157.5^\circ\times1 & 135^\circ\times2 & 112.5^\circ\times1 & 90^\circ\times2 \\ 157.5^\circ\times1 & 135^\circ\times3 & 112.5^\circ\times3 & \\ 157.5^\circ\times1 & 135^\circ\times4 & 112.5^\circ\times1 & 90^\circ\times1 \\ 157.5^\circ\times1 & 135^\circ\times6 & 112.5^\circ\times1 & \\ 157.5^\circ\times2 & & 112.5^\circ\times2 & 90^\circ\times2 \\ 157.5^\circ\times2 & 135^\circ\times1 & & 90^\circ\times3 \\ 157.5^\circ\times2 & 135^\circ\times1 & 112.5^\circ\times4 & \\ 157.5^\circ\times2 & 135^\circ\times2 & 112.5^\circ\times2 & 90^\circ\times1 \\ 157.5^\circ\times2 & 135^\circ\times3 & & 90^\circ\times2 \\ 157.5^\circ\times2 & 135^\circ\times4 & 112.5^\circ\times2 & \\ 157.5^\circ\times2 & 135^\circ\times5 & & 90^\circ\times1 \\ 157.5^\circ\times2 & 135^\circ\times7 & & \\ 157.5^\circ\times3 & & 112.5^\circ\times3 & 90^\circ\times1 \\ 157.5^\circ\times3 & 135^\circ\times1 & 112.5^\circ\times1 & 90^\circ\times2 \\ 157.5^\circ\times3 & 135^\circ\times2 & 112.5^\circ\times3 & \\ 157.5^\circ\times3 & 135^\circ\times3 & 112.5^\circ\times1 & 90^\circ\times1 \\ 157.5^\circ\times3 & 135^\circ\times5 & 112.5^\circ\times1 & \\ 157.5^\circ\times4 & & & 90^\circ\times3 \\ 157.5^\circ\times4 & & 112.5^\circ\times4 & \\ 157.5^\circ\times4 & 135^\circ\times1 & 112.5^\circ\times2 & 90^\circ\times1 \\ 157.5^\circ\times4 & 135^\circ\times2 & & 90^\circ\times2 \\ 157.5^\circ\times4 & 135^\circ\times3 & 112.5^\circ\times2 & \\ 157.5^\circ\times4 & 135^\circ\times4 & & 90^\circ\times1 \\ 157.5^\circ\times4 & 135^\circ\times6 & & \\ 157.5^\circ\times5 & & 112.5^\circ\times1 & 90^\circ\times2 \\ 157.5^\circ\times5 & 135^\circ\times1 & 112.5^\circ\times3 & \\ 157.5^\circ\times5 & 135^\circ\times2 & 112.5^\circ\times1 & 90^\circ\times1 \\ 157.5^\circ\times5 & 135^\circ\times4 & 112.5^\circ\times1 & \\ 157.5^\circ\times6 & & 112.5^\circ\times2 & 90^\circ\times1 \\ 157.5^\circ\times6 & 135^\circ\times1 & & 90^\circ\times2 \\ 157.5^\circ\times6 & 135^\circ\times2 & 112.5^\circ\times2 & \\ 157.5^\circ\times6 & 135^\circ\times3 & & 90^\circ\times1 \\ 157.5^\circ\times6 & 135^\circ\times5 & & \\ 157.5^\circ\times7 & & 112.5^\circ\times3 & \\ 157.5^\circ\times7 & 135^\circ\times1 & 112.5^\circ\times1 & 90^\circ\times1 \\ 157.5^\circ\times7 & 135^\circ\times3 & 112.5^\circ\times1 & \\ 157.5^\circ\times8 & & & 90^\circ\times2 \\ 157.5^\circ\times8 & 135^\circ\times1 & 112.5^\circ\times2 & \\ 157.5^\circ\times8 & 135^\circ\times2 & & 90^\circ\times1 \\ 157.5^\circ\times8 & 135^\circ\times4 & & \\ 157.5^\circ\times9 & & 112.5^\circ\times1 & 90^\circ\times1 \\ 157.5^\circ\times9 & 135^\circ\times2 & 112.5^\circ\times1 & \\ 157.5^\circ\times10 & & 112.5^\circ\times2 & \\ 157.5^\circ\times10 & 135^\circ\times1 & & 90^\circ\times1 \\ 157.5^\circ\times10 & 135^\circ\times3 & & \\ 157.5^\circ\times11 & 135^\circ\times1 & 112.5^\circ\times1 & \\ 157.5^\circ\times12 & & & 90^\circ\times1 \\ 157.5^\circ\times12 & 135^\circ\times2 & & \\ 157.5^\circ\times13 & & 112.5^\circ\times1 & \\ 157.5^\circ\times14 & 135^\circ\times1 & & \\ 157.5^\circ\times16 & & & \\ \end{matrix}$$

$180^\circ$ does not contribute, so you can use any number of those as long as the lengths match up.

-