//DRAW FIGURE 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; } }
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(); }