I\'ve tried searching for a javascript function that will detect if two lines intersect each other.
The function will take the x,y values of both the start end point
I've rewritten Peter Wone's answer to a single function using x/y instead of lat()/long()
function isIntersecting(p1, p2, p3, p4) {
function CCW(p1, p2, p3) {
return (p3.y - p1.y) * (p2.x - p1.x) > (p2.y - p1.y) * (p3.x - p1.x);
}
return (CCW(p1, p3, p4) != CCW(p2, p3, p4)) && (CCW(p1, p2, p3) != CCW(p1, p2, p4));
}