标签:cto cpp tps 逆时针 double code ret http 多边形
bool judge(vector<double> x,vector<double> y,int n){ //1逆时针,0顺时针
if(n < 3) return 0.0>0;
double s = y[0] * (x[n - 1] - x[1]);
x.resize(n+1),y.resize(n+1);
y[n] = y[0],x[n]=x[0];
for(int i = 1; i < n; ++ i)
s += y[i] * (x[i - 1] - x[i + 1]);
return s * 0.5>0;
}
标签:cto cpp tps 逆时针 double code ret http 多边形
原文地址:https://www.cnblogs.com/CADCADCAD/p/13338841.html