예제 #1
0
        public void SkyPosition_ParameterlessConstructor_InitializeCoordinatesToZero()
        {
            var skyPosition = new SkyPosition();

            Assert.Equal(0, skyPosition.Dec);
            Assert.Equal(0, skyPosition.Ra);
        }
예제 #2
0
        public ConstellationLine(double rectascence1, double declination1, double rectascence2, double declination2)
        {
            this.SkyPosition1 = new SkyPosition();
            this.SkyPosition2 = new SkyPosition();

            this.SkyPosition1.Rectascence = rectascence1;
            this.SkyPosition1.Declination = declination1;

            this.SkyPosition2.Rectascence = rectascence2;
            this.SkyPosition2.Declination = declination2;
        }
예제 #3
0
        public void DistanceInDegrees_InsertSkyPosition_ReturnsDistanceInDegrees()
        {
            var skyPosition1 = new SkyPosition();
            var skyPosition2 = new SkyPosition();

            skyPosition2.Ra  = 12;
            skyPosition2.Dec = 90;

            var result = skyPosition1.DistanceInDegrees(skyPosition2);

            Assert.Equal(112, result, 0);
        }
예제 #4
0
        public void SkyPosition_ConstructorTakingSkyPositionParameter_InitializeCoordinatesAccordingly()
        {
            var otherSkyPosition = new SkyPosition();

            otherSkyPosition.Ra  = 37;
            otherSkyPosition.Dec = 55;

            var skyPosition = new SkyPosition(otherSkyPosition);

            Assert.Equal(55, skyPosition.Dec);
            Assert.Equal(37, skyPosition.Ra);
        }
예제 #5
0
        private DeepSpaceData()
        {
            this.Stars              = new ArrayList();
            this.Messier            = new ArrayList();
            this.Constellation      = new ArrayList();
            this.ConstellationNames = new ArrayList();

            Assembly     asembly      = Assembly.GetExecutingAssembly();
            Stream       txtStream    = asembly.GetManifestResourceStream("SpaceObjects.Resources.HYG.txt");
            StreamReader streamReader = new StreamReader(txtStream);

            string delimStr = ";";

            char[]           delimiter = delimStr.ToCharArray();
            NumberFormatInfo provider  = new NumberFormatInfo();

            provider.NumberDecimalSeparator = ".";
            while (streamReader.Peek() >= 0)
            {
                string[] split = streamReader.ReadLine().Split(delimiter, 20);
                Stars.Add(
                    new Star(
                        split[0],
                        split[1],
                        Convert.ToDouble(split[2], provider) * 15,
                        Convert.ToDouble(split[3], provider),
                        Convert.ToDouble(split[4], provider),
                        split[5]));
            }
            Stars.TrimToSize();

            asembly      = Assembly.GetExecutingAssembly();
            txtStream    = asembly.GetManifestResourceStream("SpaceObjects.Resources.Messier.txt");
            streamReader = new StreamReader(txtStream);

            while (streamReader.Peek() >= 0)
            {
                string[] split = streamReader.ReadLine().Split(delimiter, 20);
                Messier.Add(new Messier(split[0], Convert.ToDouble(split[1], provider) * 15,
                                        Convert.ToDouble(split[2], provider), split[3], split[4]));
            }
            Messier.TrimToSize();

            asembly      = Assembly.GetExecutingAssembly();
            txtStream    = asembly.GetManifestResourceStream("SpaceObjects.Resources.Constellations.txt");
            streamReader = new StreamReader(txtStream);

            while (streamReader.Peek() >= 0)
            {
                string str = streamReader.ReadLine();
                if (str[0] != 'C')
                {
                    string[] split = str.Split(delimiter, 20);
                    Constellation.Add(new ConstellationLine(Convert.ToDouble(split[0], provider) * 15, Convert.ToDouble(split[1], provider),
                                                            Convert.ToDouble(split[2], provider) * 15, Convert.ToDouble(split[3], provider)));
                }
                else
                {
                    string[]    split       = str.Split(delimiter, 4);
                    SkyPosition skyPosition = new SkyPosition();
                    skyPosition.Rectascence = Convert.ToDouble(split[2], provider) * 15;
                    skyPosition.Declination = Convert.ToDouble(split[3], provider);
                    ConstellationNames.Add(new ConstellationName(split[1], skyPosition));
                }
            }
            Constellation.TrimToSize();
            ConstellationNames.TrimToSize();
        }
예제 #6
0
 public ConstellationName(string name, SkyPosition skyPosition)
 {
     this.Name        = name;
     this.SkyPosition = skyPosition;
 }
예제 #7
0
 /// <summary>
 /// This function computes the apparent direction of a star or solar
 /// system body at a specified time and in a specified coordinate system
 /// </summary>
 /// <param name="jdTt"></param>
 /// <param name="celestialObject"></param>
 /// <param name="observer"></param>
 /// <param name="deltaT"></param>
 /// <param name="coordinateSystem"></param>
 /// <param name="accuracy"></param>
 /// <param name="position"></param>
 /// <returns></returns>
 public static short Place(double jdTt, CelestialObject celestialObject, Observer observer, double deltaT, CoordinateSystem coordinateSystem, Accuracy accuracy, ref SkyPosition position)
 {
     lock (lockObj) {
         var err = NOVAS_Place(jdTt, ref celestialObject, ref observer, deltaT, (short)coordinateSystem, (short)accuracy, ref position);
         return(err);
     }
 }
예제 #8
0
 private static extern short NOVAS_Place(double jdTt, ref CelestialObject celObject, ref Observer observer, double deltaT, short coordinateSystem, short accuracy, ref SkyPosition position);
예제 #9
0
 public double Distance(SkyPosition a, SkyPosition b)
 {
     return(Distance(a.Rectascence, a.Declination, b.Rectascence, b.Declination));
 }