Ejemplo n.º 1
0
        void Draw_Equipotentials(System.Drawing.Graphics myGraphics)
        {
            if (get_mode()==0)
            {
            Physic.Electrostatic_potential V_max = new Physic.Electrostatic_potential();
            V_max.value = 3000;

            Physic.Electrostatic_potential V_min = new Physic.Electrostatic_potential();
            V_min.value = -3000;

            foreach (DefaultNamespace.Data myData in alDatas.Data)
            {
                Physic.Position pt = myData.position;
                Physic.Electrostatic_potential V = myData.V;

                Rectangle_draw myRect = new Rectangle_draw();
                myRect.width = myGrid.get_space().get_x(); //2;
                myRect.height = myGrid.get_space().get_y(); //2;
                myRect.position.set_x(pt.get_x());
                myRect.position.set_y(pt.get_y());
                if (this.mnuOptionsUseColors.Checked)
                {
                    Physic.Color myColor = new Physic.Color();
                    myRect.color = myColor.color("step",V.value,V_min.value,V_max.value);
                }
                else
                {
                    myRect.color = System.Drawing.Color.White;
                }

                myRect.Draw(myGraphics);
            }
            }
        }
Ejemplo n.º 2
0
        void Calculate_Datas()
        {
            foreach(Physic.Position pt in myGrid.get_positions())
            {
                Physic.Electrostatic_field E = new Physic.Electrostatic_field(pt);
                Physic.Electrostatic_potential V = new Physic.Electrostatic_potential(pt);
                Physic.Magnetostatic_field B = new Physic.Magnetostatic_field(pt);

                foreach (Physic.Charge chg in alCharges.Charge)
                {
                    Physic.Electrostatic_field E_tmp = new Physic.Electrostatic_field(chg,pt);
                    Physic.Magnetostatic_field B_tmp = new Physic.Magnetostatic_field(chg,pt);
                    E = E + E_tmp; // + is overload
                    B = B + B_tmp;

                    Physic.Electrostatic_potential V_tmp = new Physic.Electrostatic_potential(chg,pt);
                    V = V + V_tmp;
                }

                DefaultNamespace.Data myData = new DefaultNamespace.Data();
                myData.position = pt;
                myData.E = E;
                myData.V = V;
                myData.B = B;
                alDatas.Data.Add(myData);
            }
        }