Ejemplo n.º 1
0
 private void drawParallelClicked(object sender, EventArgs e)
 {
     if (parallelProjectionAngle_text.Text == String.Empty)
     {
         return;
     }
     this.lastClicked = 2;
     init();
     Draw3d.drawParallel(this, this.polygonList);
 }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 private void scaleDownBtn_Click(object sender, EventArgs e)
 {
     Draw3d.scale(this, this.polygonList, 0.8);
 }
Ejemplo n.º 6
0
 private void scaleUpBtn_Click(object sender, EventArgs e)
 {
     Draw3d.scale(this, this.polygonList, 1.2);
 }
Ejemplo n.º 7
0
 private void drawObliqueClicked(object sender, EventArgs e)
 {
     this.lastClicked = 3;
     init();
     Draw3d.drawOblique(this, this.polygonList);
 }
Ejemplo n.º 8
0
 private void drawButton_Click(object sender, EventArgs e)
 {
     this.lastClicked = 1;
     init();
     Draw3d.drawPrespective(this, this.polygonList);
 }