public static double Repeat(double t, double length) { return(t - MathD.Floor(t / length) * length); }