line.tangentAtLength(length)
Return a line tangent to the line at point that lies length
away from the beginning of the line.
If negative length
is provided, the algorithm starts looking from the end of the line. If length
is higher than line length, a line tangent to the closest line endpoint is returned instead.
The tangent line starts at the specified point. The direction from start
to end
is the same as the direction of the line.
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.