// whatever the use of this should be public static double GregorianDayOfMonthFromJulianDay(double J) { // the following calculates the day of the month of a JD var p = Fun.Floor(J + 0.5); var s1 = p + 68569; var n = Fun.Floor(4 * s1 / 146097); var s2 = s1 - Fun.Floor((146097 * n + 3) / 4); var i = Fun.Floor(4000 * (s2 + 1) / 1461001); var s3 = s2 - Fun.Floor(1461 * i / 4) + 31; var q = Fun.Floor(80 * s3 / 2447); var e = s3 - Fun.Floor(2447 * q / 80); // int s4 = System.Math.Floor(q / 11); // int m = q + 2 - 12 * s4; // int y = 100 * (n - 49) + i + s4; return(e + J - p + 0.5); }
// whatever the use of this should be public static double GregorianDayOfMonthFromJulianDay(double J) { // the following calculates the day of the month of a JD int p = (int)Fun.Floor(J + 0.5); int s1 = p + 68569; int n = (int)Fun.Floor(4 * s1 / 146097); int s2 = s1 - (int)Fun.Floor(((double)146097 * n + 3) / 4); int i = (int)Fun.Floor((double)4000 * (s2 + 1) / 1461001); int s3 = s2 - (int)Fun.Floor((double)1461 * i / 4) + 31; int q = (int)Fun.Floor((double)80 * s3 / 2447); int e = s3 - (int)Fun.Floor((double)2447 * q / 80); // int s4 = (int)System.Math.Floor((double)q / 11); // int m = q + 2 - 12 * s4; // int y = 100 * (n - 49) + i + s4; double d = e + J - p + 0.5; return(d); }
public static double Noise(double x, double y, double z) { int xc = (int)Fun.Floor(x) & 0xff, // Find unit cube that yc = (int)Fun.Floor(y) & 0xff, // contains point. zc = (int)Fun.Floor(z) & 0xff; x -= Fun.Floor(x); // Find relative x,y,z y -= Fun.Floor(y); // of point in cube. z -= Fun.Floor(z); double u = Fade(x), v = Fade(y), w = Fade(z); int a = p[xc] + yc, aa = p[a] + zc, ab = p[a + 1] + zc, // hash of cube b = p[xc + 1] + yc, ba = p[b] + zc, bb = p[b + 1] + zc; // corners return(Lerp(w, Lerp(v, Lerp(u, Grad(p[aa], x, y, z), Grad(p[ba], x - 1, y, z)), Lerp(u, Grad(p[ab], x, y - 1, z), Grad(p[bb], x - 1, y - 1, z))), Lerp(v, Lerp(u, Grad(p[aa + 1], x, y, z - 1), Grad(p[ba + 1], x - 1, y, z - 1)), Lerp(u, Grad(p[ab + 1], x, y - 1, z - 1), Grad(p[bb + 1], x - 1, y - 1, z - 1))))); }