/// <summary> /// Converts a string representation of a coordinate double. /// </summary> /// <param name="value">The string value to convert. </param> /// <param name="targetType">This parameter is not used.</param> /// <param name="parameter">This parameter is not used.</param> /// <param name="culture">This parameter is not used.</param> /// <returns> The coordinate angle as a double</returns> public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { string incomingValue = (string)value; HourAngle ha = new HourAngle(incomingValue); return(ha.Value); }
public void HourAngleInMorningIsNegative() { var resultRadians = HourAngle.GetHourAngle(new DateTime(2020, 1, 1, 6, 0, 0)); var resultDegrees = resultRadians.FromRadiansToDegree(); Assert.AreEqual(-90.0, resultDegrees); }
public void HourAngleInAfternoonIsPositive() { var resultRadians = HourAngle.GetHourAngle(new DateTime(2020, 1, 1, 18, 0, 0)); var resultDegrees = resultRadians.FromRadiansToDegree(); Assert.AreEqual(90.0, resultDegrees); }
void Log() { Debug.Log("------- SUN ------- "); Debug.Log(string.Format("JD: {0}", dt.JulianDay())); Debug.Log(string.Format("Time: {0}:{1}:{2}", dt.Hour(), dt.Minute(), dt.Second())); skyModel.GetSun().Log(); HourAngle H = new HourAngle(skyModel.GetSun().localHourAngle); Debug.Log(string.Format("H {0}", H.ToString())); AAS2DCoordinate local = AASCoordinateTransformation.Equatorial2Horizontal(skyModel.GetSun().localHourAngle, skyModel.GetSun().EquatorialCoords.Declination.Get(), location.Latitude); Debug.Log(string.Format("local X {0}", local.X)); Debug.Log(string.Format("local Y {0}", local.Y)); Debug.Log("------- VENUS ------- "); VenusModel venus = skyModel.GetPlanets() ["Venus"] as VenusModel; venus.Log(); Debug.Log("------- MOON ------- "); MoonModel moon = skyModel.GetMoon(); moon.Log(); Debug.Log("------- JUPITER ------- "); JupiterModel jup = skyModel.GetPlanets()["Jupiter"] as JupiterModel; Debug.Log("p " + jup.GetParallacticAngle()); }
/// <summary> /// Converts a double value to a string value. /// </summary> /// <param name="value">A System.Windows.Visibility enumeration value.</param> /// <param name="targetType">This parameter is not used.</param> /// <param name="parameter">This parameter is not used.</param> /// <param name="culture">true if value is System.Windows.Visibility.Collapsed or Hidden; otherwise, false.</param> /// <returns></returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { double incoming = (double)value; HourAngle ha = new HourAngle(incoming); return(ha.ToString(HourAngleFormat.HoursMinutesSeconds)); }
public void HourAngleMinusHourAngle(double v1, double v2, double expected) { HourAngle ang1 = new HourAngle(v1); HourAngle ang2 = new HourAngle(v2); HourAngle result = ang1 - ang2; Assert.AreEqual(expected, result.Value); }
public void PopulateStarPositionsDictionary(){ foreach (StarModel star in stars) { DegreesAngle dec = new DegreesAngle (star.dec); HourAngle ra = new HourAngle (star.ra); EquatorialCoords eq = new EquatorialCoords (ra, dec); starPositionsDictionary [eq] = star.starID - 1; } }
private void CalculateEquatorialPosition() { double epsilon0 = GetDeltaEpsilon(); double theta = GetGeometricMeanLongitude(); double ar = Math.Atan2(Math.Cos(epsilon0 * M.DEG2RAD) * Math.Sin(theta * M.DEG2RAD), Math.Cos(theta * M.DEG2RAD)) * M.RAD2DEG; double dec = Math.Asin(Math.Sin(epsilon0 * M.DEG2RAD) * Math.Sin(theta * M.DEG2RAD)) * M.RAD2DEG; equatorialCoords.RA = HourAngle.FromDecimalDegrees(ar); equatorialCoords.Declination = new DegreesAngle(dec); }
public override int GetHashCode() { unchecked { var hashCode = RightAscension.GetHashCode(); hashCode = (hashCode * 397) ^ Declination.GetHashCode(); hashCode = (hashCode * 397) ^ HourAngle.GetHashCode(); hashCode = (hashCode * 397) ^ (RaArgs != null ? RaArgs.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DecArgs != null ? DecArgs.GetHashCode() : 0); return(hashCode); } }
public void Log() { HourAngle ra = equatorialCoords.RA; DegreesAngle dec = equatorialCoords.Declination; DegreesAngle az = localCoords.Azimuth; DegreesAngle alt = localCoords.Altitude; Debug.Log(string.Format("AR: {0}", ra.ToString())); Debug.Log(string.Format("Dec: {0}", dec.ToString())); Debug.Log(string.Format("Azimuth: {0}", az.ToString())); Debug.Log(string.Format("Alt: {0}", alt.ToString())); }
public void TestingHA() { double ra = 0.0; double ha = 0.0; HourAngle lst = new HourAngle(AstroConvert.LocalApparentSiderealTime(_Tools.Transform.SiteLongitude, _Now)); System.Diagnostics.Debug.WriteLine($"LST = {lst.Value}"); System.Diagnostics.Debug.WriteLine("\tRA\t\t\tHA"); System.Diagnostics.Debug.WriteLine("\t==\t\t\t=="); for (int i = 0; i < 24; i++) { ra = i * 1.0; ha = AstroConvert.RangeHA(ra - lst); System.Diagnostics.Debug.WriteLine($"\t{ra}\t\t{ha}"); } Assert.IsTrue(true); }
public void TestGetRA(double expectedRa, double expectedDec, double RAAxis, double DecAxis, bool flippedDec) { EquatorialCoordinate target = _Tools.GetEquatorial(0.0, 0.0, _Now); MountCoordinate mount = new MountCoordinate( new AltAzCoordinate(_Tools.Transform.SiteLatitude, 0.0), new AxisPosition(0.0, 0.0), _Tools, _Now); AxisPosition axisPosition = new AxisPosition(RAAxis, DecAxis, flippedDec); System.Diagnostics.Debug.Write($"\nFlipped:{(flippedDec ? "Y" : "N")} Expecting: {expectedRa} ->"); HourAngle testRa = mount.GetRA(axisPosition); //if (Math.Abs(expectedRa-testRa)> 0.000001) //{ // System.Diagnostics.Debug.Write(" - FAIL"); //} Assert.AreEqual(expectedRa, testRa, 0.000001, "RA Value"); }
public void HourAngleAtSolarNoonIsZero() { var result = HourAngle.GetHourAngle(new DateTime(2020, 1, 1, 12, 0, 0)); Assert.AreEqual(0.0, result); }
public void TestHourAngle() { double TrueSolarTime = 722.0427834; Assert.AreEqual("0.510695849999991", HourAngle.CalcHourAngle(TrueSolarTime).ToString()); }
public static SqlHourAngle Parse(SqlString s) { return(s.IsNull ? Null : new SqlHourAngle(HourAngle.Parse(s.Value, CultureInfo.InvariantCulture))); }
public SqlHourAngle(HourAngle angle) { _value = angle; }
protected bool Equals(EquatorialCs other) { return(RightAscension.Equals(other.RightAscension) && Declination.Equals(other.Declination) && HourAngle.Equals(other.HourAngle) && Equals(RaArgs, other.RaArgs) && Equals(DecArgs, other.DecArgs)); }