コード例 #1
0
        //,Physic.Grid myGrid,System.Collections.ArrayList alData)
        void Draw_Field_Vectors(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;

                    Math.Vector_draw myVector = new Math.Vector_draw();
                    myVector.position_start.set_x(pt.get_x());
                    myVector.position_start.set_y(pt.get_y());
                    myVector.position_end.set_x(pt.get_x()+E.get_x());
                    myVector.position_end.set_y(pt.get_y()+E.get_y());

                    if (this.mnuOptionsUseColors.Checked)
                    {
                        Physic.Color myColor = new Physic.Color();
                        myVector.color = myColor.color("step",E.norm,0,E_max.norm);
                    }
                    else
                    {
                        myVector.color = System.Drawing.Color.White;
                    }

                        myVector.Draw(myGraphics);
                }
            }
            else if (get_mode()==1)
            {
                Physic.Magnetostatic_field B_max = new Physic.Magnetostatic_field();
                B_max.set_x(60);

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

                    Math.Vector_draw myVector = new Math.Vector_draw();
                    myVector.position_start.set_x(pt.get_x());
                    myVector.position_start.set_y(pt.get_y());
                    myVector.position_end.set_x(pt.get_x()+B.get_x());
                    myVector.position_end.set_y(pt.get_y()+B.get_y());

                    if (this.mnuOptionsUseColors.Checked)
                    {
                        Physic.Color myColor = new Physic.Color();
                        myVector.color = myColor.color("step",B.norm,0,B_max.norm);
                    }
                    else
                    {
                        myVector.color = System.Drawing.Color.White;
                    }

                        myVector.Draw(myGraphics);
                }
            }
        }
コード例 #2
0
        //,Physic.Grid myGrid,System.Collections.ArrayList alData)
        void Draw_Field_Grains(System.Drawing.Graphics myGraphics)
        {
            if (this.mnuModeE.Checked==true)
            {
                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;

                    Physic.Grain_draw myGrain = new Physic.Grain_draw();
                    myGrain.len = (float) System.Math.Sqrt(myGrid.get_space().get_x()*myGrid.get_space().get_x() + myGrid.get_space().get_y()*myGrid.get_space().get_y()) / (float) System.Math.Sqrt(2);
                    myGrain.get_position().set_x(pt.get_x());
                    myGrain.get_position().set_y(pt.get_y());
                    myGrain.get_direction().set_x(E.get_x());
                    myGrain.get_direction().set_y(E.get_y());
                    if (this.mnuOptionsUseColors.Checked)
                    {
                        Physic.Color myColor = new Physic.Color();
                        myGrain.color = myColor.color("linear",E.norm,0,E_max.norm);
                    }
                    else
                    {
                        myGrain.color = System.Drawing.Color.White;
                    }

                    myGrain.Draw(myGraphics);
                }
            }
            else if (this.mnuModeB.Checked==true)
            {
                Physic.Magnetostatic_field B_max = new Physic.Magnetostatic_field();
                B_max.set_x(60);

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

                    Physic.Grain_draw myGrain = new Physic.Grain_draw();
                    myGrain.len = (float) System.Math.Sqrt(myGrid.get_space().get_x()*myGrid.get_space().get_x() + myGrid.get_space().get_y()*myGrid.get_space().get_y()) / (float) System.Math.Sqrt(2);
                    myGrain.get_position().set_x(pt.get_x());
                    myGrain.get_position().set_y(pt.get_y());
                    myGrain.get_direction().set_x(B.get_x());
                    myGrain.get_direction().set_y(B.get_y());
                    if (this.mnuOptionsUseColors.Checked)
                    {
                        Physic.Color myColor = new Physic.Color();
                        myGrain.color = myColor.color("linear",B.norm,0,B_max.norm);
                    }
                    else
                    {
                        myGrain.color = System.Drawing.Color.White;
                    }

                    myGrain.Draw(myGraphics);
                }
            }
        }