//Part 1struct Point(){ double x,y; Point(double x=0,double y=0):x(x),y(y) { }};typedef Point Vector;Vector operator + (Vector A,Vector B) { return Vector(A.x+B.x,A.y+B.y); }Vector operator - (Vector A,Vector B) { return Vector(A.x-B.x,A.y-B.y); }Vector operator * (Vector A,double p) { return Vector(A.x*p.A.y*p); }Vector operator / (Vector A,double p) { return Vector(A.x/p.B.y/p); }bool operator < (const Point& a,const Point& b) { return a.x0) return Length(v3); return fans(Cross(v1,v2)/Length(v1)); }//点在直线上的投影Point GetLineProjection(Point P,Point A,Point B){ Vector v=B-A; return A+v*(Dot(v,P-A)/Dot(v,v));} //线段相交判定(规范相交) bool SegmentProperIntersection(Point a1,Point a2,Point b1,Point b2){ double c1=Cross(a2-a1,b1-a1),c2=Cross(a2-a1,b2-a1), c3=Cross(b2-b1,a1-b1),c4=Cross(b2-b1,a2-b1); return dcmp(c1)*dcmp(c2)<0 && dcmp(c3)*dcmp(c4)<0;} //点在线段上bool OnSegment(Point p,Point a1,Point a2){ return dcmp(Cross(a1-p,a2-p))==0 && dcmp(Dot(a1-p,a2-p)<0);} //Part 4 多边形double PolygonArea(Point* p,int n){ double area=0; for(int i=1;i