1 // Box cutting example code
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
10 // Parameters controlling the center of the test box
11 const double cx
=1.5,cy
=1.5,cz
=1.5;
17 // Initialize the Voronoi cell to be a cube of side length 16, centered
19 v
.init(-8,8,-8,8,-8,8);
21 // Cut by a grid of points in a box of width one, centered on
23 for(x
=cx
-0.5;x
<cx
+0.55;x
+=0.1) for(y
=cy
-0.5;y
<cy
+0.55;y
+=0.1)
24 for(z
=cz
-0.5;z
<cz
+0.55;z
+=0.1) v
.plane(x
,y
,z
);
26 // Output the Voronoi cell in gnuplot format
27 v
.draw_gnuplot(0,0,0,"box_cut.gnu");
29 // Now make a small file that contains the test box
30 v
.init(cx
-0.5,cx
+0.5,cy
-0.5,cy
+0.5,cz
-0.5,cz
+0.5);
31 v
.draw_gnuplot(0,0,0,"box_cut.points");