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.

Name | Description |
---|---|

Add | Adds 2 values. |

Multiply | Multiplies 2 values. |

Subtract | Subtracts 2 values. |

Divide | Divides 2 values. |

Negate | Negates the value. |

Floor | Rounds down the value. |

Ceiling | Rounds up the value. |

Delay | Delays value by some time. |

Exponential Smoothing | Returns a smoothed signal based on the damping factor which is measured in milliseconds. |

Sine | Calculates the sine of the given argument. |

Cosine | Calculates the cosine of the given argument. |

Tangent | Calculates the tangent of the given argument. |

Arcsine | Calculates the arcsine of the given argument. |

Arccosine | Calculates the arccosine of the given argument. |

Arctangent | Calculates the arctangent of the given arguments. |

Exponential | Calculates the natural exponentiation of the given argument. |

Logarithm | Calculates the natural logarithm of the given argument. |

Power | Calculates the value of the first parameter raised to the power of the second. |

Modulo | Calculates division remainder for the given values. |

Round | Rounds the value according to the specified rounding mode. |

Absolute | Returns the absolute value of the argument. |

Sign | Extracts the sign of the value. |

Minimum | Returns the lesser of two values. |

Maximum | Returns the greater of two values. |

Clamp | Constrains a value to lie between two given bounds. |

Mix | Linearly interpolates between two values modulated by Alpha. |

Step | Generates a step function by comparing two values. |

Smooth Step | Performs Hermite interpolation between two values. |

Square Root | Calculates the square root of the value. |

From Range | Maps the given value from the specified range to the [0, 1] range. |

To 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 `(5,7)`

and `(1,6)`

and we use the Add patch, the outputs will be `(6,13)`

.

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 `(7,9)`

.

Name | Description |
---|---|

Dot Product | Calculates the dot product of two vectors. |

Cross Product | Calculates the cross product of two vectors. |

Distance | Calculates the distance between two points. |

Length | Calculates the length of a Vector. |

Normalize | Calculates the unit vector in the same direction as the original vector. |

Reflect | Calculates the reflection direction for an incident vector. |

Find inspiration, see examples, get support, and share your work with a network of creators.

Join CommunityFind inspiration, see examples, get support, and share your work with a network of creators.

Join Community