POJ1584 判断多边形是否为凸多边形,并判断点到直线的距离
2015-11-02 21:34
302 查看
求点到直线的距离:
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.
按顺序读入边,边和边是按照一个顺序转的(叉积全为正或者全为负)
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.
按顺序读入边,边和边是按照一个顺序转的(叉积全为正或者全为负)
相关文章推荐
- Lesson 10 Other array coefficient-wise operations
- Linux有问必答:如何找出Linux中内置模块的信息
- 计算机网络运输层
- java---表、栈和队列
- DNS域名解析过程
- GCD 和延时调用
- 编码问题:unicode与utf-8,wchar_t与char
- JSP概述
- linux的僵尸进程和孤儿进程及解决方法
- 到底是谁在偷偷摸摸创建session
- 《编程之美》学而思-金刚坐飞机
- 关联选择器和组合选择器,伪元素选择器
- hdu 2734 Quicksum
- 2015年最新苹果开发者账号注册流程详解
- 读《大道至简》第五章有感
- .NET简谈插件系统开发模式
- 自动更新开奖数据的excel文件,供大家下载
- 简单几何(直线求交点) POJ 2074 Line of Sight
- java类与继承
- hdu 5538 House Building