1 // Platonic solids example code
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : July 1st 2008
9 // Golden ratio constants
10 const double Phi
=0.5*(1+sqrt(5.0));
11 const double phi
=0.5*(1-sqrt(5.0));
16 // Create a tetrahedron
17 v
.init(-2,2,-2,2,-2,2);
23 v
.draw_gnuplot("tetrahedron.gnu",0,0,0);
25 // Create a cube. Since this is the default shape
26 // we don't need to do any plane cutting.
27 v
.init(-1,1,-1,1,-1,1);
28 v
.draw_gnuplot("cube.gnu",0,0,0);
30 // Create an octahedron
31 v
.init(-2,2,-2,2,-2,2);
41 v
.draw_gnuplot("octahedron.gnu",0,0,0);
43 // Create a dodecahedron
44 v
.init(-2,2,-2,2,-2,2);
58 v
.draw_gnuplot("dodecahedron.gnu",0,0,0);
60 // Create an icosahedron
61 v
.init(-2,2,-2,2,-2,2);
83 v
.draw_gnuplot("icosahedron.gnu",0,0,0);