code: protected double getIntersection (IVector pt) {
          if (Math.abs(direction.x) > Math.abs(direction.y)) {
              double t = (pt.x() - origin.x) / direction.x;
              return (t >= 0f && origin.y + t*direction.y == pt.y()) ? t : Float.MAX_VALUE;
          } else {
              double t = (pt.y() - origin.y) / direction.y;
              return (t >= 0f && origin.x + t*direction.x == pt.x()) ? t : Float.MAX_VALUE;
          }
      }
docs: Returns the parameter of the ray when it intersects the supplied point, or
  {@link Float#MAX_VALUE} if there is no such intersection.