简单计算几何分类讨论一下
#include<bits/stdc++.h>
#define mp make_pair
#define fir first
#define sec second
using namespace std;
typedef long long ll;
const double eps = 1e-12;
const double PI = acos(-1.0);
const int MX = 2e5+7;
double ans[MX];
struct Point {
double x, y;
Point() {}
Point(double x,double y):x(x),y(y) {}
}p[MX];
typedef Point Vector;
int dcmp(double x) { //返回x的正负
if(fabs(x)<eps)return 0;
return x<0?-1:1;
}
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, A.y/p);}
bool operator<(const Point&a,const Point&b) {return a.x<b.x||(a.x==b.x&&a.y<b.y);}
bool operator==(const Point&a,const Point&b) {return dcmp(a.x-b.x)==0&&dcmp(a.y-b.y)==0;}
double Dot(Vector A,Vector B) { //点积
return A.x*B.x+A.y*B.y;//如果改成整形记得加LL
}
double Cross(Vector A,Vector B) { //叉积
return A.x*B.y-A.y*B.x;//如果改成整形记得加LL
}
//向量长度
double Length2(Vector A) {
return Dot(A,A);
}
//向量的极角
double angle(Vector v) {
return atan2(v.y,v.x);
}
double get_t(Point p, double a, double sums, double ti)
{
double a2 = a/2;
double si = angle(p)-a2;
if(si > 0){
if(si+a < sums) return ti;
if(si > sums) return 0;
return (sums - si)*ti/a;
}
else{
if(si+a > sums) return sums*ti/a;
double ans = (si+a)*ti/a;
double ra = PI*2-sums;
if(ra < -si) ans += (-si-ra)*ti/a;
return ans;
}
return 0;
}
int main()
{
#ifdef LOCAL
freopen("input.txt","r",stdin);
#endif // LOCAL
int n,X;
double a,T,d;
scanf("%d%d",&n,&X);
scanf("%lf%lf%lf",&a,&T,&d);
for(int i = 1; i<= n; i++){
scanf("%lf%lf",&p[i].x,&p[i].y);
}
double t = X/T;
double rem = t - floor(t);
t = floor(t);
double ti = a/360*T;
double tnow = ti*t;
for(int i = 1; i <= n; i++) {
if(Length2(p[i]) < d*d + eps){
ans[i] = tnow + get_t(p[i],a*PI/180,PI*2*rem,ti);
}
else ans[i] = 0;
}
for(int i = 1; i<= n; i++)
printf("%.11f\n",ans[i]);
return 0;
}
/*
4 2
abcd
bcde
bcad
bcde
*/