示例#1
0
        private void GenerateDataSetStandard()
        {
            InitGenerateDataSet();

            datasets = new List<IData3DSet>();

            var dataset = new Data3DSetClass<PointData>("stars", Color.White, 1.0f);

            foreach (SystemClass si in StarList)
            {
                AddSystem(si, dataset);
            }
            datasets.Add(dataset);

            if (visitedSystems != null && visitedSystems.Any())
            {
                dataset = new Data3DSetClass<PointData>("visitedstars", Color.Red, 2.0f);
                foreach (SystemClass sp in VisitedStars.Values)
                {
                    AddSystem(sp, dataset);
                }
                datasets.Add(dataset);
            }

            dataset = new Data3DSetClass<PointData>("Center", Color.Yellow, 5.0f);

            //GL.Enable(EnableCap.ProgramPointSize);
            dataset.Add(new PointData(0, 0, 0));
            datasets.Add(dataset);

            dataset = new Data3DSetClass<PointData>("Interest", Color.Purple, 10.0f);
            AddSystem("sol", dataset);
            AddSystem("sagittarius a*", dataset);
            //AddSystem("polaris", dataset);
            datasets.Add(dataset);

            if (ShowTril)
            {
                // For test only

                if (ReferenceSystems != null && ReferenceSystems.Any())
                {
                    var referenceLines = new Data3DSetClass<LineData>("CurrentReference", Color.Green, 5.0f);
                    foreach (var refSystem in ReferenceSystems)
                    {
                        referenceLines.Add(new LineData(0, 0, 0, refSystem.x - CenterSystem.x, refSystem.y - CenterSystem.y, CenterSystem.z - refSystem.z));
                    }

                    datasets.Add(referenceLines);
                }

                var lineSet = new Data3DSetClass<LineData>("SuggestedReference", Color.DarkOrange, 5.0f);

                Stopwatch sw = new Stopwatch();
                sw.Start();
                SuggestedReferences references = new SuggestedReferences(CenterSystem.x, CenterSystem.y, CenterSystem.z);

                for (int ii = 0; ii < 16; ii++)
                {
                    var rsys = references.GetCandidate();
                    if (rsys == null) break;
                    var system = rsys.System;
                    references.AddReferenceStar(system);
                    if (ReferenceSystems != null && ReferenceSystems.Any(s => s.name == system.name)) continue;
                    System.Diagnostics.Trace.WriteLine(string.Format("{0} Dist: {1} x:{2} y:{3} z:{4}", system.name, rsys.Distance.ToString("0.00"), system.x, system.y, system.z));
                    lineSet.Add(new LineData(0, 0, 0, system.x - CenterSystem.x, system.y - CenterSystem.y, CenterSystem.z - system.z));
                }
                sw.Stop();
                System.Diagnostics.Trace.WriteLine("Reference stars time " + sw.Elapsed.TotalSeconds.ToString("0.000s"));
                datasets.Add(lineSet);
            }
        }
 private static IEnumerable<SystemClass> GetListOfSuggestedSystems(double x, double y, double z, int count)
 {
     var references = new SuggestedReferences(x, y, z);
     var suggestedSystems = new List<SystemClass>();
     for (int ii = 0; ii < count; ii++)
     {
         var rsys = references.GetCandidate();
         if (rsys == null) break;
         var system = rsys.System;
         references.AddReferenceStar(system);
         System.Diagnostics.Trace.WriteLine(string.Format("{0} Dist: {1} x:{2} y:{3} z:{4}", system.name,
             rsys.Distance.ToString("0.00"), system.x, system.y, system.z));
         suggestedSystems.Add(system);
     }
     return suggestedSystems;
 }
        public void AddTrilaterationInfoToDataset()
        {
            if (ReferenceSystems != null && ReferenceSystems.Any())
            {
                var referenceLines = new Data3DSetClass<LineData>("CurrentReference", Color.Green, 5.0f);
                foreach (var refSystem in ReferenceSystems)
                {
                    referenceLines.Add(new LineData(CenterSystem.x, CenterSystem.y, CenterSystem.z, refSystem.x, refSystem.y, refSystem.z));
                }

                _datasets.Add(referenceLines);

                var lineSet = new Data3DSetClass<LineData>("SuggestedReference", Color.DarkOrange, 5.0f);


                Stopwatch sw = new Stopwatch();
                sw.Start();
                SuggestedReferences references = new SuggestedReferences(CenterSystem.x, CenterSystem.y, CenterSystem.z);

                for (int ii = 0; ii < 16; ii++)
                {
                    var rsys = references.GetCandidate();
                    if (rsys == null) break;
                    var system = rsys.System;
                    references.AddReferenceStar(system);
                    if (ReferenceSystems != null && ReferenceSystems.Any(s => s.name == system.name)) continue;
                    System.Diagnostics.Trace.WriteLine(string.Format("{0} Dist: {1} x:{2} y:{3} z:{4}", system.name, rsys.Distance.ToString("0.00"), system.x, system.y, system.z));
                    lineSet.Add(new LineData(CenterSystem.x, CenterSystem.y, CenterSystem.z, system.x, system.y, system.z));
                }
                sw.Stop();
                System.Diagnostics.Trace.WriteLine("Reference stars time " + sw.Elapsed.TotalSeconds.ToString("0.000s"));
                _datasets.Add(lineSet);
            }
        }