Formula

方程式

General

常规

You can type in a formula for the Formula spline primitive and the Formula deformer. In fact, you can type in a formula wherever Cinema 4D accepts a value, e.g., in the Attribute Manager. This appendix lists all the units, operators, functions and constants that you may use in your formulae. You may enter values using any of the units listed below (examples in brackets) - regardless of the basic units defined in the preferences (Cinema 4D will convert the units for you).

您可以键入公式样条基元和公式分解器的公式。事实上,你可以在 Cinema 4D 接受一个值的地方输入一个公式,例如,在 Attribute Manager 中。这个附录列出了所有的单位,运算符,函数和常量,你可以在你的公式中使用。您可以使用下面列出的任何单位(括号中的例子)输入值——不管在首选项中定义的基本单位(Cinema 4D 将为您转换单位)。

Arguments such as mod(a;b) must be separated by a semi-colon or by squared brackets [] (then without curved brackets)

诸如 mod (a; b)之类的参数必须用分号或方括号[]分隔(然后去掉曲括号)

rnd(100) is the same as rnd[100] and rnd(100;234) is the same as rnd([100][234]).

Rnd (100)等于 rnd [100] ,rnd (100; 234)等于 rnd ([100][234])。

Curly brackets (e.g., rnd(a{;b})) represent optional, i.e., must not necessarily be used, values. 大括号(例如,rnd (a { ; b }))表示可选的,也就是说,不一定要使用值

Note the special variables in association with multiple selections in the following paragraph.

请注意下面段落中与多重选择相关的特殊变量。

Expanded Formula Entry by Multiple Selections

多重选择扩展公式输入

You can also make relative adjustments to multiple selected objects. For example, suppose a sphere is positioned at (100,0,0) and a cube at (300,0,0). Select both objects and in the Attribute Manager, on the Coord tab, enter x + 100 into the P.X box. Both objects will be moved 100 units along the X axis. You can also enter equations, such as sin(x)+sqr(x*324).

您还可以对多个选定对象进行相对调整。例如,假设一个球体位于(100,0,0) ,一个立方体位于(300,0,0)。选择这两个对象,在属性管理器中,在 Coord 选项卡上,在 P.X 框中输入 x + 100。两个对象将沿 x 轴移动100个单位。您还可以输入等式,比如 sin (x) + sqr (x * 324)。

The following variables are available:

以下变量是可用的:

x: Represents the parameter’s original value

X: 表示参数的原始值

num: Represents the index value. The selected elements/objects will be numbered

Num: 表示索引值。选定的元素/对象将被编号

tot: The total number of selected elements/objects

Tot: 选定元素/对象的总数

rnd(value): A random value between 0 and "value" will be ascertained

Rnd (值) : 将确定介于0和“值”之间的一个随机值

Examples

例子

Tip: 提示:
If you want to define color values using this method, right-click on the 如果要使用此方法定义颜色值,请右键单击Color 颜色 parameter and select 参数和选择Show Subchannels 显示子频道 from the context menu that appears. This method works with these Subchannels. 从出现的上下文菜单。这种方法适用于这些子信道

Units

单位

A custom value can be entered, independently of any preset values.

可以独立于任何预设值输入自定义值。

Tip: 提示:
If you change the basic units in the preferences, e.g., from meters to millimeters, only the measurement units are changed, not existing numerical values. For example, if an object has a width of 10 meters, but you then change the basic units to millimeters, the object will then have a width of 10 millimeters. If you wish to scale the objects to reflect the change in units, group all the objects and scale the group using the 如果你改变了偏好中的基本单位,例如,从米到毫米,只改变了测量单位,而不是现有的数值。例如,如果一个物体的宽度是10米,但是你把基本单位改为毫米,那么这个物体的宽度就是10毫米。如果您希望缩放对象以反映单位的变化,请将所有对象分组并使用Coordinate Manager 协调经理.

Functions

功能

Tip: 提示:
Function arguments must be bracketed. The number of open brackets must equal the number of close brackets. Functions may be nested: sin(sqr(exp(pi))). 函数参数必须括起来。开括号的数量必须等于闭括号的数量。函数可以被嵌套: sin (sqr (exp (pi)))

Trigonometric function arguments will always be interpreted as degrees. Hence, the entry sin(2*pi) does not reflect the calculation of a sine of 360° but rather of approx. 6.283°.

三角函数的论点总是被解释为程度。因此,条目 sin (2 * pi)不反映360 ° 正弦的计算,而是反映大约6.283 ° 正弦的计算。

General

常规

When typing in a formula for the spline or Formula time curve, the arguments of trigonometric functions are in radians. However, when entering values in parameter text boxes, trigonometric functions always use degrees.

当键入样条曲线或公式时间曲线的公式时,三角函数的参数是弧度。但是,当在参数文本框中输入值时,三角函数总是使用度数。

The function parser has the most important arithmetic operators built in. You can combine operations freely, for example: 2km + exp(sin(4mm*pi)) / ((sin(14cm))^2 + (cos(14cm))^2).

函数解析器内置了最重要的算术运算符。您可以自由地组合操作,例如: 2 km + exp (sin (4mm * pi))/(sin (14cm)) ^ 2 + (cos (14cm)) ^ 2)。