'判断两条线是否相交
function isIntersect(px1,py1,px2,py2,px3,py3,px4,py4)
flag=false
d=(px2-px1)*(py4-py3) - (py2-py1)*(px4-px3)
if(d<>0) then
r = ((py1-py3)*(px4-px3)-(px1-px3)*(py4-py3))/d
s = ((py1-py3)*(px2-px1)-(px1-px3)*(py2-py1))/d
if (r>=0) and (r <= 1) and (s >=0) and (s<=1) then
flag=true
end if
end if
isIntersect=flag
end function
ASP判断两个线断是否相交的算法
最新推荐文章于 2024-11-12 12:29:51 发布