예제 #1
0
 public Eye(Position3D position, Position3D lookAt, SpatialAngle up)
 {
     _position = position;
     _lookAt = lookAt;
     _up = up;
     LookingAt = null;
     LookingFrom = null;
 }
예제 #2
0
        private void DrawPlanet(Planet planet, Star star)
        {
            Gl.glPushMatrix();

            rotateSphereOrbit(planet.Orbit);

            goToCenterOfOrbit(planet.Orbit);

            goToPosition(planet.CurrentPosition);

            if (drawCoordinates)
            {
                SetMaterialForSun(planet.Color, 1);
                Gl.glRasterPos3f((planet.Radius*1.5).ToFloat(), 0, 0);
                text(planet.Name);
                ReSetMaterialForSun();
            }

            if (Eye.LookingAt == planet)
            {
                SpatialAngle planetAngle = new SpatialAngle(
                    planet.CurrentPosition.Angle.Horizontal + planet.Orbit.Up.Horizontal,
                    planet.CurrentPosition.Angle.Vertical + planet.Orbit.Up.Vertical);
                Eye.LookAt = new Position3D(planetAngle, planet.CurrentPosition.Distance);
                if (tracking)
                {
                    Eye.LookingAt = planet;
                }
            }
            if (Eye.LookingFrom == planet)
            {
                SpatialAngle planetAngle = new SpatialAngle(
                    planet.CurrentPosition.Angle.Horizontal + planet.Orbit.Up.Horizontal + star.Orbit.Up.Horizontal,
                    planet.CurrentPosition.Angle.Vertical + planet.Orbit.Up.Vertical + star.Orbit.Up.Vertical);
                Eye.Position = new Position3D(planetAngle, planet.CurrentPosition.Distance + planet.Radius * 5);
                if (tracking)
                {
                    Eye.LookingFrom = planet;
                }
            }

            rotatePlanetAxis(planet);

            foreach (Planet s in planet.Satelites)
            {
                DrawPlanet(s, star);
            }

            Gl.glRotated(planet.CurrentRotationAngle * 180 / Math.PI, 1, 0, 0);

            SetMaterialForPlanet(planet, star.Shinines.ToFloat());

            if (drawCoordinates)
            {
                drawCoordinateSystem(planet.Radius);
            }

            drawSphere(planet);
            if (planet.Rings != null)
            {
                SetMaterialForPlanet(planet, (star.Shinines / 10f).ToFloat());
                Gl.glRotated(90, 0, 1, 0);
                foreach (Projektni_zadatak.Bodies.Ring r in planet.Rings)
                {
                    drawDisc(r);
                }
            }
            //Glut.glutWireCone(planet.Radius, planet.Radius, 30, 30);
            ReSetMaterialForPlanet();
            Gl.glPopMatrix();
        }
예제 #3
0
 public Eye()
 {
     Position = new Position3D();
     LookAt = new Position3D();
     Up = new SpatialAngle();
 }
예제 #4
0
 public Rotation(double hoursForRotation, double daysForPrecession, SpatialAngle axisTilt)
 {
     HoursForRotation = hoursForRotation;
     DaysForPrecession = daysForPrecession;
     AxisTilt = axisTilt;
 }
예제 #5
0
 public SpatialAngle(SpatialAngle sp)
 {
     Horizontal = sp.Horizontal;
     Vertical = sp.Vertical;
 }
예제 #6
0
 public Position3D(SpatialAngle angle, double distanceFromCenter)
 {
     _angle = angle;
     Distance = distanceFromCenter;
 }
예제 #7
0
 public Position3D(double x, double y, double z)
 {
     _angle = new SpatialAngle(0, 0);
     Distance = Math.Sqrt(x * x + y * y + z * z);
     if (Distance > 0)
     {
         Angle.Vertical = Math.Asin(x / Distance);
         Angle.Horizontal = Math.Asin(-z / (Math.Acos(Angle.Vertical) * Distance));
     }
     else
     {
         Angle.Horizontal = Angle.Vertical = 0;
     }
 }
예제 #8
0
 public Position3D()
 {
     Angle = new SpatialAngle();
     Distance = 0;
 }
예제 #9
0
 public Orbit(double daysForRevolution, Ecliptic ecliptic, SpatialAngle up, double startAngle)
 {
     DaysForRevolution = daysForRevolution;
     Ecliptic = ecliptic;
     Up = up;
     StartAngle = startAngle;
 }
예제 #10
0
 public Orbit()
 {
     DaysForRevolution = 1;
     Ecliptic = new Ecliptic(0, 0);
     Up = new SpatialAngle(0, 0);
     StartAngle = 0;
 }