Example #1
0
        public Satellite3D()
        {
            orbit = new TubeVisual3D() { Diameter = 0.3, ThetaDiv = 12 };
            orbit.Material = MaterialHelper.CreateMaterial(null, Brushes.Gray, Brushes.White, 0.5, 40);

            Children.Add(orbit);
        }
Example #2
0
        public Planet3D()
        {
            Satellites = new List<Satellite3D>();

            orbit = new TubeVisual3D() {Diameter=0.8, ThetaDiv = 16 };
            orbit.Material = MaterialHelper.CreateMaterial(null,Brushes.Blue,Brushes.Gray,0.5, 20);
            Children.Add(orbit);
        }
Example #3
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.tube = ((HelixToolkit.TubeVisual3D)(target));
     return;
     }
     this._contentLoaded = true;
 }
Example #4
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.tube = ((HelixToolkit.TubeVisual3D)(target));
         return;
     }
     this._contentLoaded = true;
 }
        public FlightVisual3D(Point3D p1, Point3D p2)
        {
            var tube = new TubeVisual3D();
            tube.Material = MaterialHelper.CreateMaterial(Color.FromArgb(80, 255, 255, 255)); // Materials.Yellow;
            Children.Add(tube);
            Children.Add(new SphereVisual3D() { Center = p1, Radius = 100, Material = Materials.Green });
            Children.Add(new SphereVisual3D() { Center = p2, Radius = 100, Material = Materials.Red });

            double lat1, lon1, lat2, lon2;
            PointToLatLon(p1, out lat1, out lon1);
            PointToLatLon(p2, out lat2, out lon2);
            From = String.Format("{0:0.00} {1:0.00}", lat1, lon1);
            To = String.Format("{0:0.00} {1:0.00}", lat2, lon2);

            CruisingSpeed = DefaultCruisingSpeed;
            double cruisingRadius = EarthRadius + DefaultCruisingAltitude;
            double takeoffLength = DefaultTakeoffLength;
            double groundRadius = EarthRadius;
            const double tubeDiameter = 60;

            var o = new Point3D(0, 0, 0);
            var v1 = p1 - o;
            var v2 = p2 - o;
            var z = Vector3D.CrossProduct(v1, v2);
            var x = v1;
            var y = Vector3D.CrossProduct(x, z);
            x.Normalize();
            y.Normalize();
            double v2X = Vector3D.DotProduct(v2, x);
            double v2Y = Vector3D.DotProduct(v2, y);
            double v2A = Math.Atan2(v2Y, v2X);

            const int n = 100;

            var pts = new Point3DCollection();

            double da = v2A / (n - 1);

            double distance = cruisingRadius * Math.Abs(v2A);
            double landingLength = takeoffLength;

            double l = 0;
            for (int i = 0; i < n; i++)
            {
                double a = i * da;
                Vector3D v = x * Math.Cos(a) + y * Math.Sin(a);
                double r = cruisingRadius;

                //if (l < takeoffLength)
                //{
                //    r = groundRadius + Math.Sin(Math.PI/2*l/takeoffLength)*(cruisingRadius - groundRadius);
                //}
                //if (l > distance - landingLength)
                //{
                //    r = groundRadius + Math.Sin(Math.PI/2*(distance - l)/takeoffLength)*(cruisingRadius - groundRadius);
                //}

                r = groundRadius + Math.Sin(Math.PI * i / (n - 1)) * (cruisingRadius - groundRadius);

                var p = o + v * r;
                //  Children.Add(new SphereVisual3D() { Center = p, Radius = 60, Material = Materials.Gray});

                pts.Add(p);
                l += Math.Abs(cruisingRadius * da);
            }
            tube.Diameter = tubeDiameter;
            tube.ThetaDiv = 16;
            tube.Path = pts;
            Distance = distance;
        }