Answers for "detect if two line segments intersect each other javascript"

0

detect if two line segments intersect each other javascript

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));
}
Posted by: Guest on August-26-2020

Code answers related to "detect if two line segments intersect each other javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language