Expression block reference

Functions and operators

Basic arithmetics and braces

All four basic arithmetic operations available: +, -, /, *.

When a single value (scalar) is combined with a vector by operations above, each component of the vector is combined with the single value and result is the vector:

scalar * {x, y, z} = {x * scalar, y * scalar, z * scalar}

Two vectors only with the same dimensions can be combined by these operations. In this case components of the vectors are combined separately and the result is a vector with the same dimensions:

{x1, y1, z1} + {x2, y2, z2} = {x1 + x2, y1 + y2, z1 + z2}

Also, you can use braces to set up priority for operations:

1.0 + (2.0 * 3.0) = 7.0

Available functions

vec2(x, y), vec3(x, y, z)

These functions create a two- or three-dimensions vector. It can be used as result or for further operations inside expression:

0.5 * vec2(4.0, 8.0) will result two dimensional vector {2.0, 4.0}

abs(f)

Returns absolute value of “f”. As “f” you can use any expression or input.

length(v)

Returns length of 2- or 3-dimensional vector “v”.