Exemplo n.º 1
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // reduce flicker

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            CreateCube();

            TheCube = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone();             // recopy original object
            point1  = (ThreeDPoint)((ICloneable)point1or).Clone();
            point2  = (ThreeDPoint)((ICloneable)point2or).Clone();
            timer1.Start();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            point.Scale(100);
            point.Translate(new float[] { 150, 150, 0 });
            point1.Scale(100);
            point1.Translate(new float[] { 150, 150, 0 });
            point2.Scale(100);
            point2.Translate(new float[] { 150, 150, 0 });
            createNetwork();
            point1or = (ThreeDPoint)((ICloneable)point1).Clone();
            point2or = (ThreeDPoint)((ICloneable)point2).Clone();
        }
Exemplo n.º 2
0
        private void CreateCube()
        {
            TheCube.AddPolygon(new ThreeDPoint[] {
                new ThreeDPoint(0, 0, 0),
                new ThreeDPoint(0, 1, 0),
                new ThreeDPoint(1, 1, 0),
                new ThreeDPoint(1, 0, 0),
                new ThreeDPoint(0, 0, 0)
            });


            TheCube.AddPolygon(new ThreeDPoint[] {
                new ThreeDPoint(0, 0, 0),
                new ThreeDPoint(0, 0, 1),
                new ThreeDPoint(0, 1, 1),
                new ThreeDPoint(0, 1, 0),
                new ThreeDPoint(0, 0, 0)
            });

            TheCube.AddPolygon(new ThreeDPoint[] {
                new ThreeDPoint(0, 0, 0),
                new ThreeDPoint(0, 0, 1),
                new ThreeDPoint(1, 0, 1),
                new ThreeDPoint(1, 0, 0),
                new ThreeDPoint(0, 0, 0)
            });



            TheCube.AddPolygon(new ThreeDPoint[] {
                new ThreeDPoint(1, 1, 0),
                new ThreeDPoint(1, 1, 1),
                new ThreeDPoint(0, 1, 1),
                new ThreeDPoint(0, 1, 0),
                new ThreeDPoint(1, 1, 0)
            });

            TheCube.AddPolygon(new ThreeDPoint[] {
                new ThreeDPoint(1, 0, 0),
                new ThreeDPoint(1, 0, 1),
                new ThreeDPoint(1, 1, 1),
                new ThreeDPoint(1, 1, 0),
                new ThreeDPoint(1, 0, 0)
            });

            TheCube.AddPolygon(new ThreeDPoint[] {
                new ThreeDPoint(0, 0, 1f),
                new ThreeDPoint(0, 1, 1f),
                new ThreeDPoint(1, 1, 1f),
                new ThreeDPoint(1, 0, 1f),
                new ThreeDPoint(0, 0, 1f)
            });



            TheCube.Scale(100);
            TheCube.Translate(new float[] { 150, 150, 0 });
            TheCubeOriginal = (ThreeDObject)((ICloneable)TheCube).Clone();
        }
Exemplo n.º 3
0
 private void button6_Click(object sender, EventArgs e)
 {
     TheCube = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone(); // recopy original object
     TheCube.SortPolygonsInZOrder();
     TheCube.RotateAtXNegative(TheCube.GetCenter(), AngleCount);
     AngleCount += 20;
     Invalidate();
 }
Exemplo n.º 4
0
 public void topView()
 {
     TheCube = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone(); // recopy original object
     //TheCube.SortPolygonsInZOrder();
     TheCube.RotateAtX(TheCube.GetCenter(), AngleCount);
     AngleCount += 20;
     Invalidate();
 }
Exemplo n.º 5
0
 private void button1_Click_1(object sender, System.EventArgs e)
 {
     TheCube = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone();             // recopy original object
     TheCube.SortPolygonsInZOrder();
     TheCube.RotateAt(TheCube.GetCenter(), AngleCount);
     AngleCount += 1;
     Invalidate();
 }
Exemplo n.º 6
0
        object ICloneable.Clone()
        {
            ThreeDObject copyObject = new ThreeDObject();

            for (int i = 0; i < Polygons.Count; i++)
            {
                copyObject.AddPolygon((ThreeDPolygon)(((ICloneable)Polygons[i]).Clone()));
            }

            return(copyObject);
        }
Exemplo n.º 7
0
 private void button3_Click(object sender, EventArgs e)
 {
     TheCube = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone(); // recopy original object
     point1  = (ThreeDPoint)((ICloneable)point1or).Clone();
     point2  = (ThreeDPoint)((ICloneable)point2or).Clone();
     TheCube.SortPolygonsInZOrder();
     TheCube.RotateAtZ(TheCube.GetCenter(), AngleCount);
     point1.RotateAtZ(TheCube.GetCenter(), AngleCount);
     point2.RotateAtZ(TheCube.GetCenter(), AngleCount);
     AngleCount += 20;
     Invalidate();
 }
Exemplo n.º 8
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // reduce flicker

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            CreateCube();

            TheCube = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone();             // recopy original object


            timer1.Start();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }