#include #include #include #include using namespace std; const int MAXN = 1001; const double eps = 1e-12; int dblcmp(double x) { if(fabs(x) < eps) { return 0; } return x > 0 ? 1 : -1; } struct Point { double x, y, z; inline void input2d() { scanf("%lf%lf",&x,&y); z = 100.0; } inline void input3d() { scanf("%lf%lf%lf",&x,&y,&z); } bool operator < (const Point &point) const { if(y == point.y) { return x < point.x; } return y < point.y; } }machine[MAXN], light[3], shadow[3][MAXN], final[MAXN * 3]; int n, shadowNumber[3], shadowPoly[3][MAXN], shadowPolyTop[3], finalNumber; double operator * (const Point &x, const Point &y) { return x.x * y.y - x.y * y.x; } Point operator - (const Point &x, const Point &y) { Point r; r.x = x.x - y.x; r.y = x.y - y.y; return r; } bool operator == (const Point &a, const Point &b) { return fabs(a.x - b.x) < eps && fabs(a.y - b.y) < eps; } struct Line { Point a, b; double ang; }line[MAXN*3], stack[MAXN*3]; int lineNumber, stackTop; bool operator < (const Line &x, const Line &y) { if(fabs(x.ang - y.ang) < eps) { return (y.b - x.a) * (x.b - y.a) > eps; } return x.ang < y.ang; } Point operator * (const Line &x, const Line &y) { double a1 = (y.b - x.a) * (y.a - x.a); double a2 = (y.a - x.b) * (y.b - x.b); Point r; r.x = (x.a.x * a2 + x.b.x * a1) / (a1 + a2); r.y = (x.a.y * a2 + x.b.y * a1) / (a1 + a2); return r; } bool mult(const Point &s, const Point &e, const Point &o) { return (s.x - o.x) * (e.y - o.y) >= (e.x - o.x) * (s.y - o.y); } void graham(Point p[], int n, int res[], int &top) { int len; top = 1; sort(p, p + n); if(n == 0) return; res[0] = 0; if(n == 1) return; res[1] = 1; if(n == 2) return; res[2] = 2; for(int i=2;i=0;--i) { while(top!=len && mult(p[i], p[res[top]], p[res[top-1]])) { -- top; } res[++top] = i; } } double cross(Point &a, Point &b, Point &o) { return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); } bool judgeOut(const Line &x, const Point &p) { return (p - x.a) * (x.b - x.a) > eps; } bool isParellel(const Line &x, const Line &y) { return fabs((x.b - x.a) * (y.b - y.a)) < eps; } double getArea(Point p[], int n) { double ans = 0.0; for(int i=2;i eps) { line[tmp++] = line[i]; } } lineNumber = tmp; stack[0] = line[0], stack[1] = line[1]; for(int i=2;i