Skip to content

Instantly share code, notes, and snippets.

static double[] table = null;
static double step;
static double invStep;
static int size = 0;
static
{
size = 10000;
table = new double[size];
step = 2d * Math.PI / size;
@micycle1
micycle1 / Triangle Wave Function
Last active November 17, 2018 21:23
Triangle Wave Function
Function for triangle-wave y coordinate (oscillate between 0 and m).
y = m - abs(t % (2*m) - m)
Where:
y = output
m = max value (peak)
t = time