static public RaDec AltAz2RaDec(AltAz altAzm, LatLon location, DateTime time, double elevation) { var utils = new ASCOM.Astrometry.AstroUtils.AstroUtils(); var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year); MJDdate += time.TimeOfDay.TotalDays; var tfm = new ASCOM.Astrometry.Transform.Transform(); tfm.JulianDateTT = MJDdate; tfm.SiteElevation = elevation * 1000; tfm.SiteLatitude = location.Lat; tfm.SiteLongitude = location.Lon; tfm.SiteTemperature = 0; tfm.SetAzimuthElevation(altAzm.Az, altAzm.Alt); tfm.Refresh(); var res = new RaDec(tfm.RAJ2000, tfm.DecJ2000); return(res); }
static public AltAz RaDec2AltAz(RaDec coord, LatLon location, DateTime time, double elevation) { var utils = new ASCOM.Astrometry.AstroUtils.AstroUtils(); var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year); MJDdate += time.TimeOfDay.TotalDays; var tfm = new ASCOM.Astrometry.Transform.Transform(); tfm.JulianDateTT = MJDdate; tfm.SiteElevation = elevation * 1000; tfm.SiteLatitude = location.Lat; tfm.SiteLongitude = location.Lon; tfm.SiteTemperature = 0; tfm.SetJ2000(coord.Ra, coord.Dec); tfm.Refresh(); var res = new AltAz(tfm.ElevationTopocentric, tfm.AzimuthTopocentric); return(res); }