private XyzDataSeries3D <double> GetScatterDataSeries()
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>()
            {
                SeriesName = "Colorful Bubble!"
            };

            const int count = 250;

            var random = new Random(0);

            for (var i = 0; i < count; i++)
            {
                var x = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                var y = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                var z = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);

                var scale = (float)((random.NextDouble() + 0.5) * 3.0);

                Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));

                xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(randomColor, scale));
            }

            return(xyzDataSeries3D);
        }
        private void OnStart()
        {
            StartButton.IsChecked = true;
            PauseButton.IsChecked = false;
            ResetButton.IsChecked = false;

            if (ScatterRenderableSeries3D.DataSeries == null)
            {
                _xyzData = new XyzDataSeries3D <double>();

                // First load, fill with some random values
                for (int i = 0; i < _pointCount; i++)
                {
                    double x = DataManager.Instance.GetGaussianRandomNumber(50, 15);
                    double y = DataManager.Instance.GetGaussianRandomNumber(50, 15);
                    double z = DataManager.Instance.GetGaussianRandomNumber(50, 15);

                    _xyzData.Append(x, y, z);
                }

                ScatterRenderableSeries3D.DataSeries = _xyzData;
            }

            if (_timer == null)
            {
                _timer          = new DispatcherTimer(DispatcherPriority.Render);
                _timer.Interval = TimeSpan.FromMilliseconds(1);
                _timer.Tick    += OnTimerTick;
            }

            _timer.Start();
        }
Exemple #3
0
        public AnnotationDragModifier3D()
        {
            InitializeComponent();

            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            const int count = 100;

            for (int i = 0; i < count; i++)
            {
                var x = rand.Next(10, 90);
                var y = rand.Next(10, 90);
                var z = rand.Next(10, 90);

                xyzDataSeries3D.Append(x, y, z);
            }

            ScatterSeries3D.DataSeries = xyzDataSeries3D;

            SciChart.XAxis.VisibleRange = new DoubleRange(0, 100);
            SciChart.YAxis.VisibleRange = new DoubleRange(0, 100);
            SciChart.ZAxis.VisibleRange = new DoubleRange(0, 100);


            AddAnnotation();
        }
        private void ThemeManager3DChart_OnLoaded(object sender, RoutedEventArgs e)
        {
            scatterSeries3D.PointMarker = new PyramidPointMarker3D();
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            int count = 150;

            var random = new Random(0);

            for (int i = 0; i < count; i++)
            {
                double x = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                double y = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                double z = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);

                // Scale is a multiplier used to increase/decrease ScatterRenderableSeries3D.ScatterPointSize
                float scale = (float)((random.NextDouble() + 0.5) * 3.0);

                // Color is applied to PointMetadata3D and overrides the default ScatterRenderableSeries.Stroke property
                Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));

                // To declare scale and colour, add a VertextData class as the w (fourth) parameter.
                // The PointMetadata3D class also has other properties defining the behaviour of the XYZ point
                xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(randomColor, scale));
            }

            scatterSeries3D.DataSeries = xyzDataSeries3D;
        }
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            const int count  = 25;
            double    step   = 0.3;
            var       random = new Random(0);

            Color color;

            for (int x = 0; x < count; x++)
            {
                // Color is applied to PointMetadata3D and overrides the default ScatterRenderableSeries.Stroke property
                color = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));

                for (int z = 1; z < count; z++)
                {
                    var y = (z != 0) ? Math.Pow((double)z, step) : Math.Pow((double)z + 1, 0.3);

                    xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(color, 2));
                }
            }

            ScatterSeries3D.DataSeries = xyzDataSeries3D;
        }
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>()
            {
                SeriesName = "Colorful Bubble!"
            };

            const int count = 250;

            var random = new Random(0);

            for (var i = 0; i < count; i++)
            {
                var x = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                var y = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                var z = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);

                // Scale is a multiplier used to increase/decrease ScatterRenderableSeries3D.ScatterPointSize
                var scale = (float)((random.NextDouble() + 0.5) * 3.0);

                // Color is applied to PointMetadata3D and overrides the default ScatterRenderableSeries.Stroke property
                Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));

                // To declare scale and colour, add a VertextData class as the w (fourth) parameter.
                // The PointMetadata3D class also has other properties defining the behaviour of the XYZ point
                xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(randomColor, scale));
            }

            ScatterSeries3D.DataSeries = xyzDataSeries3D;

            PointMarkerCombo.SelectedIndex = 0;
        }
Exemple #7
0
        private void OnStart()
        {
            //StartButton.IsChecked = true;
            //PauseButton.IsChecked = false;
            //ResetButton.IsChecked = false;

            //if (ScatterRenderableSeries3D.DataSeries == null)
            // {
            _xyzData = new XyzDataSeries3D <double>();
            ScatterRenderableSeries3D.DataSeries = _xyzData;
            //}

            //if (_timer == null)
            //{
            //    _timer = new System.Timers.Timer(50);
            //     _timer.Elapsed += OnTimerTick;
            // }

            //  _timer.Start();

            // First load, fill with some random values
            if (_xyzData.Count == 0)
            {
                for (int i = 0; i < _pointCount; i++)
                {
                    double x = DataManager.Instance.GetGaussianRandomNumber(50, 15);
                    double y = DataManager.Instance.GetGaussianRandomNumber(50, 15);
                    double z = DataManager.Instance.GetGaussianRandomNumber(50, 15);

                    _xyzData.Append(x, y, z);
                }

                return;
            }
        }
Exemple #8
0
        public SelectScatterPoint3DChart()
        {
            InitializeComponent();

            XAx.VisibleRange = new DoubleRange(0, 10);
            YAx.VisibleRange = new DoubleRange(-10, 10);
            ZAx.VisibleRange = new DoubleRange(1000, 10000);

            _xyzDataSeries3D = new XyzDataSeries3D <double>();

            _xyzDataSeries3D.DataSeriesChanged += OnScatterDataChanged;

            for (int i = 0; i < 300; i++)
            {
                double x = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                double y = DataManager.Instance.GetGaussianRandomNumber(0.0, 5.0);
                double z = DataManager.Instance.GetGaussianRandomNumber(5500, 1500);

                PointMetadata3D vertex = new PointMetadata3D(Colors.Coral, 10);

                _xyzDataSeries3D.Append(x, y, z, vertex);
            }

            renderableSeries3D.DataSeries = _xyzDataSeries3D;
            sciChartSurface.ZoomExtents();
        }
        private void Initialize()
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            for (int i = 0, pointIndex = 0; i < Count; i++)
            {
                var m1 = _random.Next(2) == 0 ? -1 : 1;
                var m2 = _random.Next(2) == 0 ? -1 : 1;
                var x1 = _random.NextDouble() * m1;
                var x2 = _random.NextDouble() * m2;

                if (x1 * x1 + x2 * x2 > 1)
                {
                    continue;
                }

                var x = 2 * x1 * Math.Sqrt(1 - x1 * x1 - x2 * x2);
                var y = 2 * x2 * Math.Sqrt(1 - x1 * x1 - x2 * x2);
                var z = 1 - 2 * (x1 * x1 + x2 * x2);

                // Append an XYZ Point with random color
                // Set the PointMetadata.Tag which we bind to in the View
                xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(GetRandomColor(), 3.0f, false,
                                                                    string.Format("PointMetadata Index {0}", ++pointIndex)));
            }

            SciChart.RenderableSeries[0].DataSeries = xyzDataSeries3D;
        }
Exemple #10
0
        /* Функция построения нормального распределения на ось Y*/
        public static XyzDataSeries3D <double> f_y_Si(double mu, double sigma, double n, List <Point> points)
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();
            var y = mu - sigma * 3;

            for (var i = 0; i < n * 24; i++)
            {
                y += sigma / (n * 4);
                var fY = func_Gauss(y, sigma, mu);
                points.Add(new Point(0, y, fY));
                xyzDataSeries3D.Append(0, fY, y);
            }
            return(xyzDataSeries3D);
        }
        private void Initialize()
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            var currentAngle = 0d;

            for (var i = -SegmentsCount; i < SegmentsCount + 1; i++)
            {
                AddSegment(xyzDataSeries3D, i, currentAngle);
                currentAngle = (currentAngle + _rotationAngle) % 360;
            }

            SciChart.RenderableSeries[0].DataSeries = xyzDataSeries3D;
        }
Exemple #12
0
        /* Функция построения нормального распределения на ось X */
        public static XyzDataSeries3D <double> f_x_Si(double mu, double sigma, double n, List <Point> points)
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();
            var x1 = mu - sigma * 3;

            for (var i = 0; i < n * 24; i++)
            {
                x1 += sigma / (n * 4);
                var fX = func_Gauss(x1, sigma, mu);
                points.Add(new Point(x1, 0, fX));
                xyzDataSeries3D.Append(x1, fX, 0);
            }
            return(xyzDataSeries3D);
        }
Exemple #13
0
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            xyzDataSeries3D  = new XyzDataSeries3D <double>();
            xyzDataSeries3D2 = new XyzDataSeries3D <double>();
            xyzDataSeries3D3 = new XyzDataSeries3D <double>();


            //xyzDataSeries3D.Append(-100, -100, -100);
            // xyzDataSeries3D.Append(1000, 1000, 1000);

            ScatterSeries3D.DataSeries  = xyzDataSeries3D;
            ScatterSeries3D2.DataSeries = xyzDataSeries3D2;
            ScatterSeries3D3.DataSeries = xyzDataSeries3D3;

            PointMarkerCombo.SelectedIndex = 0;
        }
Exemple #14
0
        public void Init(int row, int col)
        {
            xSize = row;
            zSize = col;
            yMax  = float.MinValue;

            if (positionInfo == null)
            {
                positionInfo = new List <PositionInfo>();
            }
            else
            {
                positionInfo.Clear();
            }

            if (drawInfo == null)
            {
                drawInfo = new List <DrawGeometry>();
            }
            else
            {
                drawInfo.Clear();
            }

            if (MeshDataSeries == null)
            {
                MeshDataSeries = new UniformGridDataSeries3D <double, double, double>(xSize, zSize);
            }
            else
            {
                MeshDataSeries.Clear();
            }

            if (marker == null)
            {
                marker = new XyzDataSeries3D <double>();
                marker.DataSeriesChanged += OnScatterSelected;
            }
            else
            {
                marker.Clear();
            }

            movePoint   = false;
            annotIdx    = -1; // 0 base
            selectedIdx = -1;
        }
        private void ButtonClicked()
        {
            XyzDataSeries3D <double> xyzDataSeries3D = new XyzDataSeries3D <double>()
            {
                SeriesName = "Colorful Bubble!"
            };
            var random = new Random(0);
            int index_x = 0, index_y = 0, index_z = 0;
            int counter = 0;

            foreach (var name in m_featuresNames)
            {
                if (name == m_feature1)
                {
                    index_x = counter;
                }
                if (name == m_feature2)
                {
                    index_y = counter;
                }
                if (name == m_feature3)
                {
                    index_z = counter;
                }
                counter++;
            }

            if (m_feature1 != "" && m_feature2 != "" && m_feature3 != "")
            {
                foreach (var f_list in m_featuresList)
                {
                    var x = f_list[index_x];
                    var y = f_list[index_y];
                    var z = f_list[index_z];

                    Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));
                    var   scale       = (float)(m_dataSize);

                    xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(randomColor, scale));
                }
            }

            m_createLine3DChartViewmodel.DataSeriesCommand = xyzDataSeries3D;

            FeaturesNames = m_featuresNames;
        }
        public static XyzDataSeries3D <TX, TY, TZ> ToXyzDataSeries3D <TX, TY, TZ>(this BaseGridDataSeries3D <TX, TY, TZ> gridDataSeries)
            where TX : IComparable
            where TY : IComparable
            where TZ : IComparable
        {
            var xyzDataSeries = new XyzDataSeries3D <TX, TY, TZ>();

            for (int x = 0; x < gridDataSeries.XSize; x++)
            {
                for (int z = 0; z < gridDataSeries.ZSize; z++)
                {
                    xyzDataSeries.Append(gridDataSeries.GetX(x), gridDataSeries[z, x], gridDataSeries.GetZ(z), new PointMetadata3D(null, 1F, false));
                }
            }

            return(xyzDataSeries);
        }
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            for (var i = 0; i < Count; i++)
            {
                var x = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                var y = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                var z = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);

                xyzDataSeries3D.Append(x, y, z);
            }

            ScatterSeries3D.DataSeries = xyzDataSeries3D;

            PointMarkerCombo.SelectedIndex = 0;
        }
Exemple #18
0
 public void ClearPoints(int index = 0)
 {
     if (index == 0)
     {
         xyzDataSeries3D            = new XyzDataSeries3D <double>();
         ScatterSeries3D.DataSeries = xyzDataSeries3D;
     }
     else if (index == 1)
     {
         xyzDataSeries3D             = new XyzDataSeries3D <double>();
         ScatterSeries3D2.DataSeries = xyzDataSeries3D;
     }
     else
     {
         xyzDataSeries3D             = new XyzDataSeries3D <double>();
         ScatterSeries3D3.DataSeries = xyzDataSeries3D;
     }
 }
        public ChangePropertiesDynamicallyViewModel()
        {
            var xyzData = new XyzDataSeries3D <double>();

            Enumerable.Range(0, 10).ForEachDo(x => xyzData.Append(x, x, x));
            _series.Add(new ScatterRenderableSeries3DViewModel()
            {
                DataSeries  = xyzData,
                PointMarker = new SpherePointMarker3D()
                {
                    Width = 5, Height = 5
                },
                Stroke = Colors.Green,
            });

            ChartTitle = "This is a test to see if binding works, yes it does";
            AxisTitle  = "An Axis";
        }
        public XyzDataSeries3D <double> GetPointLineDataSeries()
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            var random = new Random(0);

            for (var i = 0; i < 100; i++)
            {
                var x = 5 * Math.Sin(i);
                var y = i;
                var z = 5 * Math.Cos(i);

                Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));
                var   scale       = (float)((random.NextDouble() + 0.5) * 3.0);

                xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(randomColor, scale));
            }

            return(xyzDataSeries3D);
        }
        private void OnStart()
        {
            StartButton.IsChecked = true;
            PauseButton.IsChecked = false;
            ResetButton.IsChecked = false;

            if (ScatterRenderableSeries3D.DataSeries == null)
            {
                _xyzData = new XyzDataSeries3D <double>();
                ScatterRenderableSeries3D.DataSeries = _xyzData;
            }

            if (_timer == null)
            {
                _timer          = new Timer(16);
                _timer.Elapsed += OnTimerTick;
            }

            _timer.Start();
        }
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            var random = new Random(0);

            for (var i = 0; i < Count; i++)
            {
                var x = 5 * Math.Sin(i);
                var y = i;
                var z = 5 * Math.Cos(i);

                Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));
                var   scale       = (float)((random.NextDouble() + 0.5) * 3.0);

                xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(randomColor, scale));
            }

            PointLineSeries3D.DataSeries = xyzDataSeries3D;
        }
        public XyzDataSeries3D <double> GetImpulseDataSeries()
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            for (var i = 1; i < 15; i++)
            {
                for (var j = 1; j <= 15; j++)
                {
                    if (i != j && i % 3 == 0 && j % 3 == 0)
                    {
                        var y = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);

                        var randomColor = Color.FromArgb(0xFF, (byte)_random.Next(0, 255), (byte)_random.Next(0, 255), (byte)_random.Next(0, 255));

                        xyzDataSeries3D.Append(i, y, j, new PointMetadata3D(randomColor));
                    }
                }
            }

            return(xyzDataSeries3D);
        }
Exemple #24
0
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            for (var i = 1; i < Count; i++)
            {
                for (var j = 1; j <= Count; j++)
                {
                    if (i != j && i % 3 == 0 && j % 3 == 0)
                    {
                        var y = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);

                        var randomColor = Color.FromArgb(0xFF, (byte)_random.Next(0, 255), (byte)_random.Next(0, 255), (byte)_random.Next(0, 255));

                        xyzDataSeries3D.Append(i, y, j, new PointMetadata3D(randomColor));
                    }
                }
            }

            SciChart.RenderableSeries[0].DataSeries = xyzDataSeries3D;
        }
Exemple #25
0
 public OpticalFlowServer(Canvas canvasIn,
                          RichTextBox windowConsole, int port_Number, string IP,
                          IXyDataSeries <float, float>[] worldAcc,
                          IXyDataSeries <float, float>[] deviceAcc,
                          IXyDataSeries <float, float>[] worldVel,
                          IXyDataSeries <float, float>[] deviceVel,
                          IXyDataSeries <float, float>[] realSenseVel,
                          XyzDataSeries3D <double> positionDataSeries,
                          XyzDataSeries3D <double> realSensePositionVec)
 {
     this.worldAcc             = worldAcc;
     this.deviceAcc            = deviceAcc;
     this.worldVel             = worldVel;
     this.deviceVel            = deviceVel;
     this.realSenseVel         = realSenseVel;
     this.positionVec          = positionDataSeries;
     this.realSensePositionVec = realSensePositionVec;
     this.windowConsole        = windowConsole;
     this.PORT_NO   = port_Number;
     this.SERVER_IP = IP;
     this.canvas    = canvasIn;
 }
Exemple #26
0
 public void AddPoint(double x, double y, double z, int index = 0)
 {
     if (index == 0)
     {
         xyzDataSeries3D = (XyzDataSeries3D <double>)ScatterSeries3D.DataSeries;
         xyzDataSeries3D.Append(x, y, z);
         ScatterSeries3D.DataSeries = xyzDataSeries3D;
         //Console.WriteLine($"Count = {xyzDataSeries3D.Count}");
     }
     else if (index == 1)
     {
         xyzDataSeries3D = (XyzDataSeries3D <double>)ScatterSeries3D2.DataSeries;
         xyzDataSeries3D.Append(x, y, z);
         ScatterSeries3D2.DataSeries = xyzDataSeries3D;
     }
     else
     {
         xyzDataSeries3D = (XyzDataSeries3D <double>)ScatterSeries3D3.DataSeries;
         xyzDataSeries3D.Append(x, y, z);
         ScatterSeries3D3.DataSeries = xyzDataSeries3D;
     }
 }
        private void Initialize()
        {
            var xyzDataSeries3D = new XyzDataSeries3D <double>();

            for (var i = 0; i < Count; i++)
            {
                var m1 = _random.Next(2) == 0 ? -1 : 1;
                var m2 = _random.Next(2) == 0 ? -1 : 1;
                var x1 = _random.NextDouble() * m1;
                var x2 = _random.NextDouble() * m2;

                if (x1 * x1 + x2 * x2 < 1)
                {
                    var x = 2 * x1 * Math.Sqrt(1 - x1 * x1 - x2 * x2);
                    var y = 2 * x2 * Math.Sqrt(1 - x1 * x1 - x2 * x2);
                    var z = 1 - 2 * (x1 * x1 + x2 * x2);

                    xyzDataSeries3D.Append(x, y, z);
                }
            }

            SciChart.RenderableSeries[0].DataSeries = xyzDataSeries3D;
        }
        private void AddSeriesButton_OnClick(object sender, RoutedEventArgs e)
        {
            if (sciChart.RenderableSeries.Count >= MaxSeriesAmount)
            {
                return;
            }

            var renderSerias    = new ScatterRenderableSeries3D();
            var xyzDataSeries3D = new XyzDataSeries3D <double>()
            {
                SeriesName = "Series " + ++_currentSeries
            };

            int dataPointsCount = 15;
            var random          = new Random(0);

            for (int i = 0; i < dataPointsCount; i++)
            {
                double x = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                double y = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);
                double z = DataManager.Instance.GetGaussianRandomNumber(5, 1.5);

                // Scale is a multiplier used to increase/decrease ScatterRenderableSeries3D.ScatterPointSize
                float scale = (float)((random.NextDouble() + 0.5) * 3.0);

                // Color is applied to PointMetadata3D and overrides the default ScatterRenderableSeries.Stroke property
                Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));

                // To declare scale and colour, add a VertextData class as the w (fourth) parameter.
                // The PointMetadata3D class also has other properties defining the behaviour of the XYZ point
                xyzDataSeries3D.Append(x, y, z, new PointMetadata3D(randomColor, scale));
            }

            var randomPicker = new Random();
            int randValue    = randomPicker.Next(0, 6);

            switch (randValue)
            {
            case 0:
                renderSerias.PointMarker = new CubePointMarker3D();
                break;

            case 1:
                renderSerias.PointMarker = new EllipsePointMarker3D();
                break;

            case 2:
                renderSerias.PointMarker = new PyramidPointMarker3D();
                break;

            case 3:
                renderSerias.PointMarker = new QuadPointMarker3D();
                break;

            case 4:
                renderSerias.PointMarker = new SpherePointMarker3D();
                break;

            case 5:
                renderSerias.PointMarker = new TrianglePointMarker3D();
                break;
            }

            renderSerias.DataSeries = xyzDataSeries3D;
            sciChart.RenderableSeries.Add(renderSerias);

            var index = sciChart.RenderableSeries.IndexOf(renderSerias);

            xyzDataSeries3D.SeriesName = String.Format("Series #{0}", index);

            OnPropertyChanged("CanAddSeries");
            OnPropertyChanged("CanRemoveSeries");

            sciChart.ZoomExtents();
        }
Exemple #29
0
        public MainWindow()
        {
            InitializeComponent();

            SERVER_IP = GetAddresses()[0];

            UpdateText("Starting server on IP Address: " + SERVER_IP);

            // Write the SDP FILE.
            string lines = "First line.\r\nSecond line.\r\nThird line.";

            // Write the string to a file.
            System.IO.StreamWriter file = new System.IO.StreamWriter(".\\videoDescription.sdp");
            file.WriteLine(contents);

            file.Close();



            var currentAssembly  = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
            // Default installation path of VideoLAN.LibVLC.Windows
            var libDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));


            vlcPlayer.SourceProvider.CreatePlayer(libDirectory, new string[] { "--network-caching=0", "--clock-jitter=0", "clock-syncro=0" } /* pass your player parameters here */);
            vlcPlayer.SourceProvider.MediaPlayer.Play(new FileInfo(".\\videoDescription.sdp"));

            //OpticalFlowServer.startServer(null);
            this.Loaded += OnLoaded;

            xWorldAcc = new XyDataSeries <float, float>();
            yWorldAcc = new XyDataSeries <float, float>();
            zWorldAcc = new XyDataSeries <float, float>();

            xDeviceAcc = new XyDataSeries <float, float>();
            yDeviceAcc = new XyDataSeries <float, float>();
            zDeviceAcc = new XyDataSeries <float, float>();

            xWorldVel = new XyDataSeries <float, float>();
            yWorldVel = new XyDataSeries <float, float>();
            zWorldVel = new XyDataSeries <float, float>();

            xDeviceVel = new XyDataSeries <float, float>();
            yDeviceVel = new XyDataSeries <float, float>();
            zDeviceVel = new XyDataSeries <float, float>();

            xRealVel = new XyDataSeries <float, float>();
            yRealVel = new XyDataSeries <float, float>();
            zRealVel = new XyDataSeries <float, float>();

            positionVec          = new XyzDataSeries3D <double>();
            realSensePositionVec = new XyzDataSeries3D <double>();


            //a.Move((int)(myCanvas.Width/2), (int)(myCanvas.Height/2));

            udpServer = new OpticalFlowServer(optiflowCanvas, consoleOutput, PORT_NO, SERVER_IP,
                                              new IXyDataSeries <float, float>[] { xWorldAcc, yWorldAcc, zWorldAcc },
                                              new IXyDataSeries <float, float>[] { xDeviceAcc, yDeviceAcc, zDeviceAcc },
                                              new IXyDataSeries <float, float>[] { xWorldVel, yWorldVel, zWorldVel },
                                              new IXyDataSeries <float, float>[] { xDeviceVel, yDeviceVel, zDeviceVel },
                                              new IXyDataSeries <float, float>[] { xRealVel, yRealVel, zRealVel },
                                              positionVec,
                                              realSensePositionVec);


            Thread test = new Thread(new ThreadStart(udpServer.startServer));

            test.Start();
        }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            var xyzDataSeries3D1 = new XyzDataSeries3D <double>();
            var xyzDataSeries3D2 = new XyzDataSeries3D <double>();

            _n1 = 0;
            _n2 = 0;
            var    mu1X    = 0.0;
            var    mu1Y    = 0.0;
            var    mu2X    = 0.0;
            var    mu2Y    = 0.0;
            var    sigma1X = 0.0;
            var    sigma1Y = 0.0;
            var    sigma2X = 0.0;
            var    sigma2Y = 0.0;
            var    eps     = 0.01;
            string inputBuffer;

            try
            {
                // ввод исходных данных
                inputBuffer = TextBox.Text;
                _n1         = Convert.ToInt32(inputBuffer);
                inputBuffer = TextBox1.Text;
                _n2         = Convert.ToInt32(inputBuffer);
                inputBuffer = TextBox2.Text;
                mu1X        = Convert.ToDouble(inputBuffer);
                inputBuffer = TextBox3.Text;
                mu1Y        = Convert.ToDouble(inputBuffer);
                inputBuffer = TextBox4.Text;
                mu2X        = Convert.ToDouble(inputBuffer);
                inputBuffer = TextBox5.Text;
                mu2Y        = Convert.ToDouble(inputBuffer);
                inputBuffer = TextBox6.Text;
                sigma1X     = Convert.ToDouble(inputBuffer);
                inputBuffer = TextBox7.Text;
                sigma1Y     = Convert.ToDouble(inputBuffer);
                inputBuffer = TextBox8.Text;
                sigma2X     = Convert.ToDouble(inputBuffer);
                inputBuffer = TextBox9.Text;
                sigma2Y     = Convert.ToDouble(inputBuffer);
                inputBuffer = TextBox24.Text;
                eps         = Convert.ToDouble(inputBuffer);
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            List <Point> setP1;
            List <Point> setP2;
            var          normRand = new NormalRandom();
            var          set1     = new SetPoint(mu1X, sigma1X, mu1Y, sigma1Y, _n1, normRand);
            var          set2     = new SetPoint(mu2X, sigma2X, mu2Y, sigma2Y, _n2, normRand);

            setP1 = set1.get_list_point();
            setP2 = set2.get_list_point();
            var ro1 = MathTpr.CalculationOfCorrelationCoefficient(setP1, mu1X, mu1Y, sigma1X, sigma1X);
            var ro2 = MathTpr.CalculationOfCorrelationCoefficient(setP2, mu2X, mu2Y, sigma2X, sigma2X);

            // определение фактических значений мат. ожиданий и среднеквадратических отклонений
            _averageX1 = set1.calculate_Average_Value_x();
            _averageY1 = set1.calculate_Average_Value_y();
            _averageX2 = set2.calculate_Average_Value_x();
            _averageY2 = set2.calculate_Average_Value_y();
            _sigmaX1   = Math.Sqrt(MathTpr.DispersionX(setP1, _averageX1));
            _sigmaY1   = Math.Sqrt(MathTpr.DispersionY(setP1, _averageY1));
            _sigmaX2   = Math.Sqrt(MathTpr.DispersionX(setP2, _averageX2));
            _sigmaY2   = Math.Sqrt(MathTpr.DispersionY(setP2, _averageY2));

            // построение точек на плоскости XY
            foreach (var item in setP1)
            {
                var x = item.X;
                var z = item.Y;
                item.Z = MathTpr.func_Gauss_XY(item.X, item.Y, sigma1X, sigma1Y, mu1X, mu1Y, ro1);
                var y = 0;
                xyzDataSeries3D1.Append(x, y, z);
            }
            foreach (var item in setP2)
            {
                var x = item.X;
                var z = item.Y;
                item.Z = MathTpr.func_Gauss_XY(item.X, item.Y, sigma2X, sigma2Y, mu2X, mu2Y, ro2);
                var y = 0;
                xyzDataSeries3D2.Append(x, y, z);
            }
            xyzDataSeries3D1.SeriesName = "S1";
            xyzDataSeries3D2.SeriesName = "S2";

            PointGrid.DataContext     = setP1;
            PointGridCopy.DataContext = setP2;

            if (_graph != null)
            {
                _graph = new _3DGraph {
                    Visibility = Visibility.Visible
                };
            }
            // создание формы с графиком
            _graph?.PaintGraph(set1, set2, sigma1X, sigma1Y, mu1X,
                               mu1Y, mu2X, mu2Y, sigma2X, sigma2Y, _n1, _n2);
        }