Beispiel #1
0
        public void ConvertCoordinates()
        {
            // TeeGarden 12.58ly RA 02h 53m 00.85s Dec +16d 52m 53.3s
            Point3d p = AstronomicalFunctions.ConvertToCartesian(12.58, 2, 53, 0.85, 16, 52, 53.3);

            // SCR 1845 (Ophir) 12.57ly RA 18h 45m 05.26s Dec ?63d 57m 47.8s
            p = AstronomicalFunctions.ConvertToCartesian(12.57, 18, 45, 5.26, -63, 57, 47.8);

            // UGPS 0722-05 (Knob) 13.4ly RA 07h 22m 27.29s Dec ?05d 40m 30.0s
            p = AstronomicalFunctions.ConvertToCartesian(13.4, 7, 22, 27.29, -5, 40, 30.0);

            // DEN 1048-3956 (Flare) 13.15ly RA 10h 48m 14.640s Dec ?39d 56m 06.24s
            p = AstronomicalFunctions.ConvertToCartesian(13.15, 10, 48, 14.64, -39, 56, 6.24);

            // GL 628 (Lapis) 14.04ly RA 16h 30m 18.0584s Dec –12d 39m 45.325s
            p = AstronomicalFunctions.ConvertToCartesian(14.04, 16, 30, 18.06, -12, 39, 45.32);

            // GJ 205 (Bellerophon) 18.5ly RA 05h 31m 27.39595s Dec ?03° 40? 38.0311?
            p = AstronomicalFunctions.ConvertToCartesian(18.5, 5, 31, 27.4, -3, 40, 38.03);


            Point3d p2 = new Point3d(p.x / 3.261633, p.y / 3.261633, p.z / 3.261633);

            Console.WriteLine(p2);
        }
        public static ERBridge CreateStarSystemBridge(ProgressionMap map, Cluster cluster, string starname1, string starname2)
        {
            // force mapping
            cluster.Map = map;

            StarSystem system1 = cluster.GetStarSystem(starname1);
            StarSystem system2 = cluster.GetStarSystem(starname2);

            if (system1 == null || system2 == null)
            {
                return(null);
            }

            // force mapping
            system1.Map = map;
            system2.Map = map;

            ERBridge bridge = new ERBridge(ProgressionConstants.BridgeTypes.StarSystem, system1, system2);

            system1.Add(bridge.Portals[0]);
            system2.Add(bridge.Portals[1]);

            if (system1.BasicProperties.ContainsKey(StellarMap.Core.Types.Constants.PropertyNames.Position) &&
                system2.BasicProperties.ContainsKey(StellarMap.Core.Types.Constants.PropertyNames.Position))
            {
                if (Point3d.TryParse(system1.BasicProperties[StellarMap.Core.Types.Constants.PropertyNames.Position], out var p1) &&
                    Point3d.TryParse(system2.BasicProperties[StellarMap.Core.Types.Constants.PropertyNames.Position], out var p2))
                {
                    double distance = AstronomicalFunctions.Distance(p1, p2);
                    bridge.BasicProperties.Add(StellarMap.Core.Types.Constants.PropertyNames.Distance, distance.ToString());
                }
            }

            return(bridge);
        }
Beispiel #3
0
        public void NearestStars()
        {
            LocalSectorStarsReader reader = new LocalSectorStarsReader();

            reader.Load(Path.Combine(TestingUtilities.Config["DataPath"], "LocalSector Stars.csv"));
            IList <LocalSectorStar> stars = reader.Stars;

            string          starName = "Little Ophiuchi";
            LocalSectorStar star     = stars.Where(s => s.Name == starName).First();

            double distance = 20 / 3.261633;
            var    nearest  = stars.Where(s => AstronomicalFunctions.Distance(s.Position, star.Position) <= distance);

            if (nearest != null)
            {
                using (StreamWriter writer = new StreamWriter(Path.Combine(TestingUtilities.Config["DataPath"], "Closest.txt")))
                {
                    foreach (LocalSectorStar s in nearest)
                    {
                        writer.Write(s.Designation);
                        writer.Write(" - ");
                        writer.Write(s.Name);
                        writer.Write(" - ");
                        writer.Write(s.Cluster);
                        writer.Write(" - ");
                        writer.WriteLine(AstronomicalFunctions.Distance(s.Position, star.Position) * 3.261633);
                    }
                }
            }
        }