"No" half-plane cross

    The cut plane of a straight line and a half plane 2

    Plane intersecting region pile half half plane cross

    All polygon edges half-plane polygonal core cross,

    Even from this region to the edges of all vertices forming the polygon entirely within the segment.

    Nuclear convex polygon is its own

    

    More nonsense seem futile to learn on the line

    The main demand is how

    
 1 #include<cmath>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<iostream>
 5 #include<algorithm>
 6 using namespace std;
 7 inline int read(){
 8     int x=0;bool f=0;char ch=getchar();
 9     for(;!isdigit(ch);ch=getchar()) f=(ch=='-');
10     for(; isdigit(ch);ch=getchar()) x=(x<<3)+(x<<1)+(ch^48);
11     return f?-x:x;
12 }
13 const int maxn=1e3+7;
14 const double eps=1e-8;
15 inline int dcmp(double a){
16     if(fabs(a)<eps) return 0; return a<0?-1:1;
17 }
18 
19 #define vec dot
20 struct dot{
21     double x,y; dot(){}
22     dot(double u,double v):x(u),y(v){}
23     dot friend operator + (dot a,dot b){return dot(a.x+b.x,a.y+b.y);}
24     dot friend operator - (dot a,dot b){return dot(a.x-b.x,a.y-b.y);}
25     dot friend operator * (dot a,double b){return dot(a.x*b,a.y*b);}
26     dot friend operator / (dot a,double b){return dot(a.x/b,a.y/b);}
27     double friend operator ^ (dot a,dot b){return a.x*b.y-a.y*b.x;}//叉乘
28 }a[maxn];
29 struct line{
30     dot s,t; vec v; double ang; line(){}
31     line(dot a,dot b){s=a;t=b;v=b-a;ang=atan2(t.y-s.y,t.x-s.x);}//先传y后传x
32     inline bool friend operator < (line a,line b){
33         if(dcmp(a.ang-b.ang)) return a.ang<b.ang;
34         return (a.v^(b.s-a.s))<0;
35     }
36 }l[maxn];
37 inline bool left(line a,dot b){return (a.v^(b-a.s))>0;}
38 dot meet(line a,line b){//定比分点公式
39     dot A=a.s,B=a.t,C=b.s,D=b.t;
40     double s1=(B-A)^(C-A),s2=(D-A)^(B-A);
41     return (D*s1+C*s2)/(s1+s2);
42 }
43 
44 line q[maxn];
45 dot p[maxn];
46 int L,R,cnt;
47 double ans;
48 
49 int n,m;
50 int main(){
51     n=read();
52     for(int i=1;i<=n;++i){
53         m=read();
54         dot tmp,las,st;
55         for(int j=1;j<=m;++j){
56             scanf("%lf%lf",&tmp.x,&tmp.y);
57             if(j^1) l[++cnt]=line(las,tmp);
58             else st=tmp; las=tmp;
59         }
60         l[++cnt]=line(las,st);
61     }
62     sort(l+1,l+cnt+1);
63     n=1;
64     for(int i=2;i<=cnt;++i) if(dcmp(l[i].ang-l[i-1].ang)) l[++n]=l[i];
65     L=1;R=0; q[++R]=l[1];
66     for(int i=2;i<=n;++i){
67         while(L<R&&!left(l[i],p[R-1])) --R;
68         while(L<R&&!left(l[i],p[L])) ++L;
69         q[++R]=l[i];
70         if(L<R) p[R-1]=meet(q[R],q[R-1]);
71     }
72     while(L<R&&!left(q[L],p[R-1])) --R;
73     if(L<R) p[R]=meet(q[L],q[R]);
74     if(R-L+1>=3){
75         for(int i=L;i<R;++i) ans+=p[i]^p[i+1];
76         ans+=p[R]^p[L]; ans/=2;
77     }
78     printf("%.3lf\n",ans);
79     return 0;
80 }
* Miracle * copy of the template

    Then a few simple questions were not cut up

 

    "Racing" convex hull

    "Fe who double of the game," the third, the Magic Change Two dead branch,

      Also to note is $ log_21e19 $ and $ log_21e15 $ starker, which fly direct T

    "Watchtower"

      With skyh words, a function of a linear function to obtain a linear function Save

      So the answer lies in the turning point, the plane of the cross pieces can seek out violence

    "Archery"

      Technology of persimmon becomes a dichotomous answer + half-plane cross + card fine good title

    「Saber VS Lancer」

      For all three cases the same distance ratio, the result is the same

      Thus the ratio of three variables into two unequal number to be changed.

    "I think small convex running."

      If you can point to the straight-line distance formula it seems difficult to

    「escape」

      Vertical score lines to find the control region, even bordering edge, multi-source shortest

    "Wps island"

      Miku with the words, the pictures out on the line

      After drawn out to find some edge useless, because obviously better to replace them (two sides of a triangle is greater than the third side

      Then observe find useful is a point of maximum and minimum number of edges not deleted

      They consider only half cross plane, the circumference of

      

Guess you like

Origin www.cnblogs.com/yxsplayxs/p/12174375.html