Skip to main content

vScriptValMath

Applies one of 31 math operations to every X, Y and Z value, with a number or a second array.

IntermediateMograph / ScriptValScriptValArrayJSON
vScriptValMath node

vScriptValMath reads each element of Input A as X, Y and Z and combines it with a number or with the matching element of Input B. Operation chooses the formula, and the output has three values per element.

Parameters​

ParameterTypeDefaultDescription
WhichInteger—Hidden control. Range 1 to 64. Not read by the code.
OperationDropdownAddOne of 31 operations, default Add: Add, Subtract A-B, Multiply, Divide A/B, Min, Max, Average, Difference, Modulo A/B, Power A^B, Arc Tangent A/B, Pi, Sine, Cosine, Tangent, Arc Sine, Arc Cosine, Arc Tangent, Log, Log 10, Exponential, Degrees to Radians, Radians to Degrees, Absolute Value, Ceiling, Floor, Square Root, Reciprocal, Negate, Random, Random A to B and Matrix Multiply.
Input NumberDropdownUse NumberUse Number (default) uses the Number control as B. Use Array uses Input B and shows its port.
NumberFloat1The B value in Use Number mode, used on all three axes. Slider -1 to 1, default 1.
ConnectedInteger0.0Set to 1 automatically when Input B is connected, otherwise 0. Not meant to be edited.
+3 more parameters
ParameterTypeDefaultDescription
Input ADATATYPE—First input.
Input BDATATYPE—Second input.
MatrixText—ScriptVal family. Matrix input used by Matrix Multiply.
Read the full description

Each element of Input A is read as X, Y and Z (a single number is used for all three) and the operation runs on each axis against B. B is the Number control (default 1) in Use Number mode, or the matching element of Input B in Use Array mode, with 0 for missing entries.

Operation offers 31 choices: arithmetic, min, max, modulo, power, trigonometry, logs, rounding, reciprocal and random values. Divide, Modulo, Log, Square Root, Reciprocal, Arc Sine and Arc Cosine return 0 where they are undefined. Matrix Multiply multiplies a translation made from each element by a matrix from Input B and outputs the resulting position.

Negate returns -A. Random returns A times a random value from 0 to 1, and Random A to B returns a random value between A and B.

Example Connections​

vScriptValRandom.Output -> vScriptValMath.ArrayA
vScriptValMath.Output -> vScriptValDisplaceValues.ArrayA
vScriptValDisplaceValues.Output -> vScriptValCameraProjection.ArrayA