public Camera(int w, int h) { int camera_half_size = 5; small_cube.Hexahedron(camera_half_size); small_cube.Translate(view.First.X, view.First.Y, view.First.Z); set_rot_line(); Width = w; Height = h; }
public void Tetrahedron(Polyhedron cube = null) { if (cube == null) { cube = new Polyhedron(); cube.Hexahedron(); } Polygon f0 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[0].Points[0]), new Point3D(cube.Polygons[1].Points[1]), new Point3D(cube.Polygons[1].Points[3]) } ); Polygon f1 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[1].Points[3]), new Point3D(cube.Polygons[1].Points[1]), new Point3D(cube.Polygons[0].Points[2]) } ); Polygon f2 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[0].Points[2]), new Point3D(cube.Polygons[1].Points[1]), new Point3D(cube.Polygons[0].Points[0]) } ); Polygon f3 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[0].Points[2]), new Point3D(cube.Polygons[0].Points[0]), new Point3D(cube.Polygons[1].Points[3]) } ); Polygons = new List <Polygon> { f0, f1, f2, f3 }; UpdateCenter(); }
//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 Octahedron(Polyhedron cube = null) { if (cube == null) { cube = new Polyhedron(); cube.Hexahedron(); } Polygon f0 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[2].Center), new Point3D(cube.Polygons[1].Center), new Point3D(cube.Polygons[4].Center) } ); Polygon f1 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[2].Center), new Point3D(cube.Polygons[1].Center), new Point3D(cube.Polygons[5].Center) } ); Polygon f2 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[2].Center), new Point3D(cube.Polygons[5].Center), new Point3D(cube.Polygons[0].Center) } ); Polygon f3 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[2].Center), new Point3D(cube.Polygons[0].Center), new Point3D(cube.Polygons[4].Center) } ); Polygon f4 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[3].Center), new Point3D(cube.Polygons[1].Center), new Point3D(cube.Polygons[4].Center) } ); Polygon f5 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[3].Center), new Point3D(cube.Polygons[1].Center), new Point3D(cube.Polygons[5].Center) } ); Polygon f6 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[3].Center), new Point3D(cube.Polygons[5].Center), new Point3D(cube.Polygons[0].Center) } ); Polygon f7 = new Polygon( new List <Point3D> { new Point3D(cube.Polygons[3].Center), new Point3D(cube.Polygons[0].Center), new Point3D(cube.Polygons[4].Center) } ); Polygons = new List <Polygon> { f0, f1, f2, f3, f4, f5, f6, f7 }; UpdateCenter(); }