public Group(Equator <X> Equator, Combiner <X> Combiner, X Zero, Inverter <X> Inverter) { this.Equator = Equator; this.Combiner = Combiner; this.zero = Zero; this.Inverter = Inverter; }
///SETZOD Sets zodiac sign, SETDATA sets ecliptic coordinates! public void SetData() { Equator equator = Sun.EquatorialCoordinate(BirthDate); Ecliptic ecliptic = CoordinateSystem.Equatorial2Ecliptic(equator); UserSun = ecliptic.Longitude; }
/// <summary> /// Convert equator to ecliptic(J2000.0). /// </summary> /// <param name="e">Equator coordinates.</param> /// <param name="time">Local time(It is used to calculate the ecliptic obliquity).</param> /// <param name="isApparent">Is it the apparent equator coordinates.</param> /// <returns>Ecliptic coordinates.</returns> public static Ecliptic Equator2Ecliptic(Equator e, DateTime time, bool isApparent) { double alpha = e.RA; double delta = e.Dec; double epsilon; if (isApparent) { epsilon = GetEclipticObliquity(time); } else { epsilon = GetEclipticObliquity(time, false); } double tanD = Math.Sin(alpha * (Math.PI / 180.0)) * Math.Cos(epsilon * (Math.PI / 180.0)) + Math.Tan(delta * (Math.PI / 180.0)) * Math.Sin(epsilon * (Math.PI / 180.0)); double tanL2 = Math.Cos(alpha * (Math.PI / 180.0)); double sinB = Math.Sin(delta * (Math.PI / 180.0)) * Math.Cos(epsilon * (Math.PI / 180.0)) - Math.Cos(delta * (Math.PI / 180.0)) * Math.Sin(epsilon * (Math.PI / 180.0)) * Math.Sin(alpha * (Math.PI / 180.0)); double longitude = Math.Atan2(tanD, tanL2) * (180.0 / Math.PI); double latitude = Math.Asin(sinB) * (180.0 / Math.PI); if (longitude < 0) { longitude = 360 + longitude; } return(new Ecliptic() { Longitude = longitude, Latitude = latitude }); }
/// <summary> /// Convert elevation angle to zone time. /// </summary> /// <param name="e">Equator coordinates.</param> /// <param name="angle">Elevation angle.</param> /// <param name="latitude">Local latitude.</param> /// <param name="longitude">Local longitude.</param> /// <param name="date">Date.</param> /// <param name="localTimeZone">Local time zone.</param> /// <returns>Zone time in degree.</returns> public static double[] ElevationAngle2Time(Equator e, double angle, double latitude, double longitude, DateTime date, TimeZoneInfo localTimeZone) { double ra = e.RA; double dec = e.Dec; double sinH = Math.Sin(angle * (Math.PI / 180.0)); double cosT = (sinH - Math.Sin(latitude * Math.PI / 180.0) * Math.Sin(dec * Math.PI / 180.0)) / (Math.Cos(latitude * Math.PI / 180.0) * Math.Cos(dec * Math.PI / 180.0)); if (Math.Abs(cosT) > 1) { return(new double[] { 0, 0 }); } double T = Math.Acos(cosT) * 180.0 / Math.PI; double t1 = 360 - T; double t2 = T; double localSiderealTime1 = t1 + ra; double zoneTime1 = SiderealTime.SiderealTime2ZoneTime(localSiderealTime1, date, localTimeZone, longitude); double localSiderealTime2 = t2 + ra; double zoneTime2 = SiderealTime.SiderealTime2ZoneTime(localSiderealTime2, date, localTimeZone, longitude); return(new double[] { zoneTime1, zoneTime2 }); }
public IActionResult Index() { DateTime birthday = new DateTime(1991, 6, 5, 8, 26, 00); Equator equator = Sun.EquatorialCoordinate(birthday); Ecliptic mooquator = Moon.EclipticalCoordinate(birthday); Ecliptic merquator = Mercury.EclipticalCoordinate(birthday); Ecliptic vequator = Venus.EclipticalCoordinate(birthday); Ecliptic mequator = Mars.EclipticalCoordinate(birthday); Ecliptic jequator = Jupiter.EclipticalCoordinate(birthday); Ecliptic sequator = Saturn.EclipticalCoordinate(birthday); Ecliptic urquator = Uranus.EclipticalCoordinate(birthday); Ecliptic nequator = Neptune.EclipticalCoordinate(DateTime.Now); Ecliptic ecliptic = CoordinateSystem.Equatorial2Ecliptic(equator); Debug.WriteLine(DateTime.Now); Debug.WriteLine("SUN" + ecliptic.Longitude); Debug.WriteLine("Moon" + mooquator.Longitude); Debug.WriteLine("MERC: " + merquator.Longitude); Debug.WriteLine("VENUS" + vequator.Longitude); Debug.WriteLine("Mars" + mequator.Longitude); Debug.WriteLine("Jup: " + jequator.Longitude); Debug.WriteLine("Saturn: " + sequator.Longitude); Debug.WriteLine("Urnuas: " + urquator.Longitude); Debug.WriteLine("Neptune: " + nequator.Longitude); return(View()); }
/// <inheritdoc/> public override Equator GetEquatorCoordinate(DateTime time, bool isApparent = false) { double T = (Julian.ToJulianDay(time) - 2451545.0) / 36525.0; double L0 = 280.46645 + 36000.76983 * T + 0.0003030 * T * T; double M = 357.52910 + 35999.05030 * T - 0.0001559 * T * T - 0.00000048 * T * T * T; double e = 0.016708617 - 0.000042037 * T - 0.0000001236 * T * T; L0 = BasicTools.SimplifyAngle(L0); M = BasicTools.SimplifyAngle(M); e = BasicTools.SimplifyAngle(e); double C = Math.Abs((1.914600 - 0.004817 * T - 0.000014 * T * T)) * Math.Sin(M * (Math.PI / 180.0)) + (0.019993 - 0.000101 * T) * Math.Sin(2 * M * (Math.PI / 180.0)) + 0.000290 * Math.Sin(3 * M * (Math.PI / 180.0)); C = BasicTools.SimplifyAngle(C); double theta = L0 + C; double theta2000 = theta - 0.01397 * (time.Year - 2000); double omega = 125.04 - 1934.136 * T; omega = BasicTools.SimplifyAngle(omega); double lambda = theta - 0.00569 - 0.00478 * Math.Sin(omega * (Math.PI / 180.0)); double sinDelta, delta, alpha; if (isApparent) { sinDelta = Math.Sin((CoordinateSystem.GetEclipticObliquity(time, false) + 0.00256 * Math.Cos(omega) * (Math.PI / 180.0)) * (Math.PI / 180.0)) * Math.Sin(lambda * (Math.PI / 180.0)); delta = Math.Asin(sinDelta) * (180.0 / Math.PI); alpha = Math.Atan2(Math.Cos((CoordinateSystem.GetEclipticObliquity(time, false) + 0.00256 * Math.Cos(omega) * (Math.PI / 180.0)) * (Math.PI / 180.0)) * Math.Sin(lambda * (Math.PI / 180.0)), Math.Cos(lambda * (Math.PI / 180.0))) * (180.0 / Math.PI); } else { sinDelta = Math.Sin(CoordinateSystem.GetEclipticObliquity(time, false) * (Math.PI / 180.0)) * Math.Sin(theta2000 * (Math.PI / 180.0)); delta = Math.Asin(sinDelta) * (180.0 / Math.PI); alpha = Math.Atan2(Math.Cos(CoordinateSystem.GetEclipticObliquity(time, false) * (Math.PI / 180.0)) * Math.Sin(theta2000 * (Math.PI / 180.0)), Math.Cos(theta2000 * (Math.PI / 180.0))) * (180.0 / Math.PI); } if (alpha <= 0) { while (!(alpha >= 0 && alpha <= 360)) { alpha += 360; } } Equator c = new Equator { RA = alpha, Dec = delta }; return(c); }
/// <summary> /// Calculate culmination angle. /// </summary> /// <param name="e">Equator coordinates.</param> /// <param name="latitude">Local latitude.</param> /// <returns>The culmination angle.</returns> public static double GetCulminationAngle(Equator e, double latitude) { double dec = e.Dec; double sinH = Math.Sin(latitude * Math.PI / 180.0) * Math.Sin(dec * Math.PI / 180.0) + Math.Cos(latitude * Math.PI / 180.0) * Math.Cos(dec * Math.PI / 180.0); double H = Math.Asin(sinH) * 180.0 / Math.PI; return(H); }
/// <summary> /// Calculate local parallactic angle. /// </summary> /// <param name="time">Local time.</param> /// <param name="e">Equator coordinates.</param> /// <param name="latitude">Local latitude.</param> /// <param name="longitude">Local longitude.</param> /// <returns>The parallactic angle.</returns> public static double GetParallacticAngle(DateTime time, Equator e, double latitude, double longitude) { double H = GetHourAngle(time, e.RA, longitude); double tanP1 = Math.Sin(H * (Math.PI / 180.0)); double tanP2 = Math.Tan(latitude * (Math.PI / 180.0)) * Math.Cos(e.Dec * (Math.PI / 180.0)) - Math.Sin(e.Dec * (Math.PI / 180.0)) * Math.Cos(H * (Math.PI / 180.0)); return(Math.Atan2(tanP1, tanP2)); }
public HashedSet(IEnumerable <T> items, int capacity, Equator <T> equator) : this(capacity, equator) { if (items != null) { foreach (var item in items) { Add(item); } } }
/// <summary> /// Calculate the elevation angle at the specified time. /// </summary> /// <param name="time">Local time.</param> /// <param name="e">Equator coordinates.</param> /// <param name="latitude">Local latitude.</param> /// <param name="longitude">Local longitude.</param> /// <returns>The elevation angle.</returns> public static double GetElevationAngle(DateTime time, Equator e, double latitude, double longitude) { double ra = e.RA; double dec = e.Dec; double hourAngle = GetHourAngle(time, ra, longitude); double sinH = Math.Sin(latitude * Math.PI / 180.0) * Math.Sin(dec * Math.PI / 180.0) + Math.Cos(latitude * Math.PI / 180.0) * Math.Cos(dec * Math.PI / 180.0) * Math.Cos(hourAngle * Math.PI / 180.0); double H = Math.Asin(sinH) * 180.0 / Math.PI; return(H); }
/// <summary> /// Calculate the angular separation. /// </summary> /// <param name="e1">Equator coordinates of celestial body 1.</param> /// <param name="e2">Equator coordinates of celestial body 2.</param> /// <returns>The angular separation in degree</returns> public static double GetAngularSeparation(Equator e1, Equator e2) { double sin2 = Math.Sin(Math.Abs(e1.Dec - e2.Dec) / 2 * (Math.PI / 180.0)) * Math.Sin(Math.Abs(e1.Dec - e2.Dec) / 2 * (Math.PI / 180.0)) + Math.Cos(e1.Dec * (Math.PI / 180.0)) * Math.Cos(e2.Dec * (Math.PI / 180.0)) * Math.Sin(Math.Abs(e1.RA - e2.RA) / 2 * (Math.PI / 180.0)) * Math.Sin(Math.Abs(e1.RA - e2.RA) / 2 * (Math.PI / 180.0)); double sin = Math.Pow(sin2, 0.5); double theta = Math.Asin(sin) * 180.0 / Math.PI; return(theta * 2); }
private LinkedHashedMap(IDictionary <K, V> items, Equator <K> equator) : this(items == null ? DefaultCapacity : items.Count, equator) { if (null != items) { foreach (var item in items) { Add(item.Key, item.Value); } } }
public ChainHashedMap(IDictionary <K, V> items, Equator <K> equator) : base(items == null ? DefaultCapacity : items.Count, new EquatorComparer <K>(equator)) { if (null != items) { foreach (var item in items) { Add(item.Key, item.Value); } } }
public HashedBimap(IBimap <K, V> bimap, Equator <K> keyEquator, Equator <V> valueEquator) : this(bimap == null ? DefaultCapacity : bimap.Count, new EquatorComparer <K>(keyEquator), new EquatorComparer <V>(valueEquator)) { if (bimap != null) { foreach (var item in bimap) { Add(item.Key, item.Value); } } }
public KeyValuePair <K, V> Before(K key) { Guarder.CheckNull(key); CheckEmpty("get Before item"); var entry = GetEntry(key) as LinkedHashEntry; if (entry == null) { throw new ArgumentException("The key does not exist."); } if (Equator.Equals(entry.Key, Header.Key)) { throw new ArgumentException("There is no item before the searched key."); } return(new KeyValuePair <K, V>(entry.Before.Key, entry.Before.Value)); }
/// <summary> /// Calculate the azimuth. /// </summary> /// <param name="time">Local time.</param> /// <param name="e">Equator coordinates.</param> /// <param name="latitude">Local latitude.</param> /// <param name="longitude">Local longitude.</param> /// <returns>The azimuth.</returns> public static double GetAzimuth(DateTime time, Equator e, double latitude, double longitude) { double elevationAngle = GetElevationAngle(time, e, latitude, longitude); double ra = e.RA; double dec = e.Dec; double omega = GetHourAngle(time, ra, longitude); double cosA = (Math.Sin(dec * (Math.PI / 180.0)) - Math.Sin(elevationAngle * (Math.PI / 180.0)) * Math.Sin(latitude * (Math.PI / 180.0))) / (Math.Cos(elevationAngle * (Math.PI / 180.0)) * Math.Cos(latitude * (Math.PI / 180.0))); double A; if (omega < 0) { A = Math.Acos(cosA) * 180.0 / Math.PI; } else { A = 360 - (Math.Acos(cosA) * 180.0 / Math.PI); } return(A); }
/// <summary> /// Convert equator to ecliptic(J2000.0). /// </summary> /// <param name="e">Equator coordinates.</param> /// <returns>Ecliptic coordinates.</returns> public static Ecliptic Equator2Ecliptic(Equator e) { double alpha = e.RA; double delta = e.Dec; double epsilon = 23.439291; double tanD = Math.Sin(alpha * (Math.PI / 180.0)) * Math.Cos(epsilon * (Math.PI / 180.0)) + Math.Tan(delta * (Math.PI / 180.0)) * Math.Sin(epsilon * (Math.PI / 180.0)); double tanL2 = Math.Cos(alpha * (Math.PI / 180.0)); double sinB = Math.Sin(delta * (Math.PI / 180.0)) * Math.Cos(epsilon * (Math.PI / 180.0)) - Math.Cos(delta * (Math.PI / 180.0)) * Math.Sin(epsilon * (Math.PI / 180.0)) * Math.Sin(alpha * (Math.PI / 180.0)); double longitude = Math.Atan2(tanD, tanL2) * (180.0 / Math.PI); double latitude = Math.Asin(sinB) * (180.0 / Math.PI); if (longitude < 0) { longitude = 360 + longitude; } return(new Ecliptic() { Longitude = longitude, Latitude = latitude }); }
/// <summary> /// /// </summary> /// <param name="keyEquator"></param> /// <remarks>If the <typeparamref name="K"/> is the same with <typeparamref name="V"/>, need to use named /// arguments to specify it's a <paramref name="keyEquator"/></remarks> public HashedBimap(Equator <K> keyEquator) : this(new EquatorComparer <K>(keyEquator), EqualityComparer <V> .Default) { }
public HashedBimap(int capacity, Equator <K> keyEquator, Equator <V> valueEquator) : this(capacity, new EquatorComparer <K>(keyEquator), new EquatorComparer <V>(valueEquator)) { }
public HashedMap(IDictionary <K, V> items, Equator <K> equator) : this(items, new EquatorComparer <K>(equator)) { }
public HashedMap(int capacity, Equator <K> equator) : this(capacity, new EquatorComparer <K>(equator)) { }
public HashedMap(Equator <K> equator) : this(DefaultCapacity, new EquatorComparer <K>(equator)) { }
public Eq(Equator <X> Equator) => this.Equator = Equator;
/// <summary> /// Constructs a <see cref="IGroup"/> over <typeparamref name="X"/> using provided aspects /// </summary> /// <typeparam name="X">The group element type</typeparam> /// <param name="Equator">The equality adjudicator</param> /// <param name="Combiner">The group operation</param> /// <param name="Zero">The group identity</param> /// <param name="Inverter">The element inverter</param> /// <returns></returns> public static IGroup <X> make <X>(Equator <X> Equator, Combiner <X> Combiner, X Zero, Inverter <X> Inverter) => new Group <X>(Equator, Combiner, Zero, Inverter);
public HashedSet(int capacity, Equator <T> equator) { map = new HashedMap <T, object>(capacity, equator); }
public HashedSet(Equator <T> equator) { map = new HashedMap <T, object>(equator); }
public LruMap(int fullSize, Equator <K> equator) : this(fullSize, new EquatorComparer <K>(equator)) { }
/// <summary> /// /// </summary> /// <param name="valueEquator"></param> /// <remarks>If the <typeparamref name="V"/> is the same with <typeparamref name="K"/>, need to use named /// arguments to specify it's a <paramref name="valueEquator"/></remarks> public HashedBimap(Equator <V> valueEquator) : this(EqualityComparer <K> .Default, new EquatorComparer <V>(valueEquator)) { }
public HashedBimap(Equator <K> keyEquator, Equator <V> valueEquator) : this(new EquatorComparer <K>(keyEquator), new EquatorComparer <V>(valueEquator)) { }
public Monoid(Equator <X> Equator, Combiner <X> Combiner, X Zero) { this.Equator = Equator; this.Combiner = Combiner; this.zero = Zero; }