double chaji(double ax,double ay,double bx,double by,double cx,double cy) //两条线段斜率的差,double !!! { return (by-ay)*(cx-ax)-(cy-ay)*(bx-ax); } void count(double x1,double y1,double x2,double y2,double x3,double y3) { double a,b,c,d,e,f; a=2*(x2-x1); b=2*(y2-y1); c=x2*x2+y2*y2-x1*x1-y1*y1; d=2*(x3-x2); e=2*(y3-y2); f=x3*x3+y3*y3-x2*x2-y2*y2; x=(b*f-e*c)/(b*d-e*a); y=(d*c-a*f)/(b*d-e*a); r=sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1)); } double bj(double xp,double yp,double x1,double y1) { double s=sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1)); return s; } double nodecount(double x1,double y1,double x2,double y2,double x3,double y3,double xp,double yp) { double f1=atan2(x1-x,y1-y); double f2=atan2(x2-x,y2-y); double f3=atan2(x3-x,y3-y); double f4=atan2(xp-x,yp-y);//atans(x,y)反切值函数,见c++函数应用,此时所求为(xp,yp)以(x,y)为原点的反切值 double ans1=fabs(r-bj(xp,yp,x,y));//fabs绝对值函数