Example #1
0
        public HourAngle GetRA(AxisPosition axes)
        {
            double tempRA_hours = GetHourAngleFromAngle(axes.RAAxis.Value);
            double tRa          = LocalApparentSiderialTime + tempRA_hours;
            double tHa          = AstroConvert.RangeHA(tRa);
            double dec          = GetDec(axes);

            // System.Diagnostics.Debug.Write($"{axes.RAAxis.Value}/{axes.DecAxis.Value}\t{dec}\t{tHa}\t{tRa}");
            if (Hemisphere == HemisphereOption.Northern)
            {
                if (axes.DecFlipped)
                {
                    tRa = tRa - 12.0;
                    // System.Diagnostics.Debug.Write("\t tRa - tRa - 12");
                }
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "GetRA is not tested for Southern Hemisphere");
                if (axes.DecAxis.Value > 180)
                {
                    tRa = tRa + 12.0;
                }
            }
            return(new HourAngle(AstroConvert.RangeRA(tRa)));
        }
Example #2
0
        private Vector GetHVC(AxisPosition axes)
        {
            Vector hvc = new Vector(0.0, 0.0, 0.0);

            hvc[0] = Math.Cos(axes.DecAxis.Radians) * Math.Cos(axes.RAAxis.Radians);
            hvc[1] = Math.Cos(axes.DecAxis.Radians) * Math.Sin(axes.RAAxis.Radians);
            hvc[2] = Math.Sin(axes.DecAxis.Radians);
            return(hvc);
        }
Example #3
0
 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);
 }
Example #4
0
        public bool Equals(AxisPosition obj, double toleranceDegrees)
        {
            double deltaRA = Math.Abs(obj.RAAxis.Value - this.RAAxis.Value);

            deltaRA = (deltaRA + 180) % 360 - 180;
            double deltaDec = Math.Abs(obj.DecAxis.Value - this.DecAxis.Value);

            deltaDec = (deltaDec + 180) % 360 - 180;
            System.Diagnostics.Debug.WriteLine($"Delta RA/Dec = {deltaRA:##0.000000000}/{deltaDec:#0.000000000}, Tol: {toleranceDegrees:#0.000000000}");
            return(deltaRA <= toleranceDegrees &&
                   deltaDec <= toleranceDegrees);
        }
Example #5
0
 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);
 }
Example #6
0
        public EquatorialCoordinate GetEquatorialCoords(AxisPosition axes, DateTime localTime)
        {
            Vector EVC       = new Vector(0.0, 0.0, 0.0);
            Vector HVC       = GetHVC(axes);
            double deltaTime = AstroConvert.HrsToRad(localTime - _timeZero);

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    EVC[i] += _iT[i, j] * HVC[j];
                }
            }
            return(new EquatorialCoordinate(Math.Atan2(EVC[1], EVC[0]) + (_k * deltaTime), Math.Asin(EVC[2])));
        }
Example #7
0
 public Angle[] GetSlewAnglesTo(AxisPosition targetPosition)
 {
     double[] slewAngle = new double[2];
     for (int i = 0; i < 2; i++)
     {
         if (this[i] >= 0.0 && this[i] <= 180.0 && targetPosition[i] > 180.0 && targetPosition[i] <= 360.0)
         {
             slewAngle[i] = -1 * (this[i] + 360.0 - targetPosition[i]);
         }
         else if (this[i] > 180.0 && this[i] <= 360.0 && targetPosition[i] >= 0.0 && targetPosition[i] <= 180.0)
         {
             slewAngle[i] = 360.0 - this[i] + targetPosition[i];
         }
         else
         {
             slewAngle[i] = targetPosition[i] - this[i];
         }
     }
     return(new Angle[] { new Angle(slewAngle[0]), new Angle(slewAngle[1]) });
 }
Example #8
0
        public Angle GetDec(AxisPosition axes)
        {
            double dec = GetDecDegreesFromAngle(axes.DecAxis.Value);

            return(new Angle(AstroConvert.RangeDec(dec)));
        }