class Line2d {

    public Vector2d getIntersection(Ray2d ray, boolean allowNegative)
    {
        double dist = getDistance(ray);
        // If the distance is negative, the intersection with the line occurs in
        // the opposite direction of the ray.
        if (Double.isNaN(dist) || dist < 0. && !allowNegative)
        {
            return null;
        }
        return ray.getPosition().add(ray.getDirection().multiply(dist));
    }

    public  Line2d(Vector2d point, Vector2d normal);

}