line.closestPointTangent(point)

Return a line that is tangent to the line at the point that lies closest to point.

The tangent line starts at the identified closest point. The direction from start to end is the same as the direction of the line at the closest point.

If the two endpoints of the line both lie at the same coordinates, null is returned (it is impossible to determine the slope of a point). The line.isDifferentiable() function may be used in advance to determine whether tangents can exist for a given line.