intersectRayLineSegment

Determine whether the ray with given <code>origin</code> and direction <code>dir</code> intersects the undirected line segment given by the two end points <code>a</code> and <code>b</code>, and return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if any. <p> This method returns <code>-1.0</code> if the ray does not intersect the line segment.

@see #intersectRayLineSegment(double, double, double, double, double, double, double, double)

@param origin the ray's origin @param dir the ray's direction @param a the line segment's first end point @param b the line segment's second end point @return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if the ray intersects the line segment; <code>-1.0</code> otherwise

  1. double intersectRayLineSegment(double originX, double originY, double dirX, double dirY, double aX, double aY, double bX, double bY)
  2. double intersectRayLineSegment(Vector2d origin, Vector2d dir, Vector2d a, Vector2d b)
    static
    double
    intersectRayLineSegment

Meta