You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When drawing svg it is often the case that we want to draw smooth lines using Bezier curves. It would really be handy with a function to convert a polyline to a list of Bezier curves that are connected and where the control points make sense (based on some smoothing parameter perhaps)
and of course it would be really cool to have a corresponding function to render such a datatructure to svg.
What do you think?
The text was updated successfully, but these errors were encountered:
Hey @prange! I've thought for a while it would be good to have a function in elm-geometry for constructing centripetal Catmull-Rom splines, which are a series of smoothly-connected cubic splines through a set of points. The API would probably be something likely
although it might have to be a bit more complex to allow for different end conditions (free, clamped, closed etc.) Does that seem close to what you're looking for?
Or if we want to be a bit more opinionated, something like:
CubicSpline2d.interpolate :ListPoint2d->ListCubicSpline2dCubicSpline2d.closed :ListPoint2d->ListCubicSpline2dCubicSpline2d.interpolateWith :{ start :BoundaryCondition, end :BoundaryCondition}->ListPoint2d->ListCubicSpline2d-- zero curvature at the boundaryfree:BoundaryCondition-- fixed first derivative at the boundaryfixed:Vector2d->BoundaryCondition
which you could use as
-- Create a centripetal Catmull-Rom curve through-- the given points, with free endssplines1 =CubicSpline2d.interpolate points
-- Create a closed-loop Catmull-Rom curve-- through the given pointssplines2 =CubicSpline2d.closed points
splines3 =CubicSpline2d.interpolateWith
{ start =CubicSpline2d.fixed v1, end =CubicSpline2d.free }
points
When drawing svg it is often the case that we want to draw smooth lines using Bezier curves. It would really be handy with a function to convert a polyline to a list of Bezier curves that are connected and where the control points make sense (based on some smoothing parameter perhaps)
and of course it would be really cool to have a corresponding function to render such a datatructure to svg.
What do you think?
The text was updated successfully, but these errors were encountered: