smoothCommand = smoothing => (_, i, a) => {
const pStart = a[i - 1];
const pEnd = a[i];
const pPrev = a[i - 2] || pStart;
const pNext = a[i + 1] || pEnd;
const [cpsX, cpsY] = Vec2.add(
pStart,
Vec2.scale(smoothing, Vec2.sub(pEnd, pPrev))
);
const [cpeX, cpeY] = Vec2.add(
pEnd,
Vec2.scale(smoothing, Vec2.sub(pStart, pNext))
);
return `C ${cpsX},${cpsY} ${cpeX},${cpeY} ${pEnd[0]},${pEnd[1]}`;
}