标签:
求点到直线的距离:
double dis(point p1,point p2)
{
if(fabs(p1.x-p2.x)<exp)//相等的
{
return fabs(p2.x-pegx);
}
else
{
double k=(p2.y-p1.y)/(p2.x-p1.x);
double b=p2.y-k*p2.x;
return fabs(k*pegx-pegy+b)/sqrt(k*k+1);//返回的是距离的
}
}
判断多边形是否为凸多边形
if the hole contains any protrusions (i.e., if there exist any two interior points in the hole that, if connected by a line segment, that segment would cross one or more edges of the hole)(括号里的是凸多边形定义的英文描述), then the filled-in-hole would not be structurally sound enough to support the peg under normal stress as the furniture is used.
按顺序读入边,边和边是按照一个顺序转的(叉积全为正或者全为负)
POJ1584 判断多边形是否为凸多边形,并判断点到直线的距离
标签:
原文地址:http://www.cnblogs.com/liuhanx1/p/4931468.html