/**
* Author: Ulf Lundstrom
* Date: 2009-03-21
* License: CC0
* Source:
* Description:\\
\begin{minipage}{75mm}
Returns a vector with the vertices of a polygon with everything to the left of the line going from s to e cut away.
\end{minipage}
\begin{minipage}{15mm}
\vspace{-6mm}
\includegraphics[width=\textwidth]{src/geometry/PolygonCut}
\vspace{-6mm}
\end{minipage}
* Usage:
* vector<P> p = ...;
* p = polygonCut(p, P(0,0), P(1,0));
* Status: tested but not extensively
*/#pragma once
#include"src/geometry/Point.h"typedefPoint<double>P;vector<P>polygonCut(constvector<P>&poly,Ps,Pe){vector<P>res;rep(i,0,sz(poly)){Pcur=poly[i],prev=i?poly[i-1]:poly.back();autoa=s.cross(e,cur),b=s.cross(e,prev);if((a<0)!=(b<0))res.push_back(cur+(prev-cur)*(a/(a-b)));if(a<0)res.push_back(cur);}returnres;}
Traceback(mostrecentcalllast):File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/documentation/build.py",line71,in_render_source_code_statbundled_code=language.bundle(stat.path,basedir=basedir,options={'include_paths':[basedir]}).decode()~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/languages/cplusplus.py",line187,inbundlebundler.update(path)~~~~~~~~~~~~~~^^^^^^File"/opt/hostedtoolcache/Python/3.14.0/x64/lib/python3.14/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py",line312,inupdateraiseBundleErrorAt(path,i+1,"#pragma once found in a non-first line")onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt:src/geometry/PolygonCut.h:line20:#pragmaoncefoundinanon-firstline