Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate this kind of random curves?

Is it possible to generate this kind of random curves?

enter image description here

I've tried IMagick bezier curves (see http://www.php.net/manual/en/function.imagickdraw-bezier.php), but even with 20-30 points they do not look like this. Here is my sample http://mechanicalzilla.com/sandbox/imagick/curve.php

Thank you.

like image 578
Kirzilla Avatar asked Jul 12 '11 08:07

Kirzilla


1 Answers

I bet you could write an algorithm which would basically take x number of random twists before going straight to the exit coordinates. This also assumes that algorithm is smart enough to check the angle of the turn. (assuming you don't want to endup in knot-web)

However, assuming that this isn't your graduation task or that you are paid on per-hour basis to work on this, this would be a waste of time and success is highly doubtful.

Even if you'd manage to generate single line algorithm, doing it so that the lines wouldn't come too close to each other is close to impossible. You will end up with something like this: knot-web

like image 104
Gajus Avatar answered Sep 20 '22 23:09

Gajus