Skip to content

Function: resampleByArcLength()

resampleByArcLength<T>(points, spacing, blend): T[]

Defined in: geom.ts:101

Walk a polyline and emit a point every spacing units of arc length, with everything else about the sample interpolated along the way (that is what blend is for — pressure, tilt, and time all have to ride along, or the dab at the resampled position would carry the pen telemetry of a position the pen was never at).

The first input point is always emitted. The last one is emitted only if it lands on the grid — a trailing partial segment is deliberately dropped rather than stamped at the wrong spacing; a live stroke's tail arrives on the next frame anyway, and a finished stroke's final dab is placed by the caller.

spacing <= 0, or fewer than two points, returns the input unchanged: a dot is a legitimate stroke.

Type Parameters

T

T extends Vec

Parameters

points

readonly T[]

spacing

number

blend

(a, b, t) => T

Returns

T[]