private double[] getSun() {
        // SUN PARAMETERS (Formulae from "Calendrical Calculations")
        double lon  = (280.46645 + 36000.76983 * t + .0003032 * t * t);
        double anom = (357.5291 + 35999.0503 * t - .0001559 * t * t - 4.8E-07 * t * t * t);
        sanomaly = anom * DEG_TO_RAD;
        double c = (1.9146 - .004817 * t - .000014 * t * t) * Math.sin(sanomaly);
        c = c + (.019993 - .000101 * t) * Math.sin(2 * sanomaly);
        c = c + .00029 * Math.sin(3.0 * sanomaly); // Correction to the mean ecliptic longitude

        // Now, let calculate nutation and aberration
        double M1 = (124.90 - 1934.134 * t + 0.002063 * t * t) * DEG_TO_RAD;
        double M2 = (201.11 + 72001.5377 * t + 0.00057 * t * t) * DEG_TO_RAD;
        double d  = -.00569 - .0047785 * Math.sin(M1) - .0003667 * Math.sin(M2);

        slongitude = lon + c + d; // apparent longitude (error<0.003 deg)
        double slatitude = 0; // Sun's ecliptic latitude is always negligible
        double ecc       = .016708617 - 4.2037E-05 * t - 1.236E-07 * t * t; // Eccentricity
        double v         = sanomaly + c * DEG_TO_RAD; // True anomaly
        double sdistance = 1.000001018 * (1.0 - ecc * ecc) / (1.0 + ecc * Math.cos(v)); // In UA

        return new double[]{slongitude, slatitude, sdistance, Math.atan(696000 / (AU * sdistance))};
    }
Calculates everything for the Sun and the Moon.
src/main/java/eu/hansolo/tilesfx/tools/SunMoonCalculator.java