Calculator
Summary: This process allows you to perform mathematical operations on Coverage data.
Input:
- Input Coverage (1 to 26 Coverage) The coverages to operate on.
- Description: A new coverage where values for the cells are calculated from the formula entered.
Attributes:
- Expression The mathematical formula that defines how the output is calculated from the inputs.
Details
The inputs are 1 to 26 coverages that are referenced by letters of the alphabet (lower case) in the order that corresponds to their input sequence. A simple example would be to write a custom blender function where you want to combine 1/2 of the first input (a), 1/4 of the second input (b), and 1/4 of the third input (c). To specify this you would enter the following calculation string in the Expression box:
a * 0.5 + b * 0.25 + c * 0.25
Another use would be to brighten a dark image. We could brighten it using this function:
min(255, a * 2.0)
We use the min function to make sure that our RGB values donâ€™t get too high since RGB data should be in the range 0 to 255.
The variables a through z represent the value of the coverage of inputs 1 through 26.
The special variables PI and E are available and resolve to the mathematical values one would expect.
The following functions are available for use in the expression attribute:
abs(x)
Return the absolute value of 'x'.
mod(x, y)
Return the remainder of 'x' divided by 'y'.
ipart(x)
Return the integer portion of 'x'.
fpart(x)
Return the fraction portion of 'x'.
min(x, y, z, ...)
Return the value of the smallest parameter.
max(x, y, z, ...)
Return the value of the largest parameter.
sqrt(x)
Return the square root of 'x'.
sin(x), cos(x), tan(x)
Return the sine, cosine, or tangent of 'x'.
sinh(x), cosh(x), tanh(x)
Return the hyperbolic sine, cosine, or tangent of 'x'.
asin(x), acos(x), atan(x)
Return the inverse since, cosine, or tangent of 'x'.
atan(y, x)
Return the inverse tangent of 'y' divided by 'x', with the correct angle for the quadrant of (x, y).
log(x)
Return the base 10 logarithm of 'x'.
ln(x)
Return the natural logarithm of 'x'.
exp(x)
Return the value of E raised to the power of 'x'.
logn(x, y)
Return the base 'y' logarithm of 'x'.
ceil(x)
Return the value of 'x' raised to the nearest integer.
floor(x)
Return the value of 'x' dropped to the nearest integer.
rand(&seed)
Return a random number from 0 to 1 inclusive. 'seed' is used to generate the number and is changed for the next number.
random(min, max, &seed)
Return a random number from 'min' to 'max'.
randomize(&seed)
Initialize the seed with a random value, based on the computer time and the number of times randomize has been used.
deg(x)
Return 'x' radians converted to degrees.
rad(x)
Return 'x' degrees converted to radians.
rect2pol(x, y, &distance, &angle)
Convert rectangular coordinates 'x' and 'y' to polar coordinates and store the result in 'distance' and 'angle'. Returns distance.
pol2rect(distance, angle, &x, &y)
Convert polar coordinates 'distance' and 'angle' to rectangular coordinates and store the result in 'x' and 'y'. Returns x.
if(c, t, f)
If 'c' is not zero, evaluates and returns 't', otherwise evaluates and returns 'f'. Only one of 't' or 'f' is evaluated.
select(c, n, z), select(c, n, z, p)
If 'c' is less than zero, evaluates and returns 'n'. If 'c' is zero, evaluates and returns 'z'. If 'c' is greater than zero, evaluates and returns 'z' for three arguments and 'p' for four arguments. Only one of 'n', 'z', or 'p' is evaluated.
equal(x, y)
Returns 1 if 'x' is equal to 'y', else returns 0.
above(x, y)
Returns 1 if 'x' is greater than 'y', else returns 0.
below(x, y)
Returns 1 if 'x' is less than 'y', else returns 0.
clip(x, min, max)
Clips 'x' to the range 'min' and 'max'.
clamp(x, min, max)
Clamps 'x' to the range 'min' and 'max', wrapping as needed.
rescale(p, o1, o2, n1, n2)
Rescales a point 'p' from the range 'o1' - 'o2' to the range 'n1' - 'n2'.
poly(x, ...)
Calculate the polynomial with the value of 'x' and given terms. The right-most argument is the multiplier for the exponent of zero, and increases to the left. poly(4, 3, 5, 2, 8) is 3 * 4 ^ 3 + 5 * 4 ^ 2 + 2 * 4 ^ 1 + 8
and(x, y)
Returns 0 if 'x' or 'y' is 0, else returns 1.
or(x, y)
Returns 0 if 'x' and 'y' is 0, else returns 1.
not(x)
Returns 1 if 'x' is 0, else returns 0.