コード例 #1
0
ファイル: Form1.cs プロジェクト: gabrielrosinski/Graphics3
 private void drawParallelClicked(object sender, EventArgs e)
 {
     if (parallelProjectionAngle_text.Text == String.Empty)
     {
         return;
     }
     this.lastClicked = 2;
     init();
     Draw3d.drawParallel(this, this.polygonList);
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: gabrielrosinski/Graphics3
        private void rotateZButton_Click(object sender, EventArgs e)
        {
            if (rotationAngle.Text == String.Empty)
            {
                return;
            }
            Point3D center = new Point3D(centerPoint.x, centerPoint.y, centerPoint.z);

            holderCenter = center;
            Draw3d.rotateZAxis(this, polygonList, int.Parse(rotationAngle.Text));
            clearScreen();
            tempPaint();
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: gabrielrosinski/Graphics3
 public void tempPaint()
 {
     if (this.lastClicked == 1)
     {
         Draw3d.drawPrespective(this, this.polygonList);
     }
     else if (this.lastClicked == 2)
     {
         Draw3d.drawParallel(this, this.polygonList);
     }
     else if (this.lastClicked == 3)
     {
         Draw3d.drawOblique(this, this.polygonList);
     }
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: gabrielrosinski/Graphics3
        private void init()
        {
            if (graphics != null)
            {
                graphics.Dispose();
                graphics = Canvas.CreateGraphics();
            }
            BVisible.Checked = false;
            if (graphics == null)
            {
                graphics = Canvas.CreateGraphics();
            }
            this.Size = new Size(1500, 700);

            pen = new Pen(Color.Black, 2);

            //clear the polygon list
            polygonList = new List <Polygon>();

            this.centerPoint = new Point3D(this.Canvas.Size.Width / 2, this.Canvas.Size.Height / 2, 350);

            //init polygons
            var polygonPointsDict = new Dictionary <string, Point3D[]> {
                //Cube polygons

                { "polygon1", new[] {
                      new Point3D(350, 150, 150),
                      new Point3D(350, 250, 150),
                      new Point3D(450, 250, 150),
                      new Point3D(450, 150, 150),
                  } }
                , { "polygon2", new[] {
                        new Point3D(350, 150, 250),
                        new Point3D(450, 150, 250),
                        new Point3D(450, 250, 250),
                        new Point3D(350, 250, 250)
                    } }
                , { "polygon3", new[] {
                        new Point3D(350, 150, 150),
                        new Point3D(350, 150, 250),
                        new Point3D(350, 250, 250),
                        new Point3D(350, 250, 150)
                    } }
                , { "polygon4", new[] {
                        new Point3D(450, 250, 250),
                        new Point3D(450, 150, 250),
                        new Point3D(450, 150, 150),
                        new Point3D(450, 250, 150),
                    } }
                , { "polygon5", new[] {
                        new Point3D(350, 150, 250),
                        new Point3D(350, 150, 150),
                        new Point3D(450, 150, 150),
                        new Point3D(450, 150, 250),
                    } }
                , { "polygon6", new[] {
                        new Point3D(350, 250, 250),
                        new Point3D(450, 250, 250),
                        new Point3D(450, 250, 150),
                        new Point3D(350, 250, 150),
                    } }

                //Pyramid polygons
                , { "polygon7", new[] {
                        new Point3D(550, 250, 150),
                        new Point3D(650, 250, 150),
                        new Point3D(600, 150, 200)
                    } }
                , { "polygon8", new[] {
                        new Point3D(550, 250, 250),
                        new Point3D(600, 150, 200),
                        new Point3D(650, 250, 250)
                    } }
                , { "polygon9", new[] {
                        new Point3D(550, 250, 250),
                        new Point3D(550, 250, 150),
                        new Point3D(600, 150, 200)
                    } }
                , { "polygon10", new[] {
                        new Point3D(650, 250, 250),
                        new Point3D(600, 150, 200),
                        new Point3D(650, 250, 150)
                    } }
            };

            //Create polygons from points3D arraya
            foreach (string key in polygonPointsDict.Keys)
            {
                dynamic pointsArray = polygonPointsDict[key];

                polygonList.Add(new Polygon(pointsArray));
            }
            Draw3d.getCenter(this);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: gabrielrosinski/Graphics3
 private void scaleDownBtn_Click(object sender, EventArgs e)
 {
     Draw3d.scale(this, this.polygonList, 0.8);
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: gabrielrosinski/Graphics3
 private void scaleUpBtn_Click(object sender, EventArgs e)
 {
     Draw3d.scale(this, this.polygonList, 1.2);
 }
コード例 #7
0
ファイル: Form1.cs プロジェクト: gabrielrosinski/Graphics3
 private void drawObliqueClicked(object sender, EventArgs e)
 {
     this.lastClicked = 3;
     init();
     Draw3d.drawOblique(this, this.polygonList);
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: gabrielrosinski/Graphics3
 private void drawButton_Click(object sender, EventArgs e)
 {
     this.lastClicked = 1;
     init();
     Draw3d.drawPrespective(this, this.polygonList);
 }