这是我在 stackover 流中的第一篇文章。最近我开始阅读名为“植物的算法之美”的书,其中在第 1 章中,他解释了 L 系统。(您可以在此处阅读该章节)。
所以据我所知,有两种类型的 L 系统。边缘重写和节点重写。
边缘重写相对非常简单。有一个初始的起始多边形和一个生成器。初始多边形的每条边(边)都将被生成器替换。
但是这个节点重写非常混乱。从我收集到的信息来看,有两个或更多规则,并且每次迭代都将规则中的变量替换为其常量对应项。
对于海龟解释,这些是标准规则
F : Move turtle forward in current direction (initial direction is up)
+ : rotate turtle clock wise
- : rotate turtle anti clock wise
[ : Push the current state of the turtle onto a pushdown operations stack.
The information saved on the stack contains the turtle’s position and orientation,
and possibly other attributes such as the color and width of lines being drawn. …Run Code Online (Sandbox Code Playgroud) algorithm procedural-programming l-systems procedural-generation fractals