Neptune() static private method

static private Neptune ( ) : Body
return Body
Beispiel #1
0
        public NBodySystem()
        {
            bodies = new Body[] {
                Body.Sun(),
                    Body.Jupiter(),
                    Body.Saturn(),
                    Body.Uranus(),
                    Body.Neptune()
            };

            double px = 0.0;
            double py = 0.0;
            double pz = 0.0;

            foreach (Body _body in bodies) // body is a reserved keyword in D
            {
                px += _body.vx * _body.mass;
                py += _body.vy * _body.mass;
                pz += _body.vz * _body.mass;
            }
            bodies[0].OffsetMomentum(px, py, pz);
        }
Beispiel #2
0
        public NBodySystem()
        {
            bodies = new Body[] {
                Body.Sun(),
                    Body.Jupiter(),
                    Body.Saturn(),
                    Body.Uranus(),
                    Body.Neptune()
            };

            double px = 0.0;
            double py = 0.0;
            double pz = 0.0;

            foreach (Body body in bodies)
            {
                px += body.vx * body.mass;
                py += body.vy * body.mass;
                pz += body.vz * body.mass;
            }
            bodies[0].OffsetMomentum(px, py, pz);
        }
Beispiel #3
0
        public NBodySystem()
        {
            bodies = new Body[]{
             Body.Sun(),
             Body.Jupiter(),
             Body.Saturn(),
             Body.Uranus(),
             Body.Neptune()
              };

            Body xx = Body.Saturn();
            double xxXX = xx.vx + xx.vy;

            Body yy = bodies[2];
            double yyYY = yy.vx + yy.vy;

            double px = 0.0;
            double py = 0.0;
            double pz = 0.0;
            foreach (Body body in bodies)
            {

            double test = body.mass; // this is OK. but the ones below fail because there is an EXPRESSION.

            /*  px += ( body.vx * body.mass ) / 1.0; THE DIVISION IS JUST A TEST...
                py += body.vy * body.mass;
                pz += body.vz * body.mass;  */

            double tmpM = body.mass;
            double tmpX = body.vx;
            double tmpY = body.vy;
            double tmpZ = body.vz;

                px += tmpX * tmpM;
                py += tmpY * tmpM;
                pz += tmpZ * tmpM;
            }
            bodies[0].OffsetMomentum(px, py, pz);
        }