1 // Single Voronoi cell example code
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : July 1st 2008
9 const double pi
=3.1415926535897932384626433832795;
11 // The number of planes to be cut around each coordinate axis
13 const double step
=2*pi
/n
;
15 // The angle (in radians) of the cutting planes from horizontal
16 const double theta
=pi
/4-0.25;
22 // Initialize the Voronoi cell to be a cube of side length 2, centered
24 v
.init(-1,1,-1,1,-1,1);
27 for(phi
=0;phi
<2*pi
-0.5*step
;phi
+=step
) {
28 x
=cos(theta
);y
=cos(phi
)*sin(theta
);z
=sin(phi
)*sin(theta
);
37 // Check that the relation table is correct, and that there are no
42 // Output the Voronoi cell to a file in Gnuplot format
43 v
.draw_gnuplot("degenerate.gnu",0,0,0);
45 // Output the Voronoi cell to a file in POV-Ray format
46 v
.draw_pov("degenerate_v.pov",0,0,0);