#include #include #include #include #include #include #include #include #include using namespace std; typedef complex cplx; typedef pair edge; typedef vector polygon; typedef vector vertices; const double epsilon=0.0001; bool edge_cross_edge(edge es, double& s, edge et, double& t){ cplx a = es.first, u = es.second, b = et.first, v = et.second; double det = imag(conj(u)*v); if(det==0) return false; s = - imag(conj(v) * (b-a)) / det; t = - imag(conj(u) * (b-a)) / det; return true; } polygon thicken(polygon p,double thickness){ for(int i=0;i xs; for(int i=0;i::iterator it,jt; jt=xs.begin(); it=jt++; double sum=0; for(;;){ sum+=*jt-*it; it++;it++; if(it==xs.end())break; jt++;jt++; } //cout << "slice length of " << p << " at " << z << " is " << sum < zs; set::iterator it,jt; for(int i=0;i> n; if(n==0)break; vertices vs; for(int i=0;i> x >> y; vs.push_back(cplx(x,y)); } vs=normalize(vs); polygon smaller,small,middle,big,bigger; for(int i=0;i