知道圆上2点 再连接圆心与2点 求夹角
只有2点和圆心的坐标 还有半径 要怎么求哦 谢谢咯有能直接求角度或者弧度的函数么
#include<math.h> #define PI 3.1415926535897932384626433832795 double angle(double x0, double y0, double x1, double y1, double x2, double y2) { double r1, r2, dx1, dy1, dx2, dy2, a1, a2, da; dx1 = x1 - x0; dy1 = y1 - y0; dx2 = x2 - x0; dy2 = y2 - y0; r1 = sqrt(dx1 * dx1 + dy1 * dy1); r2 = sqrt(dx2 * dx2 + dy2 * dy2); a1 = acos(dx1 / r1); if(dy1 < 0) a1 = -a1; a2 = acos(dx2 / r2); if(dy2 < 0) a2 = -a2; da = a2 - a1; if(da < 0) da = -da; if(da > PI) da = 2 * PI - da; return da; } void point(double x0, double y0, double r, double angle, double * x, double * y) { *x = x0 + r * cos(angle); *y = y0 + r * sin(angle); }