Strip extra spaces from code.
[voro++.git] / branches / dynamic / examples / extra / box_cut.cc
blob94c7b520b778cd8c884b87f57968f74600be7c68
1 // Single Voronoi cell example code
2 //
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : June 1st 2008
7 #include "cell.cc"
9 // Parameters controlling the center of the test box
10 const double cx=1.5,cy=1.5,cz=1.5;
12 int main() {
13 double x,y,z;
14 voronoicell v;
16 // Initialize the Voronoi cell to be a cube of side length 16, centered
17 // on the origin
18 v.init(-8,8,-8,8,-8,8);
20 // Cut by a grid of points in a box of width one, centered on
21 // (cx,cy,cz)
22 for(x=cx-0.5;x<cx+0.55;x+=0.1) {
23 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) {
25 v.plane(x,y,z);
30 // Output the Voronoi cell in gnuplot format
31 v.draw_gnuplot("box_cut.gnu",0,0,0);
33 // Now make a small file that contains the test box
34 v.init(cx-0.5,cx+0.5,cy-0.5,cy+0.5,cz-0.5,cz+0.5);
35 v.draw_gnuplot("box_cut.points",0,0,0);