Math patches can be used to perform a math operation on their input.
Add them to your graph by right-clicking in the Patch Editor and selecting from the menu. The menu will show a description for each port.
Adds 2 values.
Multiplies 2 values.
Subtracts 2 values.
Divides 2 values.
Negates the value.
Rounds down the value.
Rounds up the value.
Delays value by some time.
Returns a smoothed signal based on the damping factor which is measured in milliseconds.
Calculates the sine of the given argument.
Calculates the cosine of the given argument.
Calculates the tangent of the given argument.
Calculates the arcsine of the given argument.
Calculates the arccosine of the given argument.
Calculates the arctangent of the given arguments.
Calculates the natural exponentiation of the given argument.
Calculates the natural logarithmn of the given argument.
Calculates the value of the first parameter raised to the power of the second.
Calculates division remainder for the given values.
Rounds the value according to the specified rounding mode.
Returns the absolute value of the argument.
Extracts the sign of the value.
Returns the lesser of two values.
Returns the greater of two values.
Constrains a value to lie between two given bounds.
Linearly interpolates between two values modulated by Alpha.
Generates a step function by comparing two values.
Performs Hermite interpolation between two values.
Calculates the square root of the value.
Maps the given value from the specified range to the [0, 1] range.
Maps the given value from the [0, 1] range to the specified range.
The patches in the table above will apply the operation separately on each component of the input.
So, if the input is Vector2 with the values
(3.1,4.7), and we used the Round patch, the outputs will be (3, 5).
This also applies if there are two inputs. If you have an input of
(1,6) and we use the Add patch, the outputs will be
The input types must be compatible, for example you can't have an input of Vector2 and input of Vector3 connected to the same Add patch.
If you want to use a number and another input, for example Vector2, Spark AR Studio will automatically expand the number to the corresponding input. So, if you have an input of
(5,7) and the number 2 in an Add patch, the output would be
Calculates the dot product of two vectors.
Calculates the cross product of two vectors.
Calculates the distance between two points.
Calculates the length of a Vector.
Calculates the unit vector in the same direction as the original vector.
Calculates the reflection direction for an incident vector.