Пример #1
0
    static private void vp(List <Body> bv, int nstep)
    {
        MathVector dacc = MathVector.makeMathVector();
        MathVector dvel = MathVector.makeMathVector();
        double     dthf = 0.5 * BH.DTIME;

        for (int i = 0; i < bv.Count; ++i)
        {
            Body       b    = bv[i];
            MathVector acc1 = b.newAcc.cloneMathVector();
            if (nstep > 0)
            {
                dacc.subtraction2(acc1, b.acc);
                dvel.multScalar2(dacc, dthf);
                dvel.addition(b.vel);
                b.vel = dvel.cloneMathVector();
            }

            b.acc = acc1.cloneMathVector();

            dvel.multScalar2(b.acc, dthf);

            MathVector vel1 = b.vel.cloneMathVector();
            vel1.addition(dvel);
            MathVector dpos = vel1.cloneMathVector();
            dpos.multScalar1(BH.DTIME);
            dpos.addition(b.pos);
            b.pos = dpos.cloneMathVector();
            vel1.addition(dvel);
            b.vel = vel1.cloneMathVector();
        }
    }
Пример #2
0
		/**
	 * Create a HG  object.
	 *
	 * @param b the body object
	 * @param p a vector that represents the body
	 */
		public static HG makeHG (Body b, MathVector p)
		{
			HG hg = new HG ();
			hg.pskip = b;
			hg.pos0 = p.cloneMathVector ();
			hg.phi0 = 0.0;
			hg.acc0 = MathVector.makeMathVector ();
			return hg;
		}
Пример #3
0
        /**
         * Create a HG  object.
         *
         * @param b the body object
         * @param p a vector that represents the body
         */
        public static HG makeHG(Body b, MathVector p)
        {
            HG hg = new HG();

            hg.pskip = b;
            hg.pos0  = p.cloneMathVector();
            hg.phi0  = 0.0;
            hg.acc0  = MathVector.makeMathVector();
            return(hg);
        }