function intersect(ray, P) {
    var translated = [P.x - ray.px, P.y - ray.py];
    // distance = cross(translated, ray)/ray.magnitude; Uses cross product to get vertical distance from point to line since cross(A,B) = |A||B|sinØ;
    // ray.magnitude = 1 since using sin and cos directions that lie on unit circle
    var dist = (translated[0] * Math.sin(ray.dir) - translated[1] * Math.cos(ray.dir)) / 1
    // The smaller the threshold for intersecting, the closer it is to actual point geometry
    // This dictates the radius of the circle around a dot to deem an acceptable hit
    return (Math.abs(dist) <= 1.5);
    }
// If distance between point and ray is small enough, consider it intersecting
If distance between point and ray is small enough, consider it intersecting
If distance between point and ray is small enough consider it intersecting
function intersect(ray, P) {
    var translated = [P.x - ray.px, P.y - ray.py];
    var dist = (translated[0] * Math.sin(ray.dir) - translated[1] * Math.cos(ray.dir)) / 1
    return (Math.abs(dist) <= 1.5);
    }
function intersect ( ray , P ) { var translated = [ P . x - ray . px , P . y - ray . py ] ; var dist = ( translated [ 0 ] * Math . sin ( ray . dir ) - translated [ 1 ] * Math . cos ( ray . dir ) ) / 1 return ( Math . abs ( dist ) <= 1.5 ) ; }
If distance between point and ray is small enough, consider it intersecting
If distance between point and ray is small enough consider it intersecting
// distance = cross(translated, ray)/ray.magnitude; Uses cross product to get vertical distance from point to line since cross(A,B) = |A||B|sinØ; // ray.magnitude = 1 since using sin and cos directions that lie on unit circle // The smaller the threshold for intersecting, the closer it is to actual point geometry // This dictates the radius of the circle around a dot to deem an acceptable hit