Ejemplo n.º 1
0
        void Draw_Field_Rectangles(System.Drawing.Graphics myGraphics)
        {
            if (get_mode()==0)
            {
            Physic.Electrostatic_field E_max = new Physic.Electrostatic_field();
            E_max.set_x(60);

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

                Rectangle_draw myRect = new Rectangle_draw();
                myRect.width = myGrid.get_space().get_x()/2;
                myRect.height = myGrid.get_space().get_y()/2;
                myRect.get_position().set_x(pt.get_x());
                myRect.get_position().set_y(pt.get_y());
                if (this.mnuOptionsUseColors.Checked)
                {
                    Physic.Color myColor = new Physic.Color();
                    myRect.color = myColor.color("step",E.norm,0,E_max.norm);
                }
                else
                {
                    myRect.color = System.Drawing.Color.White;
                }

                myRect.Draw(myGraphics);
            }
            }
        }
Ejemplo n.º 2
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);
            }
            }
        }