public static double LocalSiderealTime(Astrobodies bodies, GeographicCoords geographicCoords, double day) { double sunL = bodies.sun.orbitalElements.L; double gmst0 = StarMath.WrapDeg(sunL * StarMath.deg2hours + 12); double utcHour = (day % 1) * 24; // if (debug) Debug.Log($"Topocentric - day: {astrobodies.day.ToString("0.00")}\t utcHour: {utcHour.ToString("0.00")}"); double lonHr = geographicCoords.longitude * StarMath.deg2hours; return(gmst0 + utcHour + lonHr); //local siderial time }
public HorizontalCoords ToHorizontal(GeographicCoords geographicCoords, double localSiderealTime) { double ha = (localSiderealTime - rightAscention) * StarMath.hours2deg; double x_sid = StarMath.Cos_d(ha) * StarMath.Cos_d(declination); double y_sid = StarMath.Sin_d(ha) * StarMath.Cos_d(declination); double z_sid = StarMath.Sin_d(declination); double x_hor = x_sid * StarMath.Sin_d(geographicCoords.latitude) - z_sid * StarMath.Cos_d(geographicCoords.latitude); double y_hor = y_sid; double z_hor = x_sid * StarMath.Cos_d(geographicCoords.latitude) + z_sid * StarMath.Sin_d(geographicCoords.latitude); double az = StarMath.Atan2_d(y_hor, x_hor) + 180; double alt = StarMath.Atan2_d(z_hor, Math.Sqrt(x_hor * x_hor + y_hor * y_hor)); return(new HorizontalCoords(alt, az)); }