int xx(point a) //判断象限 { if(a.x>0&&a.y>=0)return 1; if(a.x<=0&&a.y>0)return 2; if(a.x<0&&a.y<=0)return 3; if(a.x>=0&&a.y<0)return 4; } double cj(node a,node b,node c) //叉积计算 { return (a.x-c.x)*(b.y-c.y)-(b.x-c.x)*(a.y-c.y); } bool cmp(point a,point b) //先按象限从小到大排序 再按极角从小到大排序 { if(xx(a)==xx(b))return cj(a,b)>0; //逆时针排序 else return xx(a)<xx(b); }