Repeat (LogiX node)

From Neos Wiki
Jump to navigation Jump to search
Other languages:

The Repeat node in the Math category takes two arguments, N and Length and outputs the result of the following calculation

N - floor(N/Length) * Length

so that the output goes between 0 and Length in a repeating fashion, as described in Usage.


Inputs & Outputs

Inputs
Color Label Type
N float
Length float
Outputs
Color Label Type
* float

Usage

This node repeats values between 0 and Length, as N is increased. When N is 0, the output is 0, and then the output increases with N, until N reaches the value Length, and it goes to 0, and repeats this pattern for ever. This pattern looks like a positive-valued sawtooth wave as shown below, for a value of Length=2.2

Repeat node function.png

Here is an interactive version of the function, where l is Length https://www.desmos.com/calculator/7cg7gadknr

Note: This node behaves in the same way as Modulus operator (denotes %) in other programming languages, like Python. LogiX uses the different definition of % which C# uses, and therefore offers the Repeat node when the above behaviour is desired.

The Repeat01 (LogiX node) is equivalent to this node, where Length is set to 1.

Examples

Node Menu

Math
Back Binary Constants DateTime Enums Matrix Physics
Quantity Random Rect Rotation Shaping TimeSpan Abs
Acos Asin Atan Atan2 Avg Ceil Ceil To Int
Clamp Clamp01 Constant Lerp Constant Slerp Cos Cosine Lerp Cubic Lerp
Exp Floor Floor To Int Greatest Common Divisor Inverse Lerp Is Between Least Common Multiple
Lerp Log Log N Log10 Max Min Multi Lerp
Multi Slerp Nth Root Ping Pong Pow Remap Remap -1..1 to 0..1 Repeat
Repeat01 Round Round To Int Sigmoid Sign Simplex Noise Sin
Slerp Smooth Lerp Sqrt Tan