Exemple #1
0
        public SampleUniformPotentialFieldDataSource(PotentialField field, int width = 200, int height = 200)
        {
            this.field  = field;
            this.width  = width;
            this.height = height;

            field.Changed += OnFieldChanged;
        }
        public static DataSource CreateTangentPotentialField(PotentialField field, int width = 200, int height = 200)
        {
            var vectorArray = DataSource2DHelper.CreateVectorData(width, height, (x, y) =>
            {
                return(field.GetTangentVector(new Point(x, y)));
            });

            return(CreateVectorField(width, height, vectorArray));
        }
		public static DataSource CreateTangentPotentialField(int width = 200, int height = 200, params PotentialPoint[] points)
		{
			var potentialField = new PotentialField();
			potentialField.AddPoints(points);
			var vectorArray = DataSource2DHelper.CreateVectorData(width, height, (x, y) =>
			{
				return potentialField.GetTangentVector(new Point(x, y));
			});

			return CreateVectorField(width, height, vectorArray);
		}
        public static DataSource CreateTangentPotentialField(int width = 200, int height = 200, params PotentialPoint[] points)
        {
            var potentialField = new PotentialField();

            potentialField.AddPoints(points);
            var vectorArray = DataSource2DHelper.CreateVectorData(width, height, (x, y) =>
            {
                return(potentialField.GetTangentVector(new Point(x, y)));
            });

            return(CreateVectorField(width, height, vectorArray));
        }
		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);
		}
		public static DataSource CreateTangentPotentialField(PotentialField field, int width = 200, int height = 200)
		{
			var vectorArray = DataSource2DHelper.CreateVectorData(width, height, (x, y) =>
			{
				return field.GetTangentVector(new Point(x, y));
			});

			return CreateVectorField(width, height, vectorArray);
		}
		public static DataSource CreateDynamicTangentPotentialField(PotentialField field, int width = 200, int height = 200)
		{
			return new SampleUniformPotentialFieldDataSource(field, width, height);
		}
		void MainWindow_Loaded(object sender, RoutedEventArgs e)
		{
			PotentialField field = new PotentialField();
			field.AddPotentialPoint(100,100,1);
			DataContext = vf.VectorField2D.CreateTangentPotentialField(field, 200, 200);
		}
 public static DataSource CreateDynamicTangentPotentialField(PotentialField field, int width = 200, int height = 200)
 {
     return(new SampleUniformPotentialFieldDataSource(field, width, height));
 }
Exemple #10
0
 void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     vf.PotentialField field = new vf.PotentialField();
     field.AddPotentialPoint(100, 100, 1);
     DataContext = vf.VectorField2D.CreateTangentPotentialField(field);
 }