How to find the area of a segment of a circle if we know the radius and an angle?

吃可爱长大的小学妹 提交于 2019-12-12 03:36:22

问题


I have some problems to find an area of a segment of a circle.

I try to use this formula but have another result, as here http://planetcalc.com/1421/ , i use calculator circle segment area to check my result from terminal.

my code:

#define PI 3.14159265

double r = 12;
double a = 22;
double result = ((r*r)/2)*(PI*(a/180)-sin(a));

回答1:


You have to correct your sin calculations a bit, it should look like this:

sin(M_PI * angle / 180)


来源:https://stackoverflow.com/questions/35807728/how-to-find-the-area-of-a-segment-of-a-circle-if-we-know-the-radius-and-an-angle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!