问题
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