private Point2D.Double minDistancePointToLine(Point2D.Double p1,Point2D.Double p2,List<Point2D.Double> points){
		double minDist = Double.MAX_VALUE;
		Point2D.Double minDistancePoint = null;
		for(int i = 0; i < points.size(); i++){
			double d = distancePointLine(p1, p2, points.get(i));
			
			if(d<minDist){
				minDist = d;
				minDistancePoint = points.get(i);
				
			}
		}
		return minDistancePoint;
	}
private Point2D . Double minDistancePointToLine ( Point2D . Double p1 , Point2D . Double p2 , List < Point2D . Double > points ) { double minDist = Double . MAX_VALUE ; Point2D . Double minDistancePoint = null ; for ( int i = 0 ; i < points . size ( ) ; i ++ ) { double d = distancePointLine ( p1 , p2 , points . get ( i ) ) ; if ( d < minDist ) { minDist = d ; minDistancePoint = points . get ( i ) ; } } return minDistancePoint ; }
@param p1 First point on line
@param p2 Second point on line
@param points Points in some distance to the line
@return The point in points with the minimum distance to the line defined by p1 and p2