如何产生这种随机的曲线?曲线

2023-09-11 03:12:52 作者:最完美的侧脸

是否有可能产生这种随机的曲线?

Is it possible to generate this kind of random curves?

我已经试过IMagick贝塞尔曲线(见 HTTP:// WWW .php.net /手动/ EN / function.imagickdraw-bezier.php ),但即使有20-30点他们不看是这样的。下面是我的示例 http://mechanicalzilla.com/sandbox/imagick/curve.php

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

感谢你。

推荐答案

我敢打赌,你可以写一个算法,将基本上采取 X 随机曲折前直接去数出口协调。这也假设算法是足够聪明,检查转弯的夹角。 (假设你不想结网,以endup)

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: