示例#1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            double time = stopwatch.Elapsed.TotalSeconds / 10;

            field.Clear();

            field.AddPotentialPoint(100 + 50 * Math.Cos(time) + 10 * Math.Cos(2.1 * time), 100 + 40 * Math.Sin(time), 1);
            field.AddPotentialPoint(20, 10, -1);
            field.AddPotentialPoint(180, 20, 3);
            field.AddPotentialPoint(20, 180, -0.5);
            field.AddPotentialPoint(180, 180, 2);

            field.RaiseChanged();
        }
示例#2
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PotentialField field = new PotentialField();

            field.AddPotentialPoint(100, 100, 1);
            DataContext = vf.VectorField2D.CreateTangentPotentialField(field, 200, 200);
        }
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            const double   xDelta = width / xCount;
            const double   yDelta = height / yCount;
            PotentialField field  = new PotentialField();

            for (int ix = 0; ix < xCount; ix++)
            {
                for (int iy = 0; iy < yCount; iy++)
                {
                    field.AddPotentialPoint(new Point(ix * xDelta, iy * yDelta), (ix + iy) % 2 == 0 ? 1 : -1);
                }
            }

            DataContext = VectorField2D.CreateTangentPotentialField(field, (int)width, (int)height);
        }
示例#4
0
		public static Vector[,] CreatePotentialField()
		{
			PotentialField field = new PotentialField();
			field.AddPotentialPoint(0, 0, 1);
			field.AddPotentialPoint(20, 30, -1);
			field.AddPotentialPoint(50, 100, 1);
			field.AddPotentialPoint(100, 200, 3);

			return DataSource2DHelper.CreateVectorData(width, height, (x, y) =>
			{
				return field.GetPotential(new Point(x, y));
			});
		}