public double Delta(HourAngle hour) { double delta = hour.Value - (double)Value; return(Math.Abs(delta) <= 180.0 ? delta : (360.0 - Math.Abs(delta)) * (hour.Value > (double)Value ? -1.0 : 1.0)); }
public void Refresh(AscomTools tools, DateTime syncTime) { SyncTime = syncTime; LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime)); Equatorial = new EquatorialCoordinate(GetRA(ObservedAxes), GetDec(ObservedAxes)); UpdateAltAzimuth(tools, syncTime); }
public EquatorialCoordinate(HourAngle rightAscension, Angle declination) : this() // , Angle longitude, DateTime observedTime) { if (declination > 90.0 || declination < -90.0) { throw new ArgumentOutOfRangeException("Declination"); } _RA.Value = AstroConvert.RangeRA(rightAscension.Value); _Dec = declination.Value; }
public void MoveRADec(AxisPosition newAxisPosition, AscomTools tools, DateTime syncTime) { // double[] delta = ObservedAxes.GetDeltaTo(newAxisPosition); SyncTime = syncTime; LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime)); // Apply the axis rotation to the new position. ObservedAxes = newAxisPosition; Equatorial = new EquatorialCoordinate(GetRA(ObservedAxes), GetDec(ObservedAxes)); UpdateAltAzimuth(tools, syncTime); }
public MountCoordinate(EquatorialCoordinate equatorial, AxisPosition axisPosition, AscomTools tools, DateTime syncTime) { ObservedAxes = axisPosition; SyncTime = syncTime; LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime)); if (tools.Transform.SiteLatitude < 0.0) { Hemisphere = HemisphereOption.Southern; } Equatorial = equatorial; this.UpdateAltAzimuth(tools, syncTime); }
private double GetHourAngleFromAngle(Angle raAxisAngle) { double hours = HourAngle.DegreesToHours(AstroConvert.Range360Degrees(360.0 - raAxisAngle.Value)); if (Hemisphere == HemisphereOption.Northern) { return(AstroConvert.RangeRA(hours + 6.0)); } else { return(AstroConvert.RangeRA((24.0 - hours) + 6.0)); } }
public static double operator /(HourAngle hour1, HourAngle hour2) { HourAngle result = new HourAngle(0.0); result.Format = hour2.Format; if (hour2.Format == HourAngleFormat.DecimalHours) { result.Value = (double)(hour1.Value / hour2.Value); } else { result = FromSeconds(hour1.TotalSeconds / hour2.TotalSeconds); } return(result); }
public int CompareTo(object obj) { int result = 0; if (obj == null || !(obj is HourAngle)) { result = 1; } else { HourAngle that = (HourAngle)obj; result = Value.CompareTo(that.Value); } return(result); }
public static HourAngle operator /(HourAngle hour, double factor) { HourAngle result = new HourAngle(0.0); result.Format = hour.Format; if (hour.Format == HourAngleFormat.DecimalHours) { result.Value = hour.Value / factor; /* Use Value property to ensure DMS properties are also updated properly */ } else { double seconds = hour.TotalSeconds / factor; result = FromSeconds(seconds); } return(result); }
public static HourAngle operator -(HourAngle hour1, HourAngle hour2) { HourAngle result = new HourAngle(0.0); result.Format = hour1.Format; if (hour1.Format == HourAngleFormat.DecimalHours) { result.Value = hour1.Value - hour2.Value; /* Use Value property to ensure DMS properties are also updated properly */ } else { double seconds = hour1.TotalSeconds - hour2.TotalSeconds; result = FromSeconds(seconds); } return(result); }
private Angle GetAngleFromHourAngle(double hourAngle) { double ha = 0.0; double degrees; if (Hemisphere == HemisphereOption.Northern) { ha = AstroConvert.RangeRA(hourAngle - 6.0); // Renormalise from a perpendicular position degrees = HourAngle.HoursToDegrees(ha); } else { System.Diagnostics.Debug.Assert(false, "GetAngleFromHours not tested for Southern Hemisphere"); ha = AstroConvert.RangeRA((24 - hourAngle) - 6.0); // Renormalise from a perpendicular position degrees = HourAngle.HoursToDegrees(ha); } return(AstroConvert.Range360Degrees(360.0 - degrees)); }
public HourAngle(double hour, bool radians = false) { if (radians) { _Value = (double)HourAngle.RadiansToHours(hour); } else { _Value = hour; } _Format = HourAngleFormat.DecimalHours; _HasBeenSet = true; /* All members must be set before calling out of the constructor so set dummy values * so compiler is happy. */ _Hours = 0; _Minutes = 0; _Seconds = 0.0; SetHmsFromHours(hour); }
public EquatorialCoordinate() // , double longitude, DateTime observedTime) { _RA = new HourAngle(0.0); _Dec = new Angle(0.0); }
/// <summary> /// Converts the hour to the range 180.0 to -180.0 hours /// </summary> public void NormalizeTo180() { _Value = HourAngle.NormalizeTo180(Value); SetHmsFromHours(_Value); }
public void Normalize() { _Value = HourAngle.Normalize(Value); _Hours = (int)HourAngle.Normalize((double)Hours); }