Function kurbo::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 to the -1/6 power of the parameter, for example making it 1/64 as big generates twice as many segments. 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.