public GCEquatorialCoords getTopocentricEquatorial(GCEarthData obs, double jdate) { double u, h, delta_alpha; double rho_sin, rho_cos; const double b_a = 0.99664719; GCEquatorialCoords tec = new GCEquatorialCoords(); double altitude = 0; // geocentric position of observer on the earth surface // 10.1 - 10.3 u = GCMath.arcTanDeg(b_a * b_a * GCMath.tanDeg(obs.latitudeDeg)); rho_sin = b_a * GCMath.sinDeg(u) + altitude / 6378140.0 * GCMath.sinDeg(obs.latitudeDeg); rho_cos = GCMath.cosDeg(u) + altitude / 6378140.0 * GCMath.cosDeg(obs.latitudeDeg); // equatorial horizontal paralax // 39.1 double parallax = GCMath.arcSinDeg(GCMath.sinDeg(8.794 / 3600) / (radius / GCMath.AU)); // geocentric hour angle of the body h = GCEarthData.SiderealTimeGreenwich(jdate) + obs.longitudeDeg - rightAscension; // 39.2 delta_alpha = GCMath.arcTanDeg( (-rho_cos * GCMath.sinDeg(parallax) * GCMath.sinDeg(h)) / (GCMath.cosDeg(this.declination) - rho_cos * GCMath.sinDeg(parallax) * GCMath.cosDeg(h))); tec.rightAscension = rightAscension + delta_alpha; tec.declination = declination + GCMath.arcTanDeg( ((GCMath.sinDeg(declination) - rho_sin * GCMath.sinDeg(parallax)) * GCMath.cosDeg(delta_alpha)) / (GCMath.cosDeg(declination) - rho_cos * GCMath.sinDeg(parallax) * GCMath.cosDeg(h))); return(tec); }
public static GCHorizontalCoords equatorialToHorizontalCoords(GCEquatorialCoords eqc, GCEarthData obs, double date) { double localHourAngle; GCHorizontalCoords hc; localHourAngle = GCMath.putIn360(GCEarthData.SiderealTimeGreenwich(date) - eqc.rightAscension + obs.longitudeDeg); hc.azimut = GCMath.rad2deg(Math.Atan2(GCMath.sinDeg(localHourAngle), GCMath.cosDeg(localHourAngle) * GCMath.sinDeg(obs.latitudeDeg) - GCMath.tanDeg(eqc.declination) * GCMath.cosDeg(obs.latitudeDeg))); hc.elevation = GCMath.rad2deg(Math.Asin(GCMath.sinDeg(obs.latitudeDeg) * GCMath.sinDeg(eqc.declination) + GCMath.cosDeg(obs.latitudeDeg) * GCMath.cosDeg(eqc.declination) * GCMath.cosDeg(localHourAngle))); return(hc); }