//--------------------------------------------------------------------------------- vector<vector<Point>> PAN::mergecontours(vector<vector<Point>> contours){ vector<vector<Point>> contourCOG; getcenter(contours, contourCOG); contours._Pop_back_n(contours.size());//empty contours and push merged contours into it for (unsigned int i = 0; i < contourCOG.size(); i++){ float field = contourCOG[i][0].y; vector<int> matchindex = findnear(contourCOG, field, INLINE_Y, 0.30); if (matchindex.size() <=1){ vector<Point> temp; temp.push_back(Point(contourCOG[i][1].x - BUFFER, contourCOG[i][1].y - BUFFER)); temp.push_back(Point(contourCOG[i][2].x + BUFFER, contourCOG[i][2].y + BUFFER)); if (temp[0].x < 0){ temp[0].x = 0; } if (temp[0].y < 0){ temp[0].y = 0; } if (temp[1].x > panimage.x_right){ temp[1].x = panimage.x_right; } if (temp[1].y > panimage.y_lower){ temp[1].y = panimage.y_lower; } //please check boundary conditions contours.push_back(temp); } else{ int minx = contourCOG[i][2].x, maxx = contourCOG[i][1].x, miny = contourCOG[i][2].y, maxy = contourCOG[i][1].y; Point finalCOG; //merging begins unsigned int j; for (j=0; j < matchindex.size(); j++){ if (contourCOG[matchindex[j]][1].x < minx){ minx = contourCOG[matchindex[j]][1].x; } if (contourCOG[matchindex[j]][1].y < miny){ miny = contourCOG[matchindex[j]][1].y; } if (contourCOG[matchindex[j]][2].x > maxx){ maxx = contourCOG[matchindex[j]][2].x; } if (contourCOG[matchindex[j]][2].y > maxy){ maxy = contourCOG[matchindex[j]][2].y; } } vector<Point> temp; temp.push_back(Point(minx , miny)); temp.push_back(Point(maxx, maxy)); if (temp[0].x < 0){ temp[0].x = 0; } if (temp[0].y < 0){ temp[0].y = 0; } if (temp[1].x > panimage.x_right){ temp[1].x = panimage.x_right; } if (temp[1].y > panimage.y_lower){ temp[1].y=panimage.y_lower; } finalCOG = Point((temp[0].x + temp[1].x) / 2, (temp[0].y + temp[1].y) / 2); if (isrepeat(contours,finalCOG)){ contours.push_back(temp); } } } return contours; }
int main(){ int i,j,k,l,test,t=1; // freopen("in.txt","r",stdin); point a,b,c; while(scanf("%lf %lf",&a.x,&a.y)==2){ scanf("%lf %lf %lf %lf",&b.x,&b.y,&c.x,&c.y); point cen=getcenter(a,b,c); double r=dist(a,cen); double ans=(double)2.0*r*pi; printf("%.2lf\n",ans); } return 0; }