예제 #1
0
 public Planet(Sphere sp, double reflectivity, Rotation rotation, Orbit orbit, List<Ring> rings)
     : base(sp)
 {
     Reflectivity = reflectivity;
     Orbit = orbit;
     Satelites = new List<Planet>();
     CurrentRotationAngle = 0;
     Rotation = rotation;
     double ecc = (Math.Pow(Math.Sin(Orbit.StartAngle) + 1, 3) * Orbit.Ecliptic.Eccentricity * 0.5);
     double dist = Orbit.Ecliptic.MeanRadius * (1 + ecc);
     CurrentPosition = new Position3D(new SpatialAngle(Orbit.StartAngle, 0), dist);
     Rings = rings;
 }
예제 #2
0
        private Planet CreatePlanetFromData(PlanetData data, float distanceScale, float planetScale, float moonDistSc)
        {
            Sphere sphere = new Sphere(data.Radius / planetScale, data.Color, data.Name);
            Orbit orbit = new Orbit(data.DaysForRevolution, new Ecliptic(data.DistanceFromCenter/distanceScale, data.EclipticEccentrity), new SpatialAngle(data.EclipticAngleX * Math.PI / 180f, data.EclipticInclination * Math.PI / 180f), data.StartAngle*Math.PI/180f);
            Rotation rotation = new Rotation(data.HoursForRotation, 0, new SpatialAngle(data.TiltAngleX * Math.PI / 180f, data.TiltAngleUP * Math.PI / 180f));
            Planet planet = new Planet(sphere, data.Reflectivity, rotation, orbit, CreateRingsFromData(data.Rings, planetScale));

            if (data.Satelites != null)
            {
                foreach (PlanetData moon in data.Satelites)
                {
                    planet.Satelites.Add(CreatePlanetFromData(moon, distanceScale/moonDistSc, planetScale, moonDistSc));
                }
            }
            return planet;
        }