distortUniform
Distorts the contour underlying this RectifiedContour using a distortion function that is evaluated on the rectified (proportional to contour length) t parameter.
This works like ShapeContour.distort, but the distort function additionally receives the rectified t value of the point it is displacing. That makes it possible to express distortions in terms of arc length position, for example tapering an effect towards the ends of the contour or applying a wave with a constant wavelength in curve-length units.
The result is built from adaptively split cubic Beziers, one group per segment of the original contour, such that corners of the original contour are preserved. Each candidate piece is fit with its endpoints fixed to the true distorted positions at that piece's boundaries, so neighbouring pieces always join up exactly.
The distorted contour folds over itself where it runs backwards relative to the original contour, that is where dot(q'(t), p'(t)) < 0 for distorted position q and original position p. For an offset along the true normal this is where the offset distance exceeds the local radius of curvature. With FoldMode.TRIM every such fold is cut out: the backwards stretch and the swallowtail around it are removed and the pieces on either side are joined at the point where they cross. Folds whose sides do not cross are collapsed to a single point. For closed contours the start point of the result can move when FoldMode.TRIM is used.
Parameters
max allowed RMS fit error before a piece is split in two
recursion limit; caps output at 2^maxDepth pieces per segment. Keep this modest (5-8)
distance in contour length between samples used for fitting and measuring the error
how folds in the distorted contour are treated, FoldMode.FOLD keeps them
maps a rectified t value and the position at that t to a distorted position