Exemple #1
0
        private void DrawCameraFigure()
        {
            g1.Clear(Color.White);
            cam_p = p.DeepCopy();

            cam_p.Move((float)camTranslationX.Value, (float)camTranslationY.Value, (float)camTranslationZ.Value);
            cam_p.RotateX(-(float)camRotationX.Value);
            cam_p.RotateY(-(float)camRotationY.Value);
            cam_p.RotateZ(-(float)camRotationZ.Value);

            cam_p.Draw(g1);

            //cam_p.RotateZ((float)camRotationZ.Value);
            //cam_p.RotateY((float)camRotationY.Value);
            //cam_p.RotateX((float)camRotationX.Value);
            //cam_p.Move(-(float)camTranslationX.Value, -(float)camTranslationY.Value, -(float)camTranslationZ.Value);
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            string   data   = File.ReadAllText(openFileDialog1.FileName);
            Figure3D figure = new Figure3D();

            figure.Sides = new List <Figure>();

            var rows = data.Split('\n');

            foreach (string row in rows)
            {
                string[]        strPoints = row.Split(' ');
                List <PointXYZ> pts       = new List <PointXYZ>();

                if (strPoints.Length > 0)
                {
                    for (int i = 0; i < strPoints.Length - 1; i += 3)
                    {
                        float x, y, z;
                        x = (float)Convert.ToDouble(strPoints[i]);
                        y = (float)Convert.ToDouble(strPoints[i + 1]);
                        z = (float)Convert.ToDouble(strPoints[i + 2]);

                        pts.Add(new PointXYZ(x, y, z));
                    }
                    figure.Sides.Add(new Figure(pts));
                    pts.Clear();
                }
            }
            figure.UpdateCenter();
            g.Clear(Color.White);
            g1.Clear(Color.White);
            p     = figure;
            cam_p = p.DeepCopy();
            p.Draw(g);
            DrawCameraFigure();
        }
Exemple #3
0
        private void draw_btn_Click(object sender, EventArgs e)
        {
            g.Clear(Color.White);
            g1.Clear(Color.White);
            if (radioButton1.Checked)
            {
                p = new Tetrahedron();
            }
            else if (radioButton2.Checked)
            {
                p = new Hexahedron();
            }
            else if (radioButton3.Checked)
            {
                p = new Octahedron();
            }

            cam_p = p.DeepCopy();
            p.Draw(g);
            DrawCameraFigure();
        }