Example #1
0
        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();
        }