X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=visual%2Fvisual.c;h=a6fda4f747082c714c085b299aaf62f24466031b;hb=1d83ceb2ce2ff5150fd079f1066b7f583e38c8f4;hp=427e765b07f4627781d14a40c3fca5d6cdff0cd8;hpb=3ce21f4433c04699bb6f47f0332a6f0e3c462f5e;p=physik%2Fposic.git diff --git a/visual/visual.c b/visual/visual.c index 427e765..a6fda4f 100644 --- a/visual/visual.c +++ b/visual/visual.c @@ -46,9 +46,9 @@ int visual_init(t_visual *v,char *filebase) { strncpy(v->fb,filebase,128); memset(file,0,128+8); - sprintf(file,"%s.scr",v->fb); + sprintf(file,"%s/visualize.scr",v->fb); - v->fd=open(file,O_WRONLY|O_CREAT|O_TRUNC); + v->fd=open(file,O_WRONLY|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR); if(v->fd<0) { perror("open visual fd"); return -1; @@ -74,12 +74,12 @@ int visual_atoms(t_visual *v,double time,t_atom *atom,int n) { char file[128+64]; t_3dvec dim; - dim.x=10e9*v->dim.x; - dim.y=10e9*v->dim.y; - dim.z=10e9*v->dim.z; + dim.x=v->dim.x; + dim.y=v->dim.y; + dim.z=v->dim.z; - sprintf(file,"%s-%.15f.xyz",v->fb,time); - fd=open(file,O_WRONLY|O_CREAT|O_TRUNC); + sprintf(file,"%s/visualize_%07.f.xyz",v->fb,time); + fd=open(file,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR); if(fd<0) { perror("open visual save file fd"); return -1; @@ -92,19 +92,20 @@ int visual_atoms(t_visual *v,double time,t_atom *atom,int n) { dprintf(v->fd,"rotate y 10\n"); dprintf(v->fd,"set ambient 20\n"); dprintf(v->fd,"set specular on\n"); + dprintf(v->fd,"set boundbox on\n"); //dprintf(v->fd,"label\n"); - sprintf(file,"%s-%.15f.ppm",v->fb,time); + sprintf(file,"%s/visualize_%07.f.ppm",v->fb,time); dprintf(v->fd,"write ppm %s\n",file); dprintf(v->fd,"zap\n"); /* write the actual data file */ dprintf(fd,"%d\n",(dim.x==0)?n:n+8); - dprintf(fd,"atoms at time %.15f\n",time); + dprintf(fd,"atoms at time %07.f\n",time); for(i=0;i