示例#1
0
        public MainWindow()
        {
            InitializeComponent();

            pList.Add(new Particle(-2, -3, 0, -1));
            pList.Add(new Particle(2, -2, 0, 1));
            pList.Add(new Particle(2, 2, 0, 1));
            pList.Add(new Particle(-2, 4, 0, -1));
            pList.ShowAll(group);

            potential = new BornAttractive();
        }
示例#2
0
        public void updatePotential(List <Particle> others, BasePotential potential)
        {
            Potential = 0;

            foreach (Particle other in others)
            {
                if (other == null)
                {
                    throw new ArgumentNullException("Particle " + other.number);
                }
                if (this == other)
                {
                    continue;
                }

                Potential += potential.U(this, other);
            }
        }
示例#3
0
        public void updateVelocity(List <Particle> others, BasePotential potential)
        {
            Velocity *= velmult; //Keep some of the prior velocity, makes optimization nonlinear

            foreach (Particle other in others)
            {
                if (other == null)
                {
                    throw new ArgumentNullException("Particle " + other.number);
                }
                if (this == other)
                {
                    continue;
                }

                Velocity += potential.delU(this, other);
            }
            Console.WriteLine("Particle " + number + " velocity: " + Velocity.ToString());
        }