1 // Platonic solids example code
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
10 // Golden ratio constants
11 const double Phi
=0.5*(1+sqrt(5.0));
12 const double phi
=0.5*(1-sqrt(5.0));
17 // Create a tetrahedron
18 v
.init(-2,2,-2,2,-2,2);
24 v
.draw_gnuplot(0,0,0,"tetrahedron.gnu");
26 // Create a cube. Since this is the default shape
27 // we don't need to do any plane cutting.
28 v
.init(-1,1,-1,1,-1,1);
29 v
.draw_gnuplot(0,0,0,"cube.gnu");
31 // Create an octahedron
32 v
.init(-2,2,-2,2,-2,2);
42 v
.draw_gnuplot(0,0,0,"octahedron.gnu");
44 // Create a dodecahedron
45 v
.init(-2,2,-2,2,-2,2);
59 v
.draw_gnuplot(0,0,0,"dodecahedron.gnu");
61 // Create an icosahedron
62 v
.init(-2,2,-2,2,-2,2);
84 v
.draw_gnuplot(0,0,0,"icosahedron.gnu");