@soegaard2 thanks for the reference, will take a look but at a glance, it looks like the same issue.
@soegaard2 @pocmatos Incidentally, although I’m happy to accept an honorary promotion to being Matthias (I think?), it was actually his suggestion not mine.
@soegaard2 how hard would it be to implement the xkcd algorithm on metapict? Ref: http://jakevdp.github.io/blog/2012/10/07/xkcd-style-plots-in-matplotlib/
I can’t find in the docs of metapict any information about internal representation so I am unsure if I can access each of the lines I need. Any suggestions on how and where to start?
@pocmatos That’s certainly doable. As luck has the documentation has recently been updated, so the internal representation of curves are now documented here: http://docs.racket-lang.org/metapict/index.html?q=metapict#%28part._ref-curve%29
(the docs on Github hasn’t been updated yet).
It’s pretty simple a curve:
is simply a list of Bezier curves with a flag that signals whether the curve is cyclic.
A Bezier curve is represented as: (struct bez (p0 p1 p2 p3)) where p0, p1, p2, p3 are the control points.
Well, p0 and p3 are the start and end point - and p1 and p2 are the control points.
Final piece of the puzzle is the recently added arc-time . Here (arc-time c a) finds the time t where the length of the subcurve from c(0) to c(t) has length a.
That can be used to find points along the curve evenly spaced - and then construct a new curve through the same points slightly distorted.
Interesting. Thanks for this. I will give a try to build a metapict extension that creates xkcd-style metapicts.
An example of finding points evenly distributed a long a curve:
Also take a peak on the tikz solution:
It would be a pretty fun thing to have in MetaPict.
Thanks for that ref, I shall take a look.