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);
23 v
.draw_gnuplot(0,0,0,"tetrahedron.gnu");
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(0,0,0,"cube.gnu");
30 // Create an octahedron
31 v
.init(-2,2,-2,2,-2,2);
40 v
.draw_gnuplot(0,0,0,"octahedron.gnu");
42 // Create a dodecahedron
43 v
.init(-2,2,-2,2,-2,2);
57 v
.draw_gnuplot(0,0,0,"dodecahedron.gnu");
59 // Create an icosahedron
60 v
.init(-2,2,-2,2,-2,2);
82 v
.draw_gnuplot(0,0,0,"icosahedron.gnu");