public static void ConvEquToHor(double fLatitude, double fHA, double fDecl, ref double fAlt, ref double fAzim) { double fSinAlt; double fCosAzim; fHA = Trig.DegToRad(fHA * 15); fDecl = Trig.DegToRad(fDecl); fLatitude = Trig.DegToRad(fLatitude); fSinAlt = (Math.Sin(fDecl) * Math.Sin(fLatitude)) + (Math.Cos(fDecl) * Math.Cos(fLatitude) * Math.Cos(fHA)); fAlt = Math.Asin(fSinAlt); fCosAzim = ((Math.Sin(fDecl) - (Math.Sin(fLatitude) * Math.Sin(fAlt))) / (Math.Cos(fLatitude) * Math.Cos(fAlt))); fAzim = Trig.RadToDeg(Math.Acos(fCosAzim)); if (Math.Sin(fHA) > 0) { fAzim = 360 - fAzim; } fAlt = Trig.RadToDeg(fAlt); }
public static void ConvHorToEqu(double fLatitude, double fAlt, double fAzim, ref double fHA, ref double fDecl) { double fSinDecl; double fCosH; fAlt = Trig.DegToRad(fAlt); fAzim = Trig.DegToRad(fAzim); fLatitude = Trig.DegToRad(fLatitude); fSinDecl = (Math.Sin(fAlt) * Math.Sin(fLatitude)) + (Math.Cos(fAlt) * Math.Cos(fLatitude) * Math.Cos(fAzim)); fDecl = Math.Asin(fSinDecl); fCosH = ((Math.Sin(fAlt) - (Math.Sin(fLatitude) * Math.Sin(fDecl))) / (Math.Cos(fLatitude) * Math.Cos(fDecl))); fHA = Trig.RadToDeg(Math.Acos(fCosH)); if (Math.Sin(fAzim) > 0) { fHA = 360 - fHA; } fDecl = Trig.RadToDeg(fDecl); fHA = fHA / 15.0; }