stroke

Function stroke 

Source
pub fn stroke(
    path: impl IntoIterator<Item = PathEl>,
    style: &Stroke,
    _opts: &StrokeOpts,
    tolerance: f64,
) -> BezPath
Expand description

Expand a stroke into a fill.

The tolerance parameter controls the accuracy of the result. In general, the number of subdivisions in the output scales at least to the -1/4 power of the parameter, for example making it 1/16 as big generates twice as many segments. Currently the algorithm is not tuned for extremely fine tolerances. The theoretically optimum scaling exponent is -1/6, but achieving this may require slow numerical techniques (currently a subject of research). The appropriate value depends on the application; if the result of the stroke will be scaled up, a smaller value is needed.

This method attempts a fairly high degree of correctness, but ultimately is based on computing parallel curves and adding joins and caps, rather than computing the rigorously correct parallel sweep (which requires evolutes in the general case). See Nehab 2020 for more discussion.