Esempio n. 1
0
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            int      w = this.ClientSize.Width;
            int      h = this.ClientSize.Height;

            g.TranslateTransform(80, 140);
            //g.Transform = transform;
            //g.ScaleTransform(zoom, zoom);
            g.ScaleTransform(2, 2);
            g.RotateTransform(rotateAngle);
            g.RotateTransform(rotateAngleLeft);
            foreach (ThreeDPoint item in points)
            {
                g.DrawEllipse(Pens.Red, item.To2D(TheCube.GetCenter()).X - 1, item.To2D(TheCube.GetCenter()).Y - 1, 2F, 2F);
            }
            foreach (KeyValuePair <string, string> item in pointmember)
            {
                ThreeDPoint p1 = getXYZ(item.Key);
                ThreeDPoint p2 = getXYZ(item.Value);
                g.DrawLine(Pens.Black, p1.To2D(TheCube.GetCenter()), p2.To2D(TheCube.GetCenter()));
            }

            TheCubeOriginal = (ThreeDObject)((ICloneable)TheCube).Clone();
        }
Esempio n. 2
0
 public void spinRight()
 {
     TheCube = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone(); // recopy original object
     TheCube.SortPolygonsInZOrder();
     TheCube.RotateAtZNegative(TheCube.GetCenter(), AngleCount);
     AngleCount += 1;
     Invalidate();
 }
Esempio n. 3
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);
        }
Esempio n. 4
0
 public Default()
 {
     InitializeComponent();
     this.pictureBox1.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel);
     points      = new List <ThreeDPoint>(pointsor);
     pointmember = new List <KeyValuePair <string, string> >(pointsmemberOr);
     TheCube     = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone(); // recopy original object
     //points = (List<ThreeDPoint>)((ICloneable)pointsor).Clone();
     ////points2 = (List<ThreeDPoint>)((ICloneable)points2or).Clone();
     //pointmember = (List<KeyValuePair<string, string>>)((ICloneable)pointsmemberOr).Clone();
 }
Esempio n. 5
0
 public void rotateUp()
 {
     TheCube     = (ThreeDObject)((ICloneable)TheCubeOriginal).Clone(); // recopy original object
     points      = new List <ThreeDPoint>(pointsor);
     pointmember = new List <KeyValuePair <string, string> >(pointsmemberOr);
     TheCube.SortPolygonsInZOrder();
     //TheCube.RotateAtXNegative(TheCube.GetCenter(), AngleCount);
     foreach (ThreeDPoint item in points)
     {
         item.RotateAtX(TheCube.GetCenter(), AngleCount);
         AngleCount += 1;
     }
     Invalidate();
 }