Originally Posted by

**DivideBy0** Doh! Thanks, I tried starting by giving the octagon a side length of 1 and working my way inwards :P

Say, if you tried with my approach, how would you get the length of the longer diagonal?

Hello,

in this case you have to use a little bit trigonometrie:

let s be the length of one side of the octagon.

Then you deal with 8 isosceles triangle with the base s, the two legs r and the angle at the vertex (that is the center of the circle) is 45°.

Now divide one isoscele triangle into 2 right triangles:

The hypotenuse is r and one leg is ½s, the angle opposite of this leg is 22.5°.

Now you can calculate r: Code:

½s ½s
----- = sin(22.5°) ==> r = ----------
r sin(22.5°)

The longest diagonal D = 2r

Let d be the shortest diagonal. Then ½d is the height in one of the isoscele triangles:

Now you can calculate ½d: Code:

½d ½d
----- = sin(45°) ==> r = ----------
r sin(45°)

By the way: This last equation is exactly the same as the one I've posted in my previous post.

EB