double k12=(double)(startx[0]-startx[1])/(starty[1]-starty[0]);
double k23=(double)(startx[1]-startx[2])/(starty[2]-starty[1]);
//垂直平分線的斜率
double ax=(double)(startx[0]+startx[1])/2,ay=(double)(starty[0]+starty[1])/2;
double bx=(double)(startx[1]+startx[2])/2,by=(double)(starty[1]+starty[2])/2;//兩個中點的座標
double rx=(double)(by-ay-bx*k23+ax*k12)/(k12-k23);
double ry=(double)(k12*(rx-ax)+ay);//圓心座標
double doublerad=(double)sqrt((rx-startx[0])*(rx-startx[0])+(ry-starty[0])*(ry-starty[0]));
r=int(doublerad);
上面已確定拉圓心,半徑,後用正負法畫圓就ok拉
好像是這樣的,用Ellipse函數了。
假設三點為A、B、C,兩兩相連,再分別畫AB、AC、BC的垂直平分線,其焦點即為圓心,和任一點的距離即為半徑
隨便畫畫 也出來`