Turtle
海龟
The parameters in the Turtle and Values tabs are meant for advanced users with programming experience (these tabs contain an entire L-System). Those of you with little or no programming experience should, however, not be scared off. In the following are several variable examples.
Turtle 和 Values 选项卡中的参数是针对有编程经验的高级用户的(这些选项卡包含整个 L-System)。然而,对于那些很少或没有编程经验的人来说,不应该被吓跑。下面是几个变量的例子。
Make sure you first set Mode to
请确保您首先设置模式为乌龟。
Brief introduction to L-Systems
L 系统简介
In the following pages, the L(indenmayer)-Systems are briefly explained. Additional books or online resources are available that offer an in-depth explanation of these systems (the pdf document "The Algorithmic Beauty of Plants" from Przemyslaw Prusinkiewicz and Astrid Lindenmayer is based on use with Cinema 4D and can be downloaded at http://algorithmicbotany.org/papers#abop).
在下面的几页中,l (indenmayer)-系统作了简要的解释。其他的书籍或在线资源可以提供这些系统的深入解释(pdf 文档“ The algorithm Beauty of Plants” ,由 przemylaw Prusinkiewicz 和 Astrid Lindenmayer 提供,基于 Cinema 4D 的使用,可以在 http://algorithmicbotany.org/papers#abop 下载)。
L-Systems are usually used for simulating plant growth and similar effects. Combined with MoGraph, these can be used to create spectacular growth simulations by placing a MoSpline object into a Sweep object, thus creating a renderable object (Splines can be rendered directly using Sketch and Toon or HAIR).
L 系统通常用于模拟植物生长和类似效果。结合 MoGraph,这些可以用来创建壮观的生长模拟放置 MoSpline 对象到一个扫描对象,从而创建一个可渲染的对象(样条可以直接使用草图和 Toon 或毛发)。
Simply put, an L-System executes a series of commands that define how and where new branches should grow. It is a self-producing system that can replace existing branches with new ones.
简单地说,l 系统执行一系列命令,这些命令定义了新分支的增长方式和增长位置。它是一个自我生产系统,可以用新的分支机构替换现有的分支机构。
The basic principles are fairly simple and are based on a system called "Turtle System". A (virtual) turtle is sent on its way via simple commands. This path is represented by a Spline.
基本原理相当简单,基于一个称为“海龟系统”的系统。一只(虚拟)海龟通过简单的命令被发送出去。此路径由样条函数表示。
The 3 most important commands are:
这三个最重要的命令是:
If you enter the sequence F++F++F in the Premise field it translates to: "Take one step Forward; turn twice to the right; take another step Forward; turn twice to the right; take another step Forward."
如果你在 Premise 字段中输入序列 f + + f + f,它将翻译为: “向前一步; 向右转两次; 再向前一步; 向右转两次; 再向前一步。”
How big each step is and how large the angle of rotation is can be defined in the Values tab via the Default Movement and Default Angle values, respectively. Or, as described below, by placing them in parenthesis. If Default Angle is set to 60° a perfect triangle will result for our example:
每个步骤的大小和旋转角度的大小可以分别通过默认移动值和默认角度值在值选项卡中定义。或者,像下面描述的那样,把它们放在括号里。如果默认角度设置为60 ° ,我们的例子就会得到一个完美的三角形:
This lets you create branch-like shapes. A very interesting function of L-Systems is its integrated replacement system with which individual branches can be replaced by others. This can also be done recursively, which lets you create very complex branching with simple command codes. If this sounds confusing, the following example can shed some more light on what’s involved:
这使您可以创建类似分支的形状。L 系统的一个非常有趣的功能是它的集成替换系统,用它个别的分支可以被其他分支所替代。这也可以递归地完成,使用简单的命令代码可以创建非常复杂的分支。如果这听起来让人困惑,下面这个例子可以让你更清楚的了解到底是怎么回事:
So far you have only entered single-line command codes that were executed only once. Now enter the following command code into the respective fields:
到目前为止,您只输入了只执行一次的单行命令代码。现在在相应的字段中输入以下命令代码:
Premise field: F++F++F
前提字段: f + + f + f
Rules field: F = F-F++F-F
规则域: f = F-F + F-F
As you can see, the Rules code line contains an assignment (in the following referred to as Rule) in which "F" is assigned several symbols that in turn will (internally) be inserted into the Premise line of code.
如您所见,Rules 代码行包含一个赋值(在下面的代码中称为 Rule) ,其中为“ f”分配了几个符号,这些符号将(在内部)插入 Premise 代码行。
If written out in its entirety, the command line code would read as follows (replace the F in the Premise line of code with the code following the "F" in the Rules line of code):
如果完整地写出来,命令行代码将如下所示(将 Premise 行代码中的 f 替换为 Rules 行代码中“ f”后面的代码) :
F-F++F-F++F-F++F-F++F-F++F-F
F + f + f + f + f + f + f + f + f + f + f + f + f
This represents the second shape from left in the image below. Since each F in the Premise code is replaced by the Rule, each straight line will be replaced by the more complex line.
这表示下图左起的第二个形状。由于 Premise 代码中的每个 f 都被规则所代替,每条直线都将被更复杂的直线所代替。
And this replacement process can be repeated indefinitely (well, not quite, since your computer will probably throw in the towel after the exponentially increasing complexity of the Splines starts to grow … ). How often this replacement process is repeated is defined by the Growth value, which replaces each F with the Rules code. Incidentally, fractals work the same way.
这种替换过程可以无限期地重复(好吧,也不尽然,因为当样条函数的复杂性呈指数增长时,您的计算机可能会放弃...)。这个替换过程重复的频率由 Growth 值定义,该值用 Rules 代码替换每个 f。顺便说一句,分形也是这样的。
Of course placeholders can be used as well so that not necessarily each F has to be used. After all, this would be unrealistic for growing formations - growth in length does not always occur only at the end of branches, etc.
当然,也可以使用占位符,这样就不必使用每个 f。毕竟,这对于生长形态来说是不现实的——长度的生长并不总是发生在枝条的末端,等等。
For this you can use placeholders (letters that do not represent any Turtle command) such as A, B, C, D, (but NOT "F" because it is the default "one unit forward command").
为此,可以使用占位符(不代表任何 Turtle 命令的字母) ,如 a、 b、 c、 d (但不能使用“ f” ,因为它是默认的“ one unit forward command”)。
Type the following into the respective fields:
在相应的字段中键入以下内容:
Premise: FA
前提: FA
Rules: A=+F-FA
规则: a = + F-FA
Since the Rule ends with an A, an increasing Growth value will result in the formation growing endlessly (Default Angle is set to 90°).
由于该规则以 a 结尾,增长值的增加将导致队形无休止地增长(默认角设置为90 °)。
Tip: 提示:The code we have used so far has consisted of a single, uninterrupted line of code. However, L-Systems first become interesting when real branches are created, i.e., new lines that branch from existing lines. And this can be achieved by using square brackets ([ ]). The command sequence within a square bracket is viewed as a separate branch (and creates a new Turtle). After the branch has been created the turtle will return to the starting point prior to the square brackets and continue with the command sequence following the square brackets.
到目前为止,我们使用的代码由一行不间断的代码组成。但是,当创建真正的分支(即从现有行分支的新行)时,L-Systems 首先变得有趣。这可以通过使用方括号([])来实现。方括号中的命令序列被视为一个单独的分支(并创建一个新的 Turtle)。在创建分支之后,turtle 将返回到方括号之前的起始点,并继续执行方括号之后的命令序列。
Type the following into the Premise field:
在 Premise 字段中输入以下内容:
F[+F][-F[-F]F]F[+F][-F]
F [ + f ][-f [-f ] f [ + f ][-f ]
If you now enter F into the Premise field and the above code (F=F[+F][-F[-F]F]F[+F][-F] ) into the Rules field, each F will be replaced by the braches at the left of the image. Increasing the Growth value will let the branch continue to grow because each straight line will be perpetually replaced by a new branch. If you look closely you will see the branch pattern at the left repeated in the tree at the right (highlighted in green).
如果您现在在 Premise 字段中输入 f,并在 Rules 字段中输入上面的代码(f = f [ + f ][-f ] f [ + f ][-f ]) ,那么每个 f 都将被图像左侧的 braches 所替换。增加生长值会让树枝继续生长,因为每条直线都会被一个新的树枝永久地替换。如果你仔细观察,你会发现左边的分支图案在右边的树上重复出现(用绿色突出显示)。
This is an easy method of creating complex plant-like branching:
这是一个简单的方法来创造复杂的类似植物的分支:
Until now we have generated everything on a flat plane. Since branching doesn’t only take place on a single plane but in every direction, command symbols exist that also makes this possible.
到目前为止,我们已经在一个平面上生成了所有的东西。由于分支不仅发生在单一的平面上,而且在每个方向上,命令符号的存在也使得这成为可能。
These are (a degree value can be added in brackets after the command symbols):
这些是(可以在命令符号后面的括号中加上学位值) :
& or ^: rotate around the Turtle’s transverse axis
& 或 ^ : 围绕海龟的横轴旋转
\ or ]: rotate around the Turtle’s longitudal axis
或者] : 围绕海龟的纵轴旋转
Type the following into the Premise field: F&F\ (90)^F+F:
在 Premise 字段中输入以下内容: f & f (90) ^ f + f:
The result is the Spline pictured above. The turtle moves forward (F), rotates at a right-angle around its transverse axis (&, Default Angle is set to 90°), moves forward again (F), rotates 90° around its longitudal axis (\ (90)), then 90° around its transverse axis (^), moves forward again (F), turns right (+) and finally moves forward again (F).
结果就是上图所示的样条曲线。海龟向前移动(f) ,绕横轴直角旋转(& ,默认角度设置为90 °) ,再向前移动(f) ,绕纵轴旋转90 ° (90) ,然后绕横轴旋转90 ° (^) ,再向前移动(f) ,向右转(+) ,最后再向前移动(f)。
If you use this method to create branched spatial formations, real bushes and trees can be created.
如果你使用这种方法来创建分支的空间结构,真正的灌木和树木可以创建。
用户资料
You can use the User Data as variables in a sequence of symbols. In the image above an Angle parameter was added to the User Data that was then substituted in parenthesis for ^ (turtle rotates around transverse axis) in the Premise field.
您可以将用户数据用作符号序列中的变量。在上面的图像中,一个角度参数被添加到用户数据中,然后在 Premise 字段中用括号替换 ^ (龟绕横轴旋转)。
Special characters and spaces should not be included in the variable names. Underscores are recognized (e.g., "second_length") as is capitalization.
变量名称中不应包含特殊字符和空格。下划线与大小写一样被识别(例如,“ second _ length”)。
公式
Formulas, including defined variables (e.g., F(_growth*2), can be used instead of normal digits. The following are available:
公式,包括已定义的变量(例如,f (_ growth * 2)) ,可以代替正常数字使用:
_total 总数 | The total number of commands in the current string (see below) 当前字符串中的命令总数(见下文) |
_index 索引 | The current command index in the string (see below( 字符串中的当前命令索引(参见下面的 |
_growth 成长 | The current growth level 目前的增长水平 |
_level 水平 | The current command level (if assigned, see below) 当前命令级别(如果分配了,请参见下面) |
_x, _y, _z ... ... ... ... ... ... . | The current Turtle position in space. 当前海龟在空间中的位置 |
_arg1, _arg2, _arg3, _arg4 1,arg2,arg3,arg4 | The first, second, third and fourth argument values (e.g., from F(1,2,3,4)) 第一个、第二个、第三个和第四个参数值(例如,来自 f (1,2,3,4)) |
_age 年龄 | The current command age (represents _growth - _level) beginning with 0.0. 当前命令年龄(表示从0.0开始的 _ growth-_ level) |
_length 长度 | The current arc length between Turtle and MoSpline origins. 当前 Turtle 和 MoSpline 之间的弧长起源 |
_move 快走 | The current default scale length. 当前默认比例尺长度 |
_tropism 向性 | The current Tropism. 当前的取向 |
_scale 比例尺 | The current default scale. 当前默认比例 |
_rotate 旋转 | The current default angle. 当前默认角度 |
_rnd, random 随机的 | A random number between -1.0 and +1.0 一个介于 -1.0和 + 1.0之间的随机数 |
例子「汇总/索引」
Let’s say you have the string F(_index)F(_index), which consists of two commands. The string performs the same function as F(1)F(2) (one unit forwards then two units forward). For example, since "_total" is the total number of commands, a spiral can be created with the following command:
假设您有一个字符串 f (_ index) f (_ index) ,它由两个命令组成。字符串执行与 f (1) f (2)相同的功能(一个单元向前转,然后两个单元向前)。例如,由于“ _ total”是命令的总数,可以使用以下命令创建一个螺旋:
Premise: FA
前提: FA
Rule: A=+(20*_index/_total)FA
规则: a = + (20 * _ index/_ total) FA
例子“ _ RND”
The following command:
下面的命令:
Startstring: A
起始字符串: a
Regel: A=+(_rnd*90)FA
Regel: a = + (_ rnd * 90) FA
The, _rnd*90’ command will ascertain a random angle between -90 and +90 for each growth spurt, i.e., a "wobbly" line with random rotations will result.
Rnd * 90’命令将确定每次生长高峰的随机角度在 -90和 + 90之间,也就是说,会产生一条随机旋转的“不稳定”线。
例子“ _ level”
Let’s say you have the following command:
假设你有以下命令:
Premise: A
前提: a
Rule: A=FA
规则: a = FA
The following level values will result (shown here in parentheses for demonstration purposes - these will NOT actually be shown):
结果如下(为了演示目的,在括号中显示——实际上不会显示) :
Growth = 0 : A(0)
成长 = 0: a (0)
Growth = 1 : F(1)A(1)
生长 = 1: f (1) a (1)
Growth = 2 : F(1)F(2)A(2)
生长 = 2: f (1) f (2) a (2)
Growth = 3 : F(1)F(2)F(3)A(3)
生长 = 3: f (1) f (2) f (3) a (3)
Now that you know how the "_index" numbering is done, take a look at the following command:
现在您已经知道了“ _ index”编号是如何完成的,接下来看看下面的命令:
Premise: FA
前提: FA
Rule: A=+F(_level*10)A
规则: a = + f (_ level * 10) a
… creates the following spiral with Default Angle set to 90°:
... 创建如下螺旋与默认角度设置为90 ° :
例子“ _ arg”
Just as you can define F(a,b,c)=F(a*2,b*2,c*2) to set parameters for Turtle commands (in this example F) you can also use the "_arg" command. These don’t have to be evaluated at the beginning. F=F (_arg1*2,_arg2*2,_arg3*2) does the same as the command above.
正如您可以定义 f (a,b,c) = f (a * 2,b * 2,c * 2)来为 Turtle 命令设置参数(在本例 f 中) ,您也可以使用“ _ arg”命令。这些不需要在一开始就进行评估。F = f (_ arg1 * 2,_ arg2 * 2,_ arg3 * 2)与上面的命令相同。
高级语法变体
The following syntax is also possible:
下面的语法也是可行的:
Premise: F(2)F(1,2)F(2,3)
前提: f (2) f (1,2) f (2,3)
Rule : F(a,b) = F(a*2,b*2)
规则: f (a,b) = f (a * 2,b * 2)
All Fs will be replaced and wherever "a" or "b" appear within the Rule existing F arguments will be handled as follows:
所有 f 都将被替换,规则现有 f 参数中出现“ a”或“ b”的地方将按以下方式处理:
F(2*2,1*2)F(1*2,2*2)F(2*2,3*2) which logically equates to F(4,2)F(2,4)F(4,6).
F (2 * 2,1 * 2) f (1 * 2,2 * 2) f (2 * 2,3 * 2) ,逻辑上等于 f (4,2) f (2,4) f (4,6)。
Rule constructs like the following are also possible:
像下面这样的规则构造也是可能的:
F(a,b):(a>10)=F(a,b)+F(a/2)
F (a,b) : (a > 10) = f (a,b) + f (a/2)
This Rule will, for example. only be applied if the value of the first argument is greater than 10.
例如,只有当第一个参数的值大于10时,才应用此规则。
In the following example both syntax variations above were combined and produce an interesting effect:
在下面的例子中,上面的两种语法变体被组合在一起,产生了一个有趣的效果:
例如「水果」
In the example above, several branches grow simultaneously. When one branch has finished growing a sphere will be placed at the end of the branch (requires the command J, see example: Cloner Object).
在上面的例子中,几个分支同时生长。当一个分支完成生长后,一个球体将被放置在分支的末尾(需要命令 j,参见示例: Cloner Object)。
Note that "B(6)" is defined in the first Rule and that "B(h-1)" reduces the argument by 1 in Rule 2 until "h=0" finally sets the sphere in Rule 3.
注意,“ b (6)”在第一条规则中定义,“ b (h-1)”在第二条规则中将参数减少1,直到“ h = 0”最终在第三条规则中设置球面。
Take a look at the console to see the entire string (but first click on the Result String to Console button).
查看控制台以查看整个字符串(但首先单击 Result String to Console 按钮)。
Further details regarding formulas can be found in the attachment.
关于公式的更多细节可以在附件中找到。
前提
Enter the premise here. This is most often a single-letter command (see Rules) or a placeholder to which content is added in the Rule field. In the following pages you will find numerous examples of how strings can look.
从这里进入前提。这通常是一个单字母命令(请参阅规则)或在 Rule 字段中添加内容的占位符。在下面的页面中,您将找到许多关于字符串的外观的示例。
上下文忽略
Here you can define a series of symbols (commands) that will be ignored by context rules. Example:
在这里,你可以定义一系列符号(命令) ,它们将被上下文规则所忽略。例如:
You have the following constellation:
你有以下的星座:
Premise: A+B+C+D+E+F
前提: a + b + c + d + e + f
Rules: A<B=C
规则: a < b = c
规则
F(a,b,c) F (a,b,c) | Moves the Turtle forwards and optionally draws lines along its length (a), for scale (b) and/or subdivision (c). 将 Turtle 向前移动并可选地沿着它的长度(a)绘制线条,用于缩放(b)和/或细分(c) |
f(a) F (a) | Moves the Turtle forwards and NO line will be drawn (i.e. a Spline segment will be ended) "a" is the optional length value. 将 Turtle 向前移动并且不绘制直线(即样条段将结束)“ a”是可选的长度值 |
H(a,b,c) H (a,b,c) | Moves the Turtle forwards and optionally draws a line half as long as its length (a), its scale (b) and/or its subdivision (c) 将 Turtle 向前移动,并有选择地绘制一条长度为其长度(a)、刻度(b)和/或细分(c)一半的线 |
h(a) H (a) | Moves the Turtle forwards and NO line will be drawn (i.e. a Spline segment will be ended) "a" is the optional half length value. 将 Turtle 向前移动并且不绘制直线(即样条段将结束)“ a”是可选的半长值 |
M(x,y,z) M (x,y,z) | Moves and draws a line. The Turtle will move within local coordinates (x,y,z) but will itself not rotate. 移动并画线。乌龟将在局部坐标(x,y,z)内移动,但它本身不会旋转 |
m(x,y,z) M (x,y,z) | Turtle moves forward but does not draw a line. The Turtle moves within local coordinates (x,y,z) but will itself not ,rotate. 海龟向前移动,但不画线。海龟在局部坐标(x,y,z)内移动,但是它自己不会旋转 |
G(a) G (a) | Turtle moves forward but does not draw a line and does not end a Spline segment. "a" is the optional length value. Turtle 向前移动,但不绘制直线,也不结束样条段。“ a”是可选的长度值 |
R | Resets the Turtle back to the segment starting point, resets the rotation and draws a line (in a MoSplineTurtle a segment is always contained in [ ]). 将 Turtle 重置回段的起始点,重置旋转并绘制一条线(在 MoSplineTurtle 中,段总是包含在[]中) |
r | Resets the Turtle back to the segment starting point, resets the rotation and does not draw a line (in a MoSpline Turtle a segment is always contained in [ ]). 将 Turtle 重置回段的起始点,重置旋转并且不绘制直线(在 MoSpline Turtle 中,段总是包含在[]中) |
P(x,y,z) P (x,y,z) | Places the Turtle at these coordinates and draws a line. 把海龟放在这些坐标上并画一条线 |
p(x,y,z) P (x,y,z) | Places the Turtle at these coordinates and does not draw a line. 把海龟放在这些坐标上,不画线 |
-(a) - (一) | Rotates the Turtle counterclockwise around the vertical axis. "a" is the optional angle value. 围绕垂直轴旋转逆时针方向。“ a”是可选的角值 |
+(a) + (a) | Rotates the Turtle clockwise around the vertical axis. "a" is the optional angle value. 围绕垂直轴顺时针旋转海龟。“ a”是可选的角值 |
&(a) (一) | Rotates the Turtle forwards around the transversal axis "a" is the optional angle value. 将 Turtle 沿横向轴“ a”向前旋转是可选的角度值 |
^(a) ^ (a) | Rotates the Turtle backwards around the transversal axis. "a" is the optional angle value. 沿横轴向后旋转 Turtle。“ a”是可选的角值 |
/(a) | Rotates the Turtle clockwise around the center axis. "a" is the optional angle value. 围绕中心轴顺时针旋转乌龟。“ a”是可选的角值 |
\(a) (a) | Rotates the Turtle counterclockwise around the center axis. "a" is the optional angle value. 围绕中心轴旋转逆时针方向。“ a”是可选的角值 |
[ | New branch = new Turtle 新的分支 = 新的海龟 |
] | Branch ends 分支结束 |
{ | Polygon begin (see example below: "Polygon creation") 多边形开始(见下面的例子: “创建多边形”) |
} | Polygon end 多边形末端 |
. | (Dot - Full Stop) Adds a polygon point - within curly brackets for polygons: e.g. = { . -f . +f . +f . +f } 在多边形的花括号中添加一个多边形点: 例如 = {。- f.+ f.+ f.开始吧 |
| | Rotates the Turtle 180' around the vertical axis. 围绕垂直轴旋转 Turtle 180’ |
* | Rotates the Turtle 180' around the center axis . 围绕中心轴旋转 Turtle 180’ |
% | Prunes the branch at this point - everything will be ignored though to the end of the close bracket: ] see example "Prune branch". 在这一点上 Prunes 的分支——所有内容都将被忽略,尽管直到闭括号的末尾: ]参见示例“ Prune 分支” |
"(a) (a) | Multiplies the length by the optional "a" value tor each generation (see example below .Example: Multiply/divide). 每一代的长度乘以可选的“ a”值(参见下面的示例)。例如: 乘除法) |
!(a) ! (a) | Multiplies the scale by the optional "a" value for each generation (MoSpline diameter when used in conjunction with Sweep object). 将每一代的缩放比例乘以可选的“ a”值(MoSpline diameter 与 Sweep 对象结合使用时) |
;(a) (a) | Multiplies the angle by the optional value "a" for each generation. 每一代的角度乘以可选值“ a” |
_(a) _ (a) | Divides the length by the optional value "a" for each generation. 每一代用可选值“ a”除长度 |
?(a) ? (a) | Divides the scale by the optional value "a" for each generation (MoSpline diameter when used in conjunction with Sweep object). 每一代用可选值“ a”除比例(与 Sweep 对象结合使用时,MoSpline 直径) |
@(a) @ (a) | Divides the angle by the optional value "a" for each generation. 每一代用可选值“ a”除角 |
T(a) (a) | Adds Tropism (e.g. FTFTF), Which means that each Spline segment will curve slightly in the direction of the global Y axis. Any particle modifiers present will be evaluated. 增加向性(例如 ftf) ,这意味着每个样条段将沿着全局 y 轴方向略微弯曲。任何粒子力场目前将进行评估 |
$(x,y,z) $(x y z) | Displays the end of an Up Vector and orients the Turtle accordingly. Define a vector in whose direction the Turtle should face. 显示向上矢量的结尾并相应地指向海龟。定义一个向量,海龟应该面向其方向 |
I(a,r,g,b) I (a,r,g,b) | (First character string begins with a capitol "i") (第一个字符串以 capitol“ i”开头) |
J(a,r,g,b) J (a,r,g,b) | |
K(a,r,g,b) K (a,r,g,b) | |
L(a,r,g,b) L (a,r,g,b) | For the above "I, J, K, and L", any number of clones generated by a Cloner object can be arranged along the Turtle Spline. "r,g,b" represents the color of the clone . "a" is the index (i.e. the number that represents the order in which an object is arranged below a Cloner. see "Index" below). I, J, K, L represent the respective Groups in the Cloner object's Mode parameter, "Group 1", "Group 2", "Group 3", "Group 4". An example is given below under "Example: Cloner object". 对于上面的“ i,j,k 和 l” ,Cloner 对象生成的任意数量的克隆都可以沿着 Turtle Spline 排列。“ r,g,b”代表克隆的颜色。“ a”是索引(即表示对象排列在 Cloner 之下的顺序的数字)。请参阅下文的「索引」)。I,j,k,l 表示 Cloner 对象的 Mode 参数“ Group 1”、“ Group 2”、“ Group 3”、“ Group 4”中的各个组。下面给出了一个例子“实例: Cloner 对象” |
例如,创建多边形
Take a look at the second line of the Rule field:
看看 Rule 字段的第二行:
L=[{.-f.+f.+f.++++f.+f.+f.+f}]
L = [{ .-f + f + f + + f + f + f + f + f }]
Between the curly brackets (these define a polygon), a specific number of polygon points is defined (each begins with a ".") between which a polygon is created. Because the curly brackets are contained within square brackets, the turtle will be reset to its point prior to creating the leaf after each leaf has been created.
在花括号(这些定义了一个多边形)之间,定义了一定数量的多边形点(每个点以“ . ”开头)在其中创建一个多边形。因为花括号包含在方括号中,所以在创建每片叶子之前,龟龟将被重置到它的点。
The entire leaf will be assigned to an "L" and the Rule in the line above will create a complete leaf wherever an "L" exists.
整个叶子将被分配给一个“ l” ,上面一行的规则将创建一个完整的叶子,只要有一个“ l”存在。
Note that the MoSpline can produce either a Spline OR a polygon. If you want to produce both simultaneously, use the Destination Spline.
注意,MoSpline 可以生成样条或多边形。如果希望同时生成这两个属性,请使用目标样条。
例如“ multiply/divide”
If you use a self-replacing sequence of symbols in the Rules field (e.g., A=F+BA), a multiplier or divisor (", !, ;, _, ?, @) can be used to increase or decrease the value of each new Generator.
如果在 Rules 字段中使用自替换的符号序列(例如,a = f + ba) ,则使用乘数或除数(” !... ... ... ... ?,@)可用于增加或减少每个新生成器的值。
例如「砍树枝」
If you take a look at this Rule you will see that the placeholders A, B, C and D have been added to the premise. For various Growth values, the Rules now define the replacement of each placeholder with a % value, which means that the following symbols will be cut off at that point on (and per) each branch.
如果你看一下这个规则,你会发现占位符 a,b,c 和 d 已经被加到了前提中。对于不同的 Growth 值,Rules 现在用% 值定义每个占位符的替换,这意味着在每个分支上(和每个分支上)的那个点将切断以下符号。
例如“ Cloner 对象”
Note how J and K are used in the Rule (these could be replaced with (1,1,1,1) and (1,1,1,1), respectively, and if the parentheses argument were omitted each would use the standard value) that refers to the clones of a Cloner object. The mode must be set accordingly for both Cloner objects:
注意如何在 Rule 中使用 j 和 k (可以分别用(1,1,1,1)和(1,1,1,1)替换它们,如果省略括号参数,每个参数将使用引用 Cloner 对象克隆的标准值)。对于 Cloner 对象,必须相应地设置模式:
I(1,1,1,1) reflects Group 1
I (1,1,1,1)反映第1组
J(1,1,1,1) reflects Group 2
J (1,1,1,1)反映了第二组
K(1,1,1,1) reflects Group 3
K (1,1,1,1)反映第三组
L(1,1,1,1) reflects Group 4
L (1,1,1,1)反映了第4组
Note that one Rule
请注意一条规则
Premise: FA
前提: FA
Rules: A=FX
规则: a = FX
X=J(1,1,1,1)
X = j (1,1,1,1)
may function but the clones don’t grow steplessly but are simply displayed abruptly.
可能会发挥作用,但克隆不会无情地生长,而只是简单地突然显示。
示例“索引”
A Cloner object’s Child objects are numbered sequentially (starting with "0"). If, for example, you define A=FJ(2,1,1,1)A (the RGB values can be omitted), the Cloner object will only use the object with the index "2" (left of the sphere). If you use A=J(rnd(2))A on the right side, a clone will be placed randomly in accordance with a number between "0" and "2" that is also chosen randomly.
Cloner 对象的子对象按顺序编号(从“0”开始)。例如,如果定义 a = FJ (2,1,1,1) a (可以省略 RGB 值) ,Cloner 对象将只使用索引为“2”的对象(球体左侧)。如果你在右边使用 a = j (rnd (2)) a,那么一个克隆就会按照“0”和“2”之间的一个数字随机放置,这个数字也是随机选择的。
例如“随机增长”
This Rule in combination with varied User Data values for Limit1 and Limit2 (together, these values should equal 100%) can be used to create differing but very similar "plants" (Stochastic L-Systems. The conditions (rnd(1)<) or (rnd(1)>) determine randomly which of the 3 Rules will be applied (each with a new random selection for each new Generator, i.e., larger Growth parameter).
这个规则结合 Limit1和 Limit2的不同用户数据值(加在一起,这些值应该等于100%)可以用来创建不同但非常相似的“植物”(随机 l 系统)。条件(rnd (1) <)或(rnd (1) >)随机决定哪个规则适用(每个规则对每个新的生成器都有一个新的随机选择,即,更大的生长参数)。
例如“上下文规则”
Rules can also be written in the following form:
规则也可以以下列形式编写:
Premise: ABC
前提: ABC
Rule: A<B=C
规则: a < b = c
Result (if Growth > 1): ACC
结果(如增长 > 1) : 需氧菌落计数
So what will happen? This depends on the sequence within the result string. The Rule "A<B=C" searches for instances within the string where a "B" directly follows an "A" and replaces the "B" by a "C".
那么接下来会发生什么呢?这取决于结果字符串中的序列。规则“ a < b = c”在字符串中搜索“ b”直接跟在“ a”后面并用“ c”替换“ b”的实例。
If, on the other hand, you enter "A>B=C", the "A" to the left of a "B" will replaced by "C" (the result would be "CBC").
另一方面,如果输入“ a > b = c” ,则“ b”左边的“ a”将替换为“ c”(结果是“ CBC”)。
For the Rule "AB=C" it cannot be determined which symbol should be replaced by "C". In this case both will be replaced by "C" (the result would be "CCC").
对于“ AB = c”规则,无法确定哪个符号应该被“ c”所取代。在这种情况下,两者都将被“ c”所取代(结果将是“ CCC”)。
结果
Displays syntax errors.
显示语法错误。
结果字符串到控制台
Clicking on this button will display the symbol sequence currently in effect, taking into account all Rules and the Growth parameter, in the Console. Such a sequence can, for example, look like this (this is the sequence of symbols from the fruits example with Growth set to 4):
单击此按钮将在控制台中显示当前生效的符号序列,其中考虑到所有规则和 Growth 参数。例如,这样的一个序列可以看起来像这样(这是来自水果的符号序列,增长设置为4) :
OMOSPLINE-MGMOSPLINEOBJECT_TURTLE_GROUP_TURTLE.html