#include "gd.h" #include #include #include #include #include #include #include #include #include vector x,y,z; vector colors(256); vector > nbd; set boundary; string infile,outfile; /* Declare the image */ gdImagePtr im; int size=200; int black; float minx,maxx,miny,maxy,minz,maxz; void readfile(void) { int i,k; vector nbs; float xx,yy,zz; int a,b,c,d,e,f; ifstream BE(infile.c_str()); while (BE.good()) { BE >> i; nbs.clear(); int c=0;; for (int j=0;j<6;j++) { BE >> k; if (k) nbs.push_back(k-1); } if (nbs.size()<6) boundary.insert(i-1); nbd.push_back(nbs); BE >>xx >>yy >>zz; x.push_back(xx); y.push_back(yy); z.push_back(zz); // cout << "."; } for (int i=0;i nnbs; for (int j=0;j " << outfile << "\n"; readfile(); /* Declare output files */ FILE *pngout, *jpegout; /* Declare color indexes */ /* Allocate the image: ? pixels across by ? pixels tall */ im = gdImageCreate (size, size); makecolors(); minx=*min_element(x.begin(),x.end()); cout << "minx " << minx << "\n"; miny=*min_element(y.begin(),y.end()); cout << "miny " << miny << "\n"; minz=*min_element(z.begin(),z.end()); cout << "minz " << minz << "\n"; maxx=*max_element(x.begin(),x.end()); cout << "maxx " << maxx << "\n"; maxy=*max_element(y.begin(),y.end()); cout << "maxy " << maxy << "\n"; maxz=*max_element(z.begin(),z.end()); cout << "maxz " << maxz << "\n"; float rsize=max(maxx-minx,maxy-miny); float step=rsize/size; int i=0; for (float xx=minx;i