public void AddGlobalPoints(PointF p1, PointF p2, PointF p3, PointF p4, List <PointF> globRect, Magnet magnet1, Magnet magnet2) { GlobalPoints = new List <PointF> { p1, p2, p3, p4 }; GlobalRectangle = new List <PointF>(); GlobalRectangle.AddRange(globRect); Magnet1 = magnet1; Magnet2 = magnet2; FakePoints = new List <PointF>(); FakePoints.AddRange(Magnet1.FakePoints()); FakePoints.AddRange(Magnet2.FakePoints()); points.AddRange(FakePoints); points.AddRange(GlobalPoints); points.AddRange(GlobalRectangle); points.AddRange(Magnet1.points); points.AddRange(Magnet2.points); MagnetPoints = new List <PointF>(); MagnetPoints.AddRange(Magnet1.points); MagnetPoints.AddRange(Magnet2.points); }
public MainForm() { InitializeComponent(); parametrs = new Painter { xmax = 100, ymax = 100, xmin = -100, ymin = -100 }; points = new List <PointF>(); magnet1Potential = new List <Potential>(); magnet2Potential = new List <Potential>(); RectPotential = new List <Potential>(); unknownPotential = new List <Potential>(); allPotential = new List <Potential>(); trianglesWithPotential = new List <TrianglePotential>(); levelLines = new List <LevelLines>(); forceLines = new List <LevelLines>(); magnet1 = new Magnet(70, 10, center1, (float)(2 * Math.PI / 360 * 45), 3); magnet2 = new Magnet(70, 10, center2, (float)(2 * Math.PI / 360 * 30), 3); GlobalRect = new Magnet(160, 160, centerGlobal, (float)(2 * Math.PI / 360 * 0), 5); magnet1Potential = magnet1.ReturnPotential(-10, 10); magnet2Potential = magnet2.ReturnPotential(-10, 10); RectPotential = GlobalRect.ReturnPotential(0, 0); ScrollHeight.Minimum = (int)GlobalRect.A.Y; ScrollHeight.Value = (int)magnet1.center.Y; ScrollHeight.Maximum = (int)GlobalRect.D.Y; ScrollWidth.Minimum = (int)GlobalRect.A.X; ScrollWidth.Value = (int)magnet1.center.X; ScrollWidth.Maximum = (int)GlobalRect.B.X; ScrollAngle.Minimum = 0; ScrollAngle.Maximum = 360; ScrollAngle.Value = 45; StepXBox.Text = "7"; StepYBox.Text = "7"; plusUBox1.Text = "10"; plusUBox2.Text = "10"; minusUBox1.Text = "-10"; minusUBox2.Text = "-10"; Width1Box.Text = magnet1.width.ToString(); Width2Box.Text = magnet2.width.ToString(); Height1Box.Text = magnet1.height.ToString(); Height2Box.Text = magnet2.height.ToString(); Painting(); }
public List <PointF> FakePoints() { Magnet magnet = new Magnet(width - width / 5, height - height / 5, center, angle, step); List <PointF> bufPoints = new List <PointF>(); magnet.ReturnPotential(0, 0); bufPoints = magnet.points; return(bufPoints); }