コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((RightAscension.GetHashCode() * 397) ^ Declination.GetHashCode());
     }
 }
コード例 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = RightAscension.GetHashCode();
         hashCode = (hashCode * 397) ^ Declination.GetHashCode();
         return((hashCode * 397) ^ Distance.GetHashCode());
     }
 }
コード例 #3
0
        public async Task PointSkyObject(StellarObjectDesignation stellarObjectDesignation)
        {
            var observer = new Observer
            {
                Latitude  = 45.42546991419586,
                Longitude = 23.9497447013855,
                Altitude  = 595
            };

            double            epoch             = GetJulianDate(DateTime.Now);
            PlanetCoordinates planetCoordinates = await GetPlanetCoordinates(stellarObjectDesignation, epoch, observer);

            var rightAscension = new RightAscension();

            rightAscension.ConvertFromArcSec(planetCoordinates.RightAscensionInArcSec);

            var declination = new Declination();

            declination.ConvertFromArcSec(planetCoordinates.DeclinationInArcSec);

            CelestialCoordinates celestialCoordinates = EquatorialCoordinatesConverter.ToCelestialCoordinates(
                rightAscension.Longitude,
                declination.Latitude,
                observer.Latitude,
                observer.Longitude);

            double roundedAltitude = Math.Round(celestialCoordinates.Altitude);
            double roundedAzimuth  = Math.Round(celestialCoordinates.Azimuth);

            double servoMotorValue = roundedAltitude;

            if (servoMotorValue > 0)
            {
                servoMotorValue += 90;
            }
            else
            {
                servoMotorValue = 90 - Math.Abs(servoMotorValue);
            }

            using var serialPort = new SerialPort
                  {
                      PortName  = SerialPort.GetPortNames().First(),
                      BaudRate  = 9600,
                      Parity    = Parity.None,
                      StopBits  = StopBits.One,
                      DataBits  = 8,
                      Handshake = Handshake.None,
                      RtsEnable = true
                  };

            serialPort.Open();

            var command = $"<S{roundedAzimuth};A{servoMotorValue};B{servoMotorValue};C{servoMotorValue}>";

            serialPort.WriteLine(command);
        }
コード例 #4
0
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hash = 17;
         // Suitable nullity checks etc, of course :)
         hash = hash * 23 + RightAscension.GetHashCode();
         hash = hash * 23 + Declination.GetHashCode();
         return(hash);
     }
 }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
 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));
 }
コード例 #7
0
 public Coordinates(RightAscension a, Angle d)
 {
     RightAscension = a;
     Declination    = d;
 }