コード例 #1
0
ファイル: Test3.xaml.cs プロジェクト: csunking/CSharp3DChart
        void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (coeffWidth > 2)
            {
                coeffWidth = 0.1;
            }

            DataGenerator gen = new DataGenerator();

            coeffWidth         += 0.1;
            gen.MouthWidthcoeff = coeffWidth;



            this.Dispatcher.BeginInvoke(new Action(() =>
            {
                Surface3D curve3D = new Surface3D();

                newCurveModel = curve3D.CreateSurfaceModel(gen.GenerateData(Convert.ToInt32(this.textBox1.Text)));
                this.viewPort.Children.Remove(curveModel);
                this.viewPort.Children.Remove(wireframe);
                this.viewPort.Children.Add(newCurveModel);
                curveModel = newCurveModel;
            }));
        }
コード例 #2
0
ファイル: Test3.xaml.cs プロジェクト: csunking/CSharp3DChart
        void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            if (coeffWidth > 2)
            {
                coeffWidth = 0.1;
            }

            this.viewPort.Children.Remove(curveModel);
            this.viewPort.Children.Remove(pntsModel);
            this.viewPort.Children.Remove(wireframe);


            DataGenerator gen = new DataGenerator();

            coeffWidth         += 0.1;
            gen.MouthWidthcoeff = coeffWidth;

            //if (!dicPoints.ContainsKey(gen.MouthWidthcoeff))
            //    dicPoints.Add(gen.MouthWidthcoeff, gen.GenerateData(Convert.ToDouble(this.textBox1.Text)));

            Surface3D curve3D = new Surface3D();

            Data = gen.GenerateData(Convert.ToInt32(this.textBox1.Text));
            AutoAdjustCoordinate();

            curveModel = curve3D.CreateSurfaceModel(Data);

            pntsModel = curve3D.CreateSurfacePoints(Data);

            if (!showPoints)
            {
                this.viewPort.Children.Add(curveModel);
                wireframe.MakeWireframe(curveModel.Content);
                this.viewPort.Children.Add(wireframe);
                wireframe.OnRender(null, null);
            }
            if (showPoints)
            {
                this.viewPort.Children.Add(pntsModel);
            }



            this.textBlock1.Text = this.watch.ElapsedMilliseconds.ToString();
            this.watch.Reset();
            this.watch.Start();
        }