void title( FILE * h, char * sptr ) { fprintf(h,"\n/*\t"); gener( h, '-', strlen( sptr ) * 2 ); fprintf(h,"\t*/\n"); fprintf(h,"/*\t"); expand( h, sptr ); fprintf(h,"\t*/\n"); fprintf(h,"/*\t"); gener( h, '-', strlen( sptr ) * 2 ); fprintf(h,"\t*/\n"); return; }
double rexp::get_exp() { boost::mt19937 gener(1); boost::normal_distribution<> normal(lambda, sd); boost::variate_generator<boost::mt19937&,boost::normal_distribution<> > rng(gener, normal); rng.engine().seed(myseed); return rng(); }
int BFS() { int x,y,i; begin=0;end=-1; ++end;encod(s,&e[end],&f[end]);used[e[end]][f[end]]=1;D[end]=-1; //printf("e=%d f=%d\n",e[end],f[end]); while(begin<=end) { if(check()) return begin; gener();begin++; } return -1; }
int main(int argc, char *argv[]) { World world(QColor(0,180,180)); int samples = 1; Material *material = new Reflective (QColor(2,255,255), 0.4, 1, 300, 0.6); PinholeCamera camera(Vector3(0,0,0),Vector3(0,0,1),Vector3(0,-1,0),Vector2(1,0.75),1); world.add(new Sphere(Vector3(-2,-1.15,1), 2, material)); world.add(new Sphere(Vector3(2,-1.15,1), 2, material)); world.add(new Sphere(Vector3(0,3.45-1.15,1), 2, material)); world.add(new Sphere(Vector3(0,1.15-1.15,3.45+1), 2, material)); JitteredGenerator gener(0); SquareDistributor dist; Sampler distributor(gener,dist,samples,60,0); world.add_light(PointLight(Vector3(0,0,3.45-2), MyColor(1,1,1))); Raytracer tracer(5); QImage image; image = tracer.ray_trace(world, camera, QSize(800, 600), &distributor); QApplication a(argc, argv); MainWindow w; w.copy_world(image, world); w.show_image(); // w.new_world(); w.show(); return a.exec(); }