L-shape calculation added.
[voro++.git] / trunk / examples / extra / box_cut.cc
blob7eb0916c5e93c7042045cdeed25853ab576abd19
1 // Box cutting example code
2 //
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
7 #include "voro++.hh"
8 using namespace voro;
10 // Parameters controlling the center of the test box
11 const double cx=1.5,cy=1.5,cz=1.5;
13 int main() {
14 double x,y,z;
15 voronoicell v;
17 // Initialize the Voronoi cell to be a cube of side length 16, centered
18 // on the origin
19 v.init(-8,8,-8,8,-8,8);
21 // Cut by a grid of points in a box of width one, centered on
22 // (cx,cy,cz)
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");