示例#1
0
        private void AutoAdjustCoordinate()
        {
            this.viewPort.Children.Remove(axisVisual3D);

            NumericTicksProider numericProvider = new NumericTicksProider(6, 4, 0.2, 0.1);

            numericProvider.LabelStringFormat = "{0:0.00}";

            var axis = new AxisGridBuilder();

            axis.TicksProvider = numericProvider;

            //int x = Data.GetLength(0);
            axis.XRange = new Range <double>(-2, 2);

            //int y = Data.GetLength(1);
            axis.YRange = new Range <double>(-2, 2);

            axis.ZRange = CreateRangeOfZAxis();

            if (!showPoints)
            {
                this.axisVisual3D = axis.DrawAxisGrid();
                this.viewPort.Children.Add(this.axisVisual3D);
            }

            for (int i = 0; i <= Data.GetUpperBound(0); i++)
            {
                for (int j = 0; j <= Data.GetUpperBound(1); j++)
                {
                    Data[i, j] = axis.DataToAxisTransform.Transform(Data[i, j]);
                }
            }
        }
示例#2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                timer.Interval = 2000;
                timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);

                dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
                dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);
                //dispatcherTimer.Start();

                Surface3D curve3D = new Surface3D();

                NumericTicksProider numericProvider = new NumericTicksProider(6, 4, 0.2, 0.1);
                numericProvider.LabelStringFormat = "{0:0.00}";

                var axis = new AxisGridBuilder();
                axis.TicksProvider = numericProvider;
                axis.XRange        = new Range <double>(0, 5);
                axis.YRange        = new Range <double>(0, 5);
                axis.ZRange        = new Range <double>(0, 5);

                axisVisual3D = axis.DrawAxisGrid();
                this.viewPort.Children.Add(axisVisual3D);

                axisFrame = new AxisGridFrame();
                if (showPoints)
                {
                    this.viewPort.Children.Add(axisFrame);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }