private Point2D intersect(List<Point2D> outline, Line2D line) {

        Point2D previousPoint = outline.get(outline.size() - 1);
        for (Point2D point : outline) {

            Line2D currentLine = new Line2D.Double(point.getX(), point.getY(), previousPoint.getX(),
                    previousPoint.getY());
            if (line.intersectsLine(currentLine)) {
                return lineLineIntersect(currentLine, line);
            }
            previousPoint = point;
        }
        return new Point2D.Double(line.getX1(), line.getY1());
    }
private Point2D intersect ( List < Point2D > outline , Line2D line ) { Point2D previousPoint = outline . get ( outline . size ( ) - 1 ) ; for ( Point2D point : outline ) { Line2D currentLine = new Line2D . Double ( point . getX ( ) , point . getY ( ) , previousPoint . getX ( ) , previousPoint . getY ( ) ) ; if ( line . intersectsLine ( currentLine ) ) { return lineLineIntersect ( currentLine , line ) ; } previousPoint = point ; } return new Point2D . Double ( line . getX1 ( ) , line . getY1 ( ) ) ; }
Determine the minimum intersection of a line and the outline of a shape (specified as a list
of points).

@param outline the outline of a shape
@param line    the line
@return the intersection