www.schorsch.com

Rayfront 1.0 User Manual

Functional Expressions

Expressions can be used as the right hand side of a variable or function definition in a function file, or in a variable field of many modifier definitions. Note that expressions in a modifier definitions may not contain any whitespace.

Operators

Operators provide the basic functionality of the language. The order of evaluation is determined by the prcedence of each operator. An operator of higher precedence will be evaluated first, and the result of its operation will be used in the evaluation of the remaining operators. If two operators have the same precedence, then they are evaluated from left to right.

If you need an operator with lower precedence evaluated before a higher one, then you can use parens to enclose it in a group. Groups can be nested arbitrarily. The following examples illustrate the use of grouping to override the builtin precedence of two operators:

```    3.0 - 1.0  * 5.0     ->  14.0
(3.0 - 1.0) * 5.0     ->  10.0
```

The following operators are available:

Operators

Precedence:
f(x) Function call: Calls the function f with the argument(s) x. 6
(x) Group: Changes the precedence of other operators. 6
-x Unary minus: The negative of x. 5
x^y Exponent: x by the exponent of y (xy). 4
x*y Mulitply: The product of x and y. 3
x/y Divide: The quotient of x by y. 3
x+y Plus: The sum of x and y. 2
x-y Minus: The difference between x and y. 2
x,y Comma: Seperates arguments in function calls. 1

Functions and Variables

To make an expression useful, the operands of above operators may be given as the names of variables or functions. Radiance defines a number of builtin variables and functions, and many more are added by the global function file rayinit.cal. All global definitions are listed here.

In addition to the global definitions, an expression in a function file may refer to all function and variable definitions existing in the same file, even recursively. The definitions in a function are also available in a modifier definition which references that file.

Function calls or variable references are expressions of their own, and may be used wherever an expression is valid. The value of this expression is the result of the function or the value of the variable.

If a function name alone is used as an argument to another function, then the passed function may be called with the correct number of arguments within the receiving function. Using a function name as an operand to an operator directly is not valid and will cause a runtime error. Note that Rayfront can't check for this error when you enter the expression (most other errors are diagnosed while editing).

Back to plastic2 |
Back to metal2 |
Back to trans2 |
Back to prism1 | prism2
Back to BRTDfunc

Back to colorfunc | brightfunc

Back to texfunc |

Back to mixfunc

http://www.schorsch.com/en/software/rayfront/manual/exprdef.html