c语言 判断两直线段是否相交
摘要:
转了多人的放到一起比较!!//功能:求点在有向直线左边还是右边 //返回:0共线、1左边、-1右边 int left_right(point a,point b,double x,double y) { double t; a.x -= x; b.x -= x; a.y -= y; b.y -= y; t = a.x*b.y-a.y*b.x; return t==0 ? 0 : t>0?1:-1; } //功能:线段c,d和直线a,b是否相交 bool intersect1(point a,point b,point c,point d) { return left_right(a,b, 阅读全文
posted @ 2013-03-17 21:09 圣手摘星 阅读(4165) 评论(0) 推荐(0)
浙公网安备 33010602011771号