//DRAW FIGURE private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { switch (comboBox1.SelectedIndex) { case 0: //Tetrahedron g.Clear(Color.White); figure = new Polyhedron(); figure.Tetrahedron(); if (clipping == 0) { figure.Show(g, projection); } else { show_z_buff(); } break; case 1: //Hexahedron g.Clear(Color.White); figure = new Polyhedron(); figure.Hexahedron(); if (clipping == 0) { figure.Show(g, projection); } else { show_z_buff(); } break; case 2: //Oktahedron g.Clear(Color.White); figure = new Polyhedron(); figure.Octahedron(); if (clipping == 0) { figure.Show(g, projection); } else { show_z_buff(); } break; case 3: //Icosahedron g.Clear(Color.White); figure = new Polyhedron(); figure.Icosahedron(); if (clipping == 0) { figure.Show(g, projection); } else { show_z_buff(); } break; case 4: //Dodecahedron g.Clear(Color.White); figure = new Polyhedron(); figure.Dodecahedron(); if (clipping == 0) { figure.Show(g, projection); } else { show_z_buff(); } break; default: break; } }
public void Dodecahedron() { Polygons = new List <Polygon>(); Polyhedron ik = new Polyhedron(); ik.Icosahedron(); List <Point3D> pts = new List <Point3D>(); foreach (Polygon f in ik.Polygons) { pts.Add(f.Center); } Polygons.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]) })); Polygons.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) { Polygons.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]) })); } Polygons.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]) })); Polygons.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]) })); Polygons.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]) })); Polygons.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]) })); Polygons.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]) })); UpdateCenter(); }