Smooths a path of control points into a dense curve and rounds points to pixels.
Works in floating-point coordinate space, ahead of rasterisation: feed the result to
FrenchCurve.Draw.polyline/3 through to_pixels/1.
[{0, 10}, {10, 2}, {20, 14}, {30, 6}]
|> FrenchCurve.Curve.catmull_rom()
|> FrenchCurve.Curve.to_pixels()
Summary
Functions
Returns a Catmull-Rom spline passing through every point of points, in order.
Rounds each coordinate to the nearest integer, giving points FrenchCurve.Draw accepts.
Types
Functions
Returns a Catmull-Rom spline passing through every point of points, in order.
The curve is interpolating, so each input point appears in the output. The first and last points are duplicated to give the end segments the neighbour they need, which makes the curve start and end exactly on them. Fewer than two points are returned unchanged.
The output has samples * (length(points) - 1) + 1 points.
Options
:samples— points generated per input segment, default16. Higher is smoother and more expensive.
Rounds each coordinate to the nearest integer, giving points FrenchCurve.Draw accepts.
Consecutive points that round to the same pixel are kept as duplicates.