const double INF=1e16;
const double eps=1e-8;
const int N=60000;
struct Point{
double x,y;
Point(double _x=0,double _y=0):x(_x),y(_y){}
friend Point operator +(Point A,Point B){return Point(A.x+B.x,A.y+B.y);}
friend Point operator -(Point A,Point B){return Point(A.x-B.x,A.y-B.y);}
friend Point operator *(Point A,double k){return Point(A.x*k,A.y*k);}
friend Point operator /(Point A,double k){return Point(A.x/k,A.y/k);}
double ang(){return atan2(y,x);}
void read(){scanf("%lf%lf",&x,&y);x*=1.0;y*=1.0;}
}p[N],a[N];
int cmp(double x){
if(fabs(x)<eps)return 0;
return x>eps?1:-1;
}
bool equal(double x,double y){
return cmp(x-y)==0;
}
typedef Point Vector;
struct Line{
Point p;
Vector v;
Line(Point _p=Point(0,0),Vector _v=Vector(0,0)):v(_v),p(_p){}
double Ang;
double ang(){return v.ang();}
}l[N],temp[N],convex_hull[N];
bool comp(Line A,Line B){
return A.Ang<B.Ang;
}
double Cross(Vector A,Vector B){
return(double)(A.x*B.y-A.y*B.x);
}
Point getpot(Line A,Line B){
return B.p+B.v*((double)Cross(A.v,A.p-B.p)/(double)Cross(A.v,B.v));
}
bool in(Point p,Line l){
return cmp(Cross(l.v,p-l.p))>=0;
}
模板 向量
最新推荐文章于 2021-11-09 18:40:10 发布