1 // Degenerate Voronoi cell example code
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
10 const double pi
=3.1415926535897932384626433832795;
12 // The number of planes to be cut around each coordinate axis
14 const double step
=2*pi
/n
;
16 // The angle (in radians) of the cutting planes from horizontal
17 const double theta
=pi
/4-0.25;
23 // Initialize the Voronoi cell to be a cube of side length 2, centered
25 v
.init(-1,1,-1,1,-1,1);
28 for(phi
=0;phi
<2*pi
-0.5*step
;phi
+=step
) {
29 x
=cos(theta
);y
=cos(phi
)*sin(theta
);z
=sin(phi
)*sin(theta
);
38 // Check that the relation table is correct, and that there are no
43 // Output the Voronoi cell to a file in Gnuplot format
44 v
.draw_gnuplot(0,0,0,"degenerate.gnu");
46 // Output the Voronoi cell to a file in POV-Ray format
47 v
.draw_pov(0,0,0,"degenerate_v.pov");