Exemplo n.º 1
0
        private void Button3_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();

            form2.ShowDialog();

            var   f             = form2.f;
            float x0            = form2.X0;
            float x1            = form2.X1;
            float y0            = form2.Y0;
            float y1            = form2.Y1;
            int   cnt_of_breaks = form2.Cnt_of_breaks;

            form2.Dispose();

            ReverseFloatComparer fcmp = new ReverseFloatComparer();

            float dx = (Math.Abs(x0) + Math.Abs(x1)) / cnt_of_breaks;
            float dy = (Math.Abs(y0) + Math.Abs(y1)) / cnt_of_breaks;

            List <Face>    faces = new List <Face>();
            List <Point3d> pts0  = new List <Point3d>();
            List <Point3d> pts1  = new List <Point3d>();

            for (float x = x0; x < x1; x += dx)
            {
                for (float y = y0; y < y1; y += dy)
                {
                    float z = f(x, y);
                    pts1.Add(new Point3d(x, y, z));
                }
                if (pts0.Count != 0)
                {
                    for (int i = 1; i < pts0.Count; ++i)
                    {
                        faces.Add(new Face(new List <Point3d>()
                        {
                            new Point3d(pts0[i - 1]), new Point3d(pts1[i - 1]),
                            new Point3d(pts1[i]), new Point3d(pts0[i])
                        }));
                    }
                }
                pts0.Clear();
                pts0 = pts1;
                pts1 = new List <Point3d>();
            }

            g.Clear(Color.White);
            figure = new Polyhedron(faces);
            figure.Apply(Transformation.Scale(5, 5, 5));
            figure.show(g, pr, new_fig);
        }
Exemplo n.º 2
0
        public static Polyhedron CreateIcosahedron()
        {
            Polyhedron Icosahedron = new Polyhedron();

            My_Point[] verts = new My_Point[12];

            // верх и низ
            verts[0] = new My_Point(0, 0, 1);
            verts[1] = new My_Point(0, 0, -1);

            double h = Math.Sqrt(5) / 5;              //0.447
            double R = h / Math.Sin(Math.PI / 5);     //0.76

            // верхний круг
            double angle = 0;

            for (int i = 2; i < 7; ++i)
            {
                verts[i] = new My_Point(R * Math.Sin(angle), R * Math.Cos(angle), h);
                angle   += 72 * Math.PI / 180;               // 180/5 = 72
            }

            // нижний круг
            angle = 36 * Math.PI / 180;
            for (int i = 7; i < 12; ++i)
            {
                verts[i] = new My_Point(R * Math.Sin(angle), R * Math.Cos(angle), -h);
                angle   += 72 * Math.PI / 180;               // 180/5 = 72
            }

            Icosahedron.faces = new Face[20];
            for (int i = 0; i < 4; ++i)
            {
                Icosahedron.faces[2 * i]     = Face.CreateTriangle(verts[0], verts[2 + i], verts[3 + i]);             //Заполнение верхней пирамиды
                Icosahedron.faces[2 * i + 1] = Face.CreateTriangle(verts[1], verts[7 + i], verts[8 + i]);             //Заполенение нижней пирамиды
            }
            Icosahedron.faces[8] = Face.CreateTriangle(verts[0], verts[2], verts[6]);
            Icosahedron.faces[9] = Face.CreateTriangle(verts[1], verts[7], verts[11]);

            for (int i = 0; i < 4; ++i)
            {
                Icosahedron.faces[10 + 2 * i] = Face.CreateTriangle(verts[2 + i], verts[3 + i], verts[7 + i]);
                Icosahedron.faces[11 + 2 * i] = Face.CreateTriangle(verts[7 + i], verts[8 + i], verts[3 + i]);
            }
            Icosahedron.faces[18] = Face.CreateTriangle(verts[6], verts[2], verts[11]);
            Icosahedron.faces[19] = Face.CreateTriangle(verts[11], verts[7], verts[2]);

            Icosahedron.center = new My_Point(0, 0, 0);
            return(Icosahedron);
        }
Exemplo n.º 3
0
        public void make_tetrahedron(Polyhedron cube = null)
        {
            if (cube == null)
            {
                cube = new Polyhedron();
                cube.make_hexahedron();
            }
            Polygon f0 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[0].Points[0]),
                new Point3D(cube.Faces[1].Points[1]),
                new Point3D(cube.Faces[1].Points[3])
            }
                );

            Polygon f1 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[1].Points[3]),
                new Point3D(cube.Faces[1].Points[1]),
                new Point3D(cube.Faces[0].Points[2])
            }
                );

            Polygon f2 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[0].Points[2]),
                new Point3D(cube.Faces[1].Points[1]),
                new Point3D(cube.Faces[0].Points[0])
            }
                );

            Polygon f3 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[0].Points[2]),
                new Point3D(cube.Faces[0].Points[0]),
                new Point3D(cube.Faces[1].Points[3])
            }
                );

            Faces = new List <Polygon> {
                f0, f1, f2, f3
            };
            find_center();
        }
Exemplo n.º 4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                //Tetrahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.make_tetrahedron();
                figure.show(g, projection);
                break;

            case 1:
                //Hexahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.make_hexahedron();
                figure.show(g, projection);
                break;

            case 2:
                //Oktahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.make_octahedron();
                figure.show(g, projection);
                break;

            case 3:
                //Icosahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.make_icosahedron();
                figure.show(g, projection);
                break;

            case 4:
                //Dodecahedron
                g.Clear(Color.White);
                figure = new Polyhedron();
                figure.make_dodecahedron();
                figure.show(g, projection);
                break;

            default:
                break;
            }
        }
Exemplo n.º 5
0
        //Действия
        private void Draw()
        {
            if (polyhedron == null)
            {
                return;
            }
            g.Clear(Color.White);

            My_Point.DrawPoint0(g, Color.LimeGreen);

            Polyhedron proj = polyhedron.Clone() as Polyhedron;

            AffineTransform.IsometricProjection(proj);

            proj.Draw(g, Color.Black);
        }
Exemplo n.º 6
0
        private Polyhedron ParseFileToPolyhedron(string file_content)
        {
            string[] lines = file_content.Split('\n');
            Face[]   faces = new Face[lines.Length];
            for (int i = 0; i < lines.Length; i++)
            {
                faces[i] = ParseLineToFace(lines[i]);
            }
            Polyhedron result = new Polyhedron();

            result.faces = faces;


            double c_x = 0;
            double c_y = 0;
            double c_z = 0;
            int    cnt = 0;

            foreach (Face face in faces)
            {
                foreach (Edge edge in face.Edges)
                {
                    c_x += edge.First.X;
                    c_y += edge.First.Y;
                    c_z += edge.First.Z;

                    c_x += edge.Second.X;
                    c_y += edge.Second.Y;
                    c_z += edge.Second.Z;

                    cnt += 2;
                }
            }
            c_x /= cnt;
            c_y /= cnt;
            c_z /= cnt;
            Point3d center = new Point3d(c_x, c_y, c_z);

            result.center = center;

            return(result);
        }
Exemplo n.º 7
0
        private void buttonGraph_Click(object sender, EventArgs e)
        {
            double[] X = Parse(textBoxGraphX.Text);
            CheckLen(X, 2);
            double[] Y = Parse(textBoxGraphY.Text);
            CheckLen(Y, 2);
            double[] Step = Parse(textBoxGraphStep.Text);
            CheckLen(Step, 1);
            int step = (int)Step[0];

            ph       = new Polyhedron();
            ph.faces = new Face[step * step * 2];
            double   dx  = (X[1] - X[0]) / step;
            double   dy  = (Y[1] - Y[0]) / step;
            delFunct fun = DicFun[comboBoxGraph.SelectedIndex];

            Point3d[,] points = new Point3d[step + 1, step + 1];
            for (int i = 0; i < step + 1; ++i)
            {
                for (int j = 0; j < step + 1; ++j)
                {
                    points[i, j] = new Point3d(X[0] + i * dx, Y[0] + j * dy, fun(X[0] + i * dx, Y[0] + j * dy));
                }
            }

            for (int i = 0; i < step; ++i)
            {
                for (int j = 0; j < step; ++j)
                {
                    ph.faces[2 * (i * step + j)]     = Face.CreateTriangle(points[i, j], points[i, j + 1], points[i + 1, j + 1]);
                    ph.faces[2 * (i * step + j) + 1] = Face.CreateTriangle(points[i, j], points[i + 1, j], points[i + 1, j + 1]);
                }
            }

            ph.center = new Point3d((X[1] - X[0]) / 2, (Y[1] - Y[0]) / 2, fun((X[1] - X[0]) / 2, (Y[1] - Y[0]) / 2));

            Plot();
        }
Exemplo n.º 8
0
        private void buttonZbuffer_Click(object sender, EventArgs e)
        {
            Polyhedron ph_copy = ph.Clone() as Polyhedron;

            Affine.RotateOverStreight(ph_copy, new Point3d(0, 0, 0), new Point3d(0, 0, 1), -Math.PI / 4);
            Affine.RotateOverStreight(ph_copy, new Point3d(0, 0, 0), new Point3d(0, 1, 0), Math.Atan(1.0 / Math.Sqrt(2)));
            //Affine.OrtographicProjection(ph_copy, 'x');
            //ph_copy.Draw(g, Color.Black);
            g.Clear(Color.White);

            Zbuffer zb = new Zbuffer(pictureBox1.Width, pictureBox1.Height);

            foreach (var x in ph_copy.Faces)
            {
                zb.ProcessFace(x);
            }
            //for (int i = 0; i < 4; ++i)
            //{
            //    zb.ProcessFace(ph_copy.Faces[i]);
            //}
            pictureBox1.Image = zb.GetImage();
            pictureBox1.Invalidate();
        }
Exemplo n.º 9
0
 private void buttonOkta_Click(object sender, EventArgs e)
 {
     ph = Polyhedron.CreateOktahedron(new Point3d(0, 0, 0), new Point3d(2, 0, 0), new Point3d(0, 1, 0));
     Plot();
 }
Exemplo n.º 10
0
        private void button5_Click(object sender, EventArgs e)
        {
            double     vi      = double.Parse(textBox3.Text);
            double     vj      = double.Parse(textBox5.Text); //double.Parse(textBox4.Text);
            double     vk      = double.Parse(textBox4.Text); //double.Parse(textBox5.Text);
            Polyhedron ph_copy = ph;

            for (int i = 0; i < 180; ++i)
            {
                double angleInRad = 2 / 180.0 * Math.PI;
                switch (comboBox1.SelectedIndex)
                {
                case 0:
                    Affine.RotateOverStreight(ph_copy, new Point3d(1, 0, 0), new Point3d(0, 0, 0), angleInRad);
                    //Affine.RotateOverStreight(ph_copy, ph_copy.Center, new Point3d(ph_copy.Center.X + 1, ph_copy.Center.Y, ph_copy.Center.Z), angleInRad);
                    break;

                case 1:
                    Affine.RotateOverStreight(ph_copy, new Point3d(0, 1, 0), new Point3d(0, 0, 0), angleInRad);
                    //Affine.RotateOverStreight(ph_copy, ph_copy.Center, new Point3d(ph_copy.Center.X, ph_copy.Center.Y + 1, ph_copy.Center.Z), angleInRad);
                    break;

                case 2:
                    Affine.RotateOverStreight(ph_copy, new Point3d(0, 0, 1), new Point3d(0, 0, 0), angleInRad);
                    //Affine.RotateOverStreight(ph_copy, ph_copy.Center, new Point3d(ph_copy.Center.X, ph_copy.Center.Y, ph_copy.Center.Z + 1), angleInRad);
                    break;

                default:
                    throw new Exception("Bad axis.");
                }

                List <Face> faces = new List <Face>(ph_copy.faces);
                for (int j = faces.Count() - 1; j >= 0; --j)
                {
                    Point3d p1 = faces[j].edges[0].First;
                    Point3d p2 = faces[j].edges[1].First;
                    Point3d p3 = faces[j].edges[2].First;

                    double[,] matrix = new double[2, 3];
                    matrix[0, 0]     = p2.X - p1.X;
                    matrix[0, 1]     = p2.Y - p1.Y;
                    matrix[0, 2]     = p2.Z - p1.Z;
                    matrix[1, 0]     = p3.X - p1.X;
                    matrix[1, 1]     = p3.Y - p1.Y;
                    matrix[1, 2]     = p3.Z - p1.Z;

                    double ni = matrix[0, 1] * matrix[1, 2] - matrix[0, 2] * matrix[1, 1];
                    double nj = matrix[0, 2] * matrix[1, 0] - matrix[0, 0] * matrix[1, 2];
                    double nk = matrix[0, 0] * matrix[1, 1] - matrix[0, 1] * matrix[1, 0];
                    double d  = -(ni * p1.X + nj * p1.Y + nk * p1.Z);

                    Point3d pp   = new Point3d(p1.X + ni, p1.Y + nj, p1.Z + nk);
                    double  val1 = ni * pp.X + nj * pp.Y + nk * pp.Z + d;
                    double  val2 = ni * ph_copy.center.X + nj * ph_copy.center.Y + nk * ph_copy.center.Z + d;
                    if (val1 * val2 > 0)
                    {
                        ni = -ni;
                        nj = -nj;
                        nk = -nk;
                    }

                    if (ni * vi + nj * vj + nk * vk < 0)
                    {
                        faces.RemoveAt(j);
                    }
                }

                ph       = new Polyhedron();
                ph.faces = new Face[faces.Count()];
                for (int j = 0; j < faces.Count(); ++j)
                {
                    ph.faces[j] = faces[j];
                }
                ph.center = ph_copy.center;
                Plot();
                System.Threading.Thread.Sleep(40);
            }

            ph = ph_copy;
        }
Exemplo n.º 11
0
        private void button4_Click(object sender, EventArgs e)
        {
            string file_name = label5.Text;
            // сохраняем текст в файл
            string file_content = "";

            using (FileStream fstream = File.OpenRead(file_name))
            {
                // преобразуем строку в байты
                byte[] array = new byte[fstream.Length];
                // считываем данные
                fstream.Read(array, 0, array.Length);
                // декодируем байты в строку
                file_content = System.Text.Encoding.Default.GetString(array);
            }

            string[] strs  = file_content.Split('\n');
            string[] param = strs[0].Split(' ');
            string   axis  = param[0];
            int      steps = int.Parse(param[1]);

            Point3d[] points = new Point3d[strs.Length - 1];
            for (int i = 0; i < strs.Length - 1; ++i)
            {
                string[] coords = strs[i + 1].Split(' ');
                double   x = 0, y = 0, z = 0;
                switch (axis)
                {
                case "OX":
                    x = double.Parse(coords[0]);
                    y = double.Parse(coords[1]);
                    break;

                case "OY":
                    y = double.Parse(coords[0]);
                    z = double.Parse(coords[1]);
                    break;

                case "OZ":
                    z = double.Parse(coords[0]);
                    x = double.Parse(coords[1]);
                    break;
                }
                points[i] = new Point3d(x, y, z);
            }

            Polyhedron p = new Polyhedron();

            p.faces = new Face[steps * (points.Count() - 1)];
            Point3d[] curr_points = points;
            double    angle       = 2 * Math.PI / steps;
            double    curr_angle  = angle;
            int       pos         = 0;
            int       pcount      = points.Count();

            double x_center = 0, y_center = 0, z_center = 0;

            for (int i = 0; i < pcount; ++i)
            {
                x_center += points[i].X;
                y_center += points[i].Y;
                z_center += points[i].Z;
            }

            for (int i = 0; i < steps - 1; ++i)
            {
                Point3d[] next_points = new Point3d[pcount];
                for (int j = 0; j < pcount; ++j)
                {
                    double x = 0, y = 0, z = 0;
                    switch (axis)
                    {
                    case "OX":
                        x = points[j].X;
                        y = points[j].Y * Math.Cos(curr_angle);
                        z = points[j].Y * Math.Sin(curr_angle);
                        break;

                    case "OY":
                        y = points[j].Y;
                        z = points[j].Z * Math.Cos(curr_angle);
                        x = points[j].Z * Math.Sin(curr_angle);
                        break;

                    case "OZ":
                        z = points[j].Z;
                        x = points[j].X * Math.Cos(curr_angle);
                        y = points[j].X * Math.Sin(curr_angle);
                        break;
                    }
                    next_points[j] = new Point3d(x, y, z);
                }

                for (int j = 1; j < pcount - 1; ++j)
                {
                    x_center += points[j].X;
                    y_center += points[j].Y;
                    z_center += points[j].Z;
                }

                p.faces[pos++] = Face.CreateTriangle(points[0], curr_points[1], next_points[1]);
                p.faces[pos++] = Face.CreateTriangle(points[pcount - 1], curr_points[pcount - 2], next_points[pcount - 2]);
                for (int j = 1; j < pcount - 2; ++j)
                {
                    p.faces[pos++] = Face.CreateSquare(curr_points[j], next_points[j], next_points[j + 1], curr_points[j + 1]);
                }

                curr_points = next_points;
                curr_angle += angle;
            }

            p.faces[pos++] = Face.CreateTriangle(points[0], curr_points[1], points[1]);
            p.faces[pos++] = Face.CreateTriangle(points[pcount - 1], curr_points[pcount - 2], points[pcount - 2]);
            for (int j = 1; j < pcount - 2; ++j)
            {
                p.faces[pos++] = Face.CreateSquare(curr_points[j], points[j], points[j + 1], curr_points[j + 1]);
            }

            x_center /= steps * (pcount - 2) + 2;
            y_center /= steps * (pcount - 2) + 2;
            z_center /= steps * (pcount - 2) + 2;

            double center = 0;

            for (int i = 0; i < pcount; ++i)
            {
                center += points[i].X;
            }
            center /= pcount;
            switch (axis)
            {
            case "OX":
                p.center = new Point3d(center, 0, 0);
                break;

            case "OY":
                p.center = new Point3d(0, center, 0);
                break;

            case "OZ":
                p.center = new Point3d(0, 0, center);
                break;
            }

            //p.center = new Point3d(x_center, y_center, z_center);

            ph = p;
            Plot();
        }
Exemplo n.º 12
0
        public static void MakeView(Polyhedron ph, Cam cam)
        {
            AffineMatrix m = AffineMatrix.CreateViewMatrix(cam.Pos, cam.View, cam.Hor, cam.Vert);

            Execute(ph, m);
        }
Exemplo n.º 13
0
        public void make_dodecahedron()
        {
            Faces = new List <Polygon>();
            Polyhedron ik = new Polyhedron();

            ik.make_icosahedron();

            List <Point3D> pts = new List <Point3D>();

            foreach (Polygon f in ik.Faces)
            {
                pts.Add(f.Center);
            }

            Faces.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[0]),
                new Point3D(pts[1]),
                new Point3D(pts[2]),
                new Point3D(pts[3]),
                new Point3D(pts[4])
            }));

            Faces.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[5]),
                new Point3D(pts[6]),
                new Point3D(pts[7]),
                new Point3D(pts[8]),
                new Point3D(pts[9])
            }));

            for (int i = 0; i < 5; ++i)
            {
                Faces.Add(new Polygon(new List <Point3D>
                {
                    new Point3D(pts[i]),
                    new Point3D(pts[(i + 1) % 5]),
                    new Point3D(pts[(i == 4) ? 10 : 2 * i + 12]),
                    new Point3D(pts[(i == 4) ? 11 : 2 * i + 13]),
                    new Point3D(pts[2 * i + 10])
                }));
            }

            Faces.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[5]),
                new Point3D(pts[6]),
                new Point3D(pts[13]),
                new Point3D(pts[10]),
                new Point3D(pts[11])
            }));
            Faces.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[6]),
                new Point3D(pts[7]),
                new Point3D(pts[15]),
                new Point3D(pts[12]),
                new Point3D(pts[13])
            }));
            Faces.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[7]),
                new Point3D(pts[8]),
                new Point3D(pts[17]),
                new Point3D(pts[14]),
                new Point3D(pts[15])
            }));
            Faces.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[8]),
                new Point3D(pts[9]),
                new Point3D(pts[19]),
                new Point3D(pts[16]),
                new Point3D(pts[17])
            }));
            Faces.Add(new Polygon(new List <Point3D>
            {
                new Point3D(pts[9]),
                new Point3D(pts[5]),
                new Point3D(pts[11]),
                new Point3D(pts[18]),
                new Point3D(pts[19])
            }));

            find_center();
        }
Exemplo n.º 14
0
 private void Oktahedron_Click(object sender, EventArgs e)
 {
     polyhedron = Polyhedron.CreateOktahedron(new My_Point(0, 0, 0), new My_Point(2, 0, 0), new My_Point(0, 1, 0));
     Draw();
 }
Exemplo n.º 15
0
        public static void Reflect(Polyhedron ph, char axis)
        {
            AffineMatrix m = AffineMatrix.CreateReflectionMatrix(axis);

            Execute(ph, m);
        }
Exemplo n.º 16
0
        public static void Translate(Polyhedron ph, Point3d a)
        {
            AffineMatrix m = AffineMatrix.CreateTranslationMatrix(a.X, a.Y, a.Z);

            Execute(ph, m);
        }
Exemplo n.º 17
0
        public void make_octahedron(Polyhedron cube = null)
        {
            if (cube == null)
            {
                cube = new Polyhedron();
                cube.make_hexahedron();
            }

            Polygon f0 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[2].Center),
                new Point3D(cube.Faces[1].Center),
                new Point3D(cube.Faces[4].Center)
            }
                );

            Polygon f1 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[2].Center),
                new Point3D(cube.Faces[1].Center),
                new Point3D(cube.Faces[5].Center)
            }
                );

            Polygon f2 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[2].Center),
                new Point3D(cube.Faces[5].Center),
                new Point3D(cube.Faces[0].Center)
            }
                );

            Polygon f3 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[2].Center),
                new Point3D(cube.Faces[0].Center),
                new Point3D(cube.Faces[4].Center)
            }
                );

            Polygon f4 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[3].Center),
                new Point3D(cube.Faces[1].Center),
                new Point3D(cube.Faces[4].Center)
            }
                );

            Polygon f5 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[3].Center),
                new Point3D(cube.Faces[1].Center),
                new Point3D(cube.Faces[5].Center)
            }
                );

            Polygon f6 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[3].Center),
                new Point3D(cube.Faces[5].Center),
                new Point3D(cube.Faces[0].Center)
            }
                );

            Polygon f7 = new Polygon(
                new List <Point3D>
            {
                new Point3D(cube.Faces[3].Center),
                new Point3D(cube.Faces[0].Center),
                new Point3D(cube.Faces[4].Center)
            }
                );

            Faces = new List <Polygon> {
                f0, f1, f2, f3, f4, f5, f6, f7
            };
            find_center();
        }
Exemplo n.º 18
0
 private void Dodecahedron_Click(object sender, EventArgs e)
 {
     ph = Polyhedron.CreateDodecahedron();
     Plot();
 }
Exemplo n.º 19
0
        public static void RotateOverStreight(Polyhedron ph, Point3d a, Point3d b, double phi)
        {
            AffineMatrix m = AffineMatrix.CreateRotationMatrix(a, b, phi);

            Execute(ph, m);
        }
Exemplo n.º 20
0
        public static void CentralProjection(Polyhedron ph, double c)
        {
            AffineMatrix m = AffineMatrix.CreateCentralProjectionMatrix(c);

            Execute(ph, m);
        }
Exemplo n.º 21
0
 public Polyhedron(Polyhedron polyhedron)
 {
     Faces  = polyhedron.Faces.Select(face => new Polygon(face)).ToList();
     Center = new Point3D(polyhedron.Center);
 }
Exemplo n.º 22
0
 private void Dodecahedron_Click(object sender, EventArgs e)
 {
     polyhedron = Polyhedron.CreateDodecahedron();
     Draw();
 }
Exemplo n.º 23
0
        public static void IsometricProjection(Polyhedron ph)
        {
            AffineMatrix m = AffineMatrix.CreateIsometricProjectionMatrix();

            Execute(ph, m);
        }
Exemplo n.º 24
0
        public static void IsometricProjection(Polyhedron polyhedron)
        {
            AffineMatrix m = AffineMatrix.IsometricMatrix();

            Execute(polyhedron, m);
        }
Exemplo n.º 25
0
        public static void OrtographicProjection(Polyhedron ph, char axis)
        {
            AffineMatrix m = AffineMatrix.CreateOrtographicProjectionMatrix(axis);

            Execute(ph, m);
        }