void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            tabControl.SelectionChanged += new SelectionChangedEventHandler(tabControl_SelectionChanged);

            PotentialField3D field = new PotentialField3D();

            field.AddPotentialPoint(new Point3D(0.5, 0.5, 0.5), 2);
            field.AddPotentialPoint(new Point3D(0.2, 0.2, 0.5), -3);
            field.AddPotentialPoint(new Point3D(0.8, 0.2, 0.9), 10);
            field.AddPotentialPoint(new Point3D(0.3, 0.7, 0.1), 5);

            PotentialFieldChart3D fieldChart = new PotentialFieldChart3D {
                Field = field
            };

            viewport.Children.Insert(0, fieldChart);

            dataSource3D = VectorField3D.CreateTangentPotentialField(field, 200, 200, 200);

            //dataSource3D = VectorField3D.CreatePotentialField(200, 200, 200,
            //    new PotentialPoint3D(new Point3D(0.5, 0.5, 0.5), 2), new PotentialPoint3D(new Point3D(0.2, 0.2, 0.5), -1));

            DataContext           = dataSource3D;
            isoSurface.DataSource = dataSource3D.GetMagnitudeDataSource();


            //var spiralDS = VectorField3D.CreateSpiral(
            //    latticeX: 10, latticeY: 20, latticeZ: 3,
            //    width: 2, height: 2, depth: 1).TransformGrid(transform);

            var filteredDataSource = dataSource3D.Filter(20, 20, 20);

            //vectorChart3D.DataSource = filteredDataSource;
            //gridChart.GridSource = filteredDataSource;

            //timer.Start();

            plotterXY.DataContext = dataSource3D.CreateSectionXY(0.0);
            plotterXZ.DataContext = dataSource3D.CreateSectionXZ(0.0);
            plotterYZ.DataContext = dataSource3D.CreateSectionYZ(0.0);

            sectionChartX.ThirdCoordinate = 0.0001;
            sectionChartY.ThirdCoordinate = 0.0001;
            sectionChartZ.ThirdCoordinate = 0.0001;
            sectionChartX.UpdateUI();
            sectionChartY.UpdateUI();
            sectionChartZ.UpdateUI();

            mainTabControl.SelectedIndex = 3;
            convolutionStack.DataSource  = dataSource3D;

            UpdateSelectedTab();

            progressBar.SetBinding(ProgressBar.ValueProperty, new Binding("RenderingProgress")
            {
                Source = convolutionStack
            });
        }
Example #2
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PotentialField3D field = new PotentialField3D();

            field.AddPotentialPoint(new Point3D(0.5, 0.5, 0.5), 2);
            field.AddPotentialPoint(new Point3D(0.2, 0.2, 0.5), -3);
            field.AddPotentialPoint(new Point3D(0.8, 0.2, 0.9), 10);
            field.AddPotentialPoint(new Point3D(0.3, 0.7, 0.1), 5);

            var dataSource3D = VectorField3D.CreateTangentPotentialField(field, 200, 200, 200);

            isoSurface.DataSource = dataSource3D.GetMagnitudeDataSource();
        }
Example #3
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PotentialField3D field = new PotentialField3D();

            field.AddPotentialPoint(new Point3D(0.5, 0.5, 0.5), 2);
            field.AddPotentialPoint(new Point3D(0.2, 0.2, 0.5), -3);
            field.AddPotentialPoint(new Point3D(0.8, 0.2, 0.9), 10);
            field.AddPotentialPoint(new Point3D(0.3, 0.7, 0.1), 5);

            var dataSource3D = VectorField3D.CreateTangentPotentialField(field, 200, 200, 200);

            streamlineChart.DataSource   = dataSource3D;
            dynamicStreamLine.DataSource = dataSource3D;
            dynamicStreamLine.Pattern    = patternChart.OutPattern;
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PotentialField3D field = new PotentialField3D();

            field.AddPotentialPoint(new Point3D(0.5, 0.5, 0.5), 2);
            field.AddPotentialPoint(new Point3D(0.2, 0.2, 0.5), -3);
            field.AddPotentialPoint(new Point3D(0.8, 0.2, 0.9), 10);
            field.AddPotentialPoint(new Point3D(0.3, 0.7, 0.1), 5);

            dataSource3D = VectorField3D.CreateTangentPotentialField(field, 200, 200, 200);

            plotterXY.DataContext = dataSource3D.CreateSectionXY(0.0);
            plotterXZ.DataContext = dataSource3D.CreateSectionXZ(0.0);
            plotterYZ.DataContext = dataSource3D.CreateSectionYZ(0.0);
        }
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PotentialField3D field = new PotentialField3D();

            field.AddPotentialPoint(new Point3D(0.5, 0.5, 0.5), 2);
            field.AddPotentialPoint(new Point3D(0.2, 0.2, 0.5), -3);
            field.AddPotentialPoint(new Point3D(0.8, 0.2, 0.9), 10);
            field.AddPotentialPoint(new Point3D(0.3, 0.7, 0.1), 5);

            var dataSource3D = VectorField3D.CreateTangentPotentialField(field, 200, 200, 200);

            convolutionStack.DataSource = dataSource3D;

            progressBar.SetBinding(ProgressBar.ValueProperty, new Binding("RenderingProgress")
            {
                Source = convolutionStack
            });
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PotentialField3D field = new PotentialField3D();

            field.AddPotentialPoint(new Point3D(0.5, 0.5, 0.5), 2);
            field.AddPotentialPoint(new Point3D(0.2, 0.2, 0.5), -3);
            field.AddPotentialPoint(new Point3D(0.8, 0.2, 0.9), 10);
            field.AddPotentialPoint(new Point3D(0.3, 0.7, 0.1), 5);

            dataSource3D = VectorField3D.CreateTangentPotentialField(field, 200, 200, 200);
            DataContext  = dataSource3D;

            sectionChartX.ThirdCoordinate = 0.0001;
            sectionChartY.ThirdCoordinate = 0.0001;
            sectionChartZ.ThirdCoordinate = 0.0001;

            UpdateSelectedTab();

            PotentialFieldChart3D fieldChart = new PotentialFieldChart3D {
                Field = field
            };

            viewport.Children.Insert(0, fieldChart);
        }
Example #7
0
    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);
        }
    }