-
Mathematical Restart...
As an easy restart into the ways of the math, here is a quick question. First correct answer (there are more than one) wins.
The question is:
"Devise a formula for the area of a regular polygon with the following variables:
n - number of sides
l - length of each side"
The prize is the knowing you're a winner :D .
-
Easier to develop an algorithm, thinking of the regular polygon as being made of N isosceles triangles.
Angle = Pi / N, which is half the angle opposite the base of triangle.
Height = Length / 2*Tan(Angle), which is height of a triangle
Area = N*Length*Height / 2
Area = N*length2 / 4*Tan( Pi / N ), if I made the substitutions correctly.
-
Area = (L^2 * N) / (4 * Tan(pi / N)) 'radians
Area = (L^2 * N) / (4 * Tan(180 / N)) 'degrees
In VB the Tan function expects radians. If N = 0, 1, 2 an error should occur, however, since pi is not exact the above formula for radians will not catch the errors for 1 or 2 sides.
-
Can u tell me when N will be 0, 1 or 2 for a polygon?:rolleyes:
-
If the formulas are used in VB you must consider every possibility regarding user interaction.
-
Yeh both correct Guv and JohnVB6. Someone else post a new thread now.