`polyline.tangentAtLength(length)`

Return a line tangent to the polyline at point that lies `length`

away from the beginning of the polyline.

If negative `length`

is provided, the algorithm starts looking from the end of the polyline. If `length`

is higher than the length of the polyline, a line tangent to the closest valid polyline endpoint is returned instead.

The tangent line starts at the point at `length`

. The direction from `start`

to `end`

is the same as the direction of the polyline segment at the specified point. If the specified point is a point of discontinuity (e.g. it is a point shared by two polyline segments with different slopes), the tangent line is constructed for the earlier segment (i.e. the segment closer to the beginning of the polyline).

The algorithm ignores polyline segments that have zero length. If the polyline contains no valid segments (i.e. all polyline points are coincident), `null`

is returned. If the polyline has fewer than two points (exclusive), `null`

is returned, as well. The `polyline.isDifferentiable()`

function may be used in advance to determine whether the polyline contains at least one valid segment for wich a tangent may be found.