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