main/src/georegression/metric/Distance2D_I32.java
public static double distance( LineParametric2D_I32 line, Point2D_I32 p ) {
		int a = line.slopeX;
		int b = line.slopeY;

		double t = a * ( p.x - line.p.x ) + b * ( p.y - line.p.y );
		t /= ( a * a + b * b );

		// return the distance of the closest point on the line
		return UtilPoint2D_F64.distance(line.p.x + t * a, line.p.y + t * b, p.x, p.y);
	}
public static double distance( LineParametric2D_I32 line, Point2D_I32 p ) {
		int a = line.slopeX;
		int b = line.slopeY;

		double t = a * ( p.x - line.p.x ) + b * ( p.y - line.p.y );
		t /= ( a * a + b * b );

		// return the distance of the closest point on the line
		return UtilPoint2D_F64.distance(line.p.x + t * a, line.p.y + t * b, p.x, p.y);
	}
<p>
Returns the distance of a point to the closest point on a line.
</p>

@param line A line. Not modified.
@param p The point. Not modified.
@return Distance the closest point on the line is away from the point.