private void MainWindow_Loaded(object sender, RoutedEventArgs e) { timer.Tick += new EventHandler(timer_Tick); timer.Start(); DataContext = VectorField2D.CreateDynamicTangentPotentialField(field); }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { //var field = VectorField2D.CreateTangentPotentialField(256, 256, // new PotentialPoint(new Point(20, 10), 1), // new PotentialPoint(new Point(128, 128), -2), // new PotentialPoint(new Point(65, 85), 3), // new PotentialPoint(new Point(150, 30), 10), // new PotentialPoint(new Point(100, 100), -5)); var field = VectorField2D.CreateCheckerboard(cellSize: 20); DataContext = field; int size = 102; for (int ix = 0; ix < size; ix++) { for (int iy = 0; iy < size; iy++) { //if (Math.Abs(size / 2 - ix) < size / 5 && Math.Abs(size / 2 - iy) < size / 5) if (Math.Abs(size / 3 - iy) < 5 && Math.Abs(ix - (ix / 10) * 10) < 2) { fluidImage.Solver.OccupiedCells[iy * size + ix] = true; } } } }
void Window1_Loaded(object sender, RoutedEventArgs e) { var vectorField = //VectorField2D.CreateCheckerboard(200, 200); VectorField2D.CreateTangentPotentialField(256, 256, new PotentialPoint(new Point(20, 10), 1), new PotentialPoint(new Point(128, 128), -2), new PotentialPoint(new Point(65, 85), 3), new PotentialPoint(new Point(150, 30), 10), new PotentialPoint(new Point(100, 100), -5)); DataContext = vectorField; streamlineChart.DataSource = vectorField; horizontalSection.SetBinding(HorizontalCrossSectionChart.SectionCoordinateProperty, new Binding("Position.Y") { Source = point }); horizontalSection.Palette = convolutionChart.MagnitudeFilter.Palette; horizontalSection.DataSource = vectorField; verticalSection.SetBinding(VerticalCrossSectionChart.SectionCoordinateProperty, new Binding("Position.X") { Source = point }); verticalSection.Palette = convolutionChart.MagnitudeFilter.Palette; verticalSection.DataSource = vectorField; }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { var dataSource = VectorField2D.CreateTangentPotentialField(256, 256, new PotentialPoint(new Point(20, 10), 1), new PotentialPoint(new Point(128, 128), -2), new PotentialPoint(new Point(65, 85), 3), new PotentialPoint(new Point(150, 30), 10), new PotentialPoint(new Point(100, 100), -5)); meshChart.DataSource = dataSource; meshChart.Plotter.DataContext = dataSource; }
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 MapTester1() { InitializeComponent(); // Setup the map _map.CollisionHandler = new CollisionHandler(); trkElapsedTime_Scroll(this, new EventArgs()); trkThreshold_Scroll(this, new EventArgs()); // Setup the viewer pictureBox1.SetBorder(_boundryLower, _boundryUpper); pictureBox1.ShowBorder(Color.GhostWhite, 3); trkYBoundry_Scroll(this, new EventArgs()); pictureBox1.ZoomFit(); // Setup the vector field _vectorField = new VectorField2D(); _vectorField.SquaresPerSideX = 10; _vectorField.SquaresPerSideY = 10; trkVectorFieldForce_Scroll(this, new EventArgs()); trkVectorFieldSize_Scroll(this, new EventArgs()); // Setup the vector field combo foreach (string enumName in Enum.GetNames(typeof(VectorField2DMode))) { cboVectorField.Items.Add(enumName); } cboVectorField.Text = VectorField2DMode.None.ToString(); // Misc radGravity_CheckedChanged(this, new EventArgs()); chkDrawCollisionsRed_CheckedChanged(this, new EventArgs()); trkElasticity_Scroll(this, new EventArgs()); radPullApart_CheckedChanged(this, new EventArgs()); trkPullApartPercent_Scroll(this, new EventArgs()); trkPullApartSpring_Scroll(this, new EventArgs()); trkGravityForce_Scroll(this, new EventArgs()); toolTip1.SetToolTip(chkSmallObjectsAreMassive, "(doesn't affect rigid bodies)"); // Run it chkRunning.Checked = true; trkElapsedTime.BackColor = tabControl1.BackColor; }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { const int size = 200; var dataSource = VectorField2D.CreateTangentPotentialField(size, size, new PotentialPoint(10, 170, 1), new PotentialPoint(100, 30, -1), new PotentialPoint(150, 130, 2) ); Stopwatch timer = Stopwatch.StartNew(); convolutionChart.AddHandler(BackgroundRenderer.RenderingFinished, new RoutedEventHandler((s, args) => { timer.Stop(); Debug.WriteLine(timer.Elapsed); })); DataContext = dataSource; }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { var dataSource = VectorField2D.CreateCircularField().ChangeGrid((ix, iy) => new Point(ix / 100.0 + 100, iy / 100.0 + 100)); DataContext = dataSource; }
public void DrawVectorField(VectorField2D field, DrawMode mode) { }
public void draw(string function) { string s = sub(function, 0, function.IndexOf("=")); Debug.Log(s); string f = sub(function, function.IndexOf("=") + 1, function.Length); Debug.Log(f); IObj obj = null; if (f.Contains(",")) { f = sub(f, 1, f.Length - 1); string[] comp = f.Split(','); if (s.Contains("(x,y,z)")) { GameObject gameObject = Instantiate(vectorField3DObject, transform.position + Vector3.up, Quaternion.identity) as GameObject; gameObject.transform.localScale = new Vector3(10, 10, 10); VectorField3D vectorField3D = gameObject.GetComponent <VectorField3D>(); vectorField3D.sex = comp[0]; vectorField3D.sey = comp[1]; vectorField3D.sez = comp[2]; obj = vectorField3D; //vectorField3D.update(); } else if (s.Contains("(x,y)")) { GameObject gameObject = Instantiate(vectorField2DObject, transform.position + Vector3.up, Quaternion.identity) as GameObject; gameObject.transform.localScale = new Vector3(10, 10, 10); VectorField2D vectorField2D = gameObject.GetComponent <VectorField2D>(); Debug.Log("vector2d"); Debug.Log(comp[0]); Debug.Log(comp[1]); vectorField2D.sex = comp[0]; vectorField2D.sey = comp[1]; obj = vectorField2D; //vectorField2D.update(); } } else { Debug.Log(function); Regex r = new Regex("([a-zA-Z0-9]*?)\\^\\((.+?)\\)"); Match m = r.Match(function); if (m.Success) { function = r.Replace(function, "Pow($1,$2)"); Debug.Log(m.Groups[1]); Debug.Log(m.Groups[2]); } Debug.Log(function); if (s.Contains("(x,y)")) { GameObject gameObject = Instantiate(function3DObject, transform.position + Vector3.up, Quaternion.identity) as GameObject; gameObject.transform.localScale = new Vector3(10, 10, 10); Function3D function3D = gameObject.GetComponent <Function3D>(); function3D.function = f; function3D.start(); function3D.compile(); obj = function3D; //function3D.update(); } else if (s.Contains("(x)")) { GameObject gameObject = Instantiate(function2DObject, transform.position + Vector3.up, Quaternion.identity) as GameObject; gameObject.transform.localScale = new Vector3(100, 100, 100); Function2D function2D = gameObject.GetComponent <Function2D>(); Debug.Log("2D"); function2D.function = f; obj = function2D; //function2D.update(); } } if (obj != null) { Debug.Log("Queue"); main.unassigned.Enqueue(obj); Debug.Log(main.unassigned.Count); } }