pocmatos
2019-1-14 10:29:43

@soegaard2 thanks for the reference, will take a look but at a glance, it looks like the same issue.


greg
2019-1-14 17:10:39

@soegaard2 @pocmatos Incidentally, although I’m happy to accept an honorary promotion to being Matthias (I think?), it was actually his suggestion not mine.


pocmatos
2019-1-14 19:21:05

@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/


pocmatos
2019-1-14 19:21:55

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?


soegaard2
2019-1-14 19:27:23

@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


soegaard2
2019-1-14 19:27:36

(the docs on Github hasn’t been updated yet).


soegaard2
2019-1-14 19:28:14

It’s pretty simple a curve: is simply a list of Bezier curves with a flag that signals whether the curve is cyclic.


soegaard2
2019-1-14 19:29:20

A Bezier curve is represented as: (struct bez (p0 p1 p2 p3)) where p0, p1, p2, p3 are the control points.


soegaard2
2019-1-14 19:29:45

Well, p0 and p3 are the start and end point - and p1 and p2 are the control points.


soegaard2
2019-1-14 19:32:44

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.


soegaard2
2019-1-14 19:33:45

That can be used to find points along the curve evenly spaced - and then construct a new curve through the same points slightly distorted.


pocmatos
2019-1-14 19:34:32

Interesting. Thanks for this. I will give a try to build a metapict extension that creates xkcd-style metapicts.


soegaard2
2019-1-14 19:36:01

An example of finding points evenly distributed a long a curve:



soegaard2
2019-1-14 19:36:32

Also take a peak on the tikz solution:



soegaard2
2019-1-14 19:37:07

It would be a pretty fun thing to have in MetaPict.


pocmatos
2019-1-14 19:37:47

Thanks for that ref, I shall take a look.