code: public static float intersectRayLine(float originX, float originY, float dirX, float dirY, float pointX, float pointY, float normalX, float normalY, float epsilon) {
          float denom = normalX * dirX + normalY * dirY;
          if (denom < epsilon) {
              float t = ((pointX - originX) * normalX + (pointY - originY) * normalY) / denom;
              if (t >= 0.0f)
                  return t;
          }
          return -1.0f;
      }
docs: Test whether the ray with given origin <code>(originX, originY)</code> and direction <code>(dirX, dirY)</code> intersects the line
  containing the given point <code>(pointX, pointY)</code> and having the normal <code>(normalX, normalY)</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.
  <p>
  This method returns <code>-1.0</code> if the ray does not intersect the line, because it is either parallel to the line or its direction points
  away from the line or the ray's origin is on the <i>negative</i> side of the line (i.e. the line's normal points away from the ray's origin).
  
  @param originX
  the x coordinate of the ray's origin
  @param originY
  the y coordinate of the ray's origin
  @param dirX
  the x coordinate of the ray's direction
  @param dirY
  the y coordinate of the ray's direction
  @param pointX
  the x coordinate of a point on the line
  @param pointY
  the y coordinate of a point on the line
  @param normalX
  the x coordinate of the line's normal
  @param normalY
  the y coordinate of the line's normal
  @param epsilon
  some small epsilon for when the ray is parallel to the line
  @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; <code>-1.0</code> otherwise