lua中cc.pIsSegmentIntersect的问题

在cocos2dx-lua中提供了一个函数,cc.pIsSegmentIntersect(pt1,pt2,pt3,pt4),用来判断的线段(pt1, pt2)和线段(pt3,pt4)是否相交。
但用的时候才发现,其实这个函数是有问题的啊!
如下:
if ret and s >= 0.0 and s <= 1.0 and t >= 0.0 and t <= 0.0 then
return true
end
直接说t == 0 不就完了吗?—— 当然不是,正确的应该是改为 t <= 1.0
另外,此时的返回值建议改成:return true, cc.p(pt1.x + s * (pt2.x - pt1.x), pt1.y + s * (pt2.y - pt1.y))

要不然,如果要取得交点的话,还要调用cc.pGetIntersectPoint 函数,这样一来,cc.pIsLineIntersect 就要调用两次,纯属多余


说到这个 cc.pIsLineIntersect 函数,不得不吐槽一下了,它总共要传入六个参数(A, B, C, D, s, t),前四个是Point ,四个点,没什么好说的,关键是后面两个 s, t,完全不明白传进来做什么,在整个函数中,这两个值根本就没有参与过判断啊!

现已加入Quick社区版豪华午餐:https://github.com/iTyran/Quick-Cocos2dx-Community/pull/12