area = ((length ** 2) * numSides) / (4 * (math.tan(FULL_ROTATION / (2 * numSides)\
)))

this is my thought but I can't figure it out, I always get the wrong value.

I need to get my answer in degrees. but even when i use

return math.degrees(area)

at the end of my function the answer is way off.

Recommended Answers

All 3 Replies

How about:

area = ((length**2)*numosides/4) / math.tan( math.pi/numosides )

Area isn't in degrees...

Your area formula for regular polygons should be:

area = ((length**2) * numSides)/(4 * (math.tan(math.pi/numSides)))

Your result will be square units of whatever units of measurement your sides are. You cannot get degrees for the area!

If you make the regular polygon a square with side length = 1.0, you should get an area of 1.0. A simple test to see if the area formula is correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.