chalk-diagrams / chalk

A declarative drawing API in Python
MIT License
273 stars 13 forks source link

Splines #35

Open srush opened 2 years ago

srush commented 2 years ago

Lo-pri: The Haskell cubic spline api seems pretty doable now that we have paths / trails. I think this could be implemented as a Spline shape that takes a path and renders it using https://docs.scipy.org/doc/scipy/tutorial/interpolate.html

https://hackage.haskell.org/package/diagrams-lib-1.4.5.1/docs/Diagrams-CubicSpline.html#g:1

Downside is this brings in a scipy dependency and is maybe not that important a feature.

danoneata commented 2 years ago

Yes; if we want curvy segments, we could also have Bézier curves, which would be simpler to render since they are already supported by both PyCairo and SVG. But I assume that cubic splines are somewhat more intuitive to specify?! Out of curiosity, are there some diagrams that you would like to draw and would require splines?

srush commented 2 years ago

Yeah it looks like diagrams converts splines to bezier curves internally. Guess splines are easier for users.

No I don't actually need splines. Bends are enough for me. Just seemed interesting.