📄 pscubecontour.c
字号:
for (j=i-1; i<nc; ++i) ccolor[i] = ccolor[j]; } labelcf = 1; getparint("labelcf",&labelcf); labelcper = 1; getparint("labelcper",&labelcper); nlabelc = nc; getparint("nlabelc",&nlabelc); labelcsize = 6; getparfloat("labelcsize",&labelcsize); getparstring("labelcfont",&labelcfont); getparstring("labelccolor",&labelccolor); if (!getparint("nplaces",&nplaces)) nplaces = 6; /* get axes parameters, convert to points */ if(!getparfloat("size1",&size1)) size1 = 4.0; if(!getparfloat("size2",&size2)) size2 = 4.0; if(!getparfloat("size3",&size3)) size3 = 3.0; if (!getparfloat("xbox",&xbox)) xbox = 1.5; if (!getparfloat("ybox",&ybox)) ybox = 1.5; size1 *= 72; size2 *= 72; size3 *= 72; xbox *= 72; ybox *= 72; /* get projection angle, convert to radians */ if(!getparfloat("angle",&angle)) angle = 45.0; angle = MAX(angle,0.00001); angle = MIN(angle,90.0); angle *= PI/180.0; /* get axis1 parameters */ x1beg = x1min; x1end = x1max; getparfloat("x1end",&x1end); d1num = 0.0; getparfloat("d1num",&d1num); f1num = x1min; getparfloat("f1num",&f1num); n1tic = 1; getparint("n1tic",&n1tic); getparstring("grid1",&grid1s); if (STREQ("dot",grid1s)) grid1 = DOT; else if (STREQ("dash",grid1s)) grid1 = DASH; else if (STREQ("solid",grid1s)) grid1 = SOLID; else grid1 = NONE; getparstring("label1",&label1); /* get axis2 parameters */ x2beg = x2min; getparfloat("x2beg",&x2beg); x2end = x2max; d2num = 0.0; getparfloat("d2num",&d2num); f2num = x2min; getparfloat("f2num",&f2num); n2tic = 1; getparint("n2tic",&n2tic); getparstring("grid2",&grid2s); if (STREQ("dot",grid2s)) grid2 = DOT; else if (STREQ("dash",grid2s)) grid2 = DASH; else if (STREQ("solid",grid2s)) grid2 = SOLID; else grid2 = NONE; getparstring("label2",&label2); /* get axis3 parameters */ x3beg = x3min; x3end = x3max; getparfloat("x3end",&x3end); d3num = 0.0; getparfloat("d3num",&d3num); f3num = x3min; getparfloat("f3num",&f3num); n3tic = 1; getparint("n3tic",&n3tic); getparstring("grid3",&grid3s); if (STREQ("dot",grid3s)) grid3 = DOT; else if (STREQ("dash",grid3s)) grid3 = DASH; else if (STREQ("solid",grid3s)) grid3 = SOLID; else grid3 = NONE; getparstring("label3",&label3); /* get additional font parameters */ getparstring("labelfont",&labelfont); labelsize = 18.0; getparfloat("labelsize",&labelsize); getparstring("title",&title); getparstring("titlefont",&titlefont); titlesize = 24.0; getparfloat("titlesize",&titlesize); getparstring("titlecolor",&titlecolor); getparstring("axescolor",&axescolor); getparstring("gridcolor",&gridcolor); style = SEISMIC; /* determine axes pads */ p1beg = (x1end>x1beg)?-fabs(d1)/2:fabs(d1)/2; p1end = (x1end>x1beg)?fabs(d1)/2:-fabs(d1)/2; p2beg = (x2end>x2beg)?-fabs(d2)/2:fabs(d2)/2; p2end = (x2end>x2beg)?fabs(d2)/2:-fabs(d2)/2; p3beg = (x3end>x3beg)?-fabs(d3)/2:fabs(d3)/2; p3end = (x3end>x3beg)?fabs(d3)/2:-fabs(d3)/2; /* set bounding box */ psAxesBBox(xbox,ybox,size2+cos(angle)*size3,size1+sin(angle)*size3, labelfont,labelsize,titlefont,titlesize,style,bbox); boundingbox(bbox[0],bbox[1],bbox[2],bbox[3]); /* begin PostScript */ begineps(); /* save graphics state */ gsave(); /* translate coordinate system by box offset */ translate(xbox,ybox); /* begin top */ gsave(); /* determine x2 and x3 scale factors */ x2scale = size2/(x2end-x2beg); x3scale = size3*sin(angle)/(x3end-x3beg); /* scale x2 and x3 coordinates */ for (i2=0; i2<n2; i2++) x2[i2] *= x2scale; for (i3=0; i3<n3; i3++) x3[i3] *= x3scale; /* transform and skew coordinates */ matrix[0] = 1; matrix[1] = 0; matrix[2] = 1/tan(angle); matrix[3] = 1; matrix[4] = 0; matrix[5] = 0; translate(-(f2-x2min+x2beg)*x2scale-f3*x3scale/tan(angle),size1-f3*x3scale); concat(matrix); rectclip(x2beg*x2scale,f3*x3scale,size2,size3*sin(angle)); /* draw contours */ for (ic=0; ic<nc; ic++) { setlinewidth(cwidth[ic]); if (strcmp(ccolor[ic],"none")) setcolor(ccolor[ic]); else setgray(cgray[ic]); if (cdash[ic]!=0.0) setdash(&cdash[ic],1,0.0); else setdash(&cdash[ic],0,0.0); lcsize = 0.; if (nlabelc>0) { if((ic-labelcf+1)%labelcper==0 && ic>=labelcf-1 && ic<labelcf-1+labelcper*nlabelc) { setlinewidth(cwidth[ic]); lcsize = labelcsize; } else { lcsize = 0.; setlinewidth(0.25*cwidth[ic]); } } /* no labels -> lcsize=0 to psContour */ psContour(c[ic],n2,x2,n3,x3,ztop,0,labelcfont,labelccolor,wtop,nplaces); } /* unscale x2 and x3 coordinates */ for (i2=0; i2<n2; i2++) x2[i2] /= x2scale; for (i3=0; i3<n3; i3++) x3[i3] /= x3scale; translate((f2-x2min+x2beg)*x2scale+f3*x3scale/tan(angle),-size1+f3*x3scale); /* end top */ grestore(); /* begin front */ gsave(); /* determine x1 and x2 scale factors */ x1scale = size1/(x1end-x1beg); x2scale = size2/(x2end-x2beg); /* scale x1 and x2 coordinates */ for (i1=0; i1<n1; i1++) x1[i1] *= x1scale; for (i2=0; i2<n2; i2++) x2[i2] *= x2scale; rotate(-90); translate(-size1-f1*x1scale,-(f2-x2min+x2beg)*x2scale); rectclip(size1+f1*x1scale,(f2-x2min+x2beg)*x2scale,-size1,size2); /* draw contours */ for (ic=0; ic<nc; ic++) { setlinewidth(cwidth[ic]); if (strcmp(ccolor[ic],"none")) setcolor(ccolor[ic]); else setgray(cgray[ic]); if (cdash[ic]!=0.0) setdash(&cdash[ic],1,0.0); else setdash(&cdash[ic],0,0.0); lcsize = 0.; if (nlabelc>0) { if((ic-labelcf+1)%labelcper==0 && ic>=labelcf-1 && ic<labelcf-1+labelcper*nlabelc) { setlinewidth(cwidth[ic]); lcsize = labelcsize; } else { lcsize = 0.; setlinewidth(0.25*cwidth[ic]); } } psContour(c[ic],n1,x1,n2,x2,z,lcsize,labelcfont,labelccolor,w,nplaces); } /* unscale x1 and x2 coordinates */ for (i1=0; i1<n1; i1++) x1[i1] /= x1scale; for (i2=0; i2<n2; i2++) x2[i2] /= x2scale; translate(size1+f1*x1scale,(f2-x2min+x2beg)*x2scale); rotate(90); /* end front */ grestore(); /* begin side */ gsave(); /* determine x1 and x3 scale factors */ x1scale = size1/(x1end-x1beg); x3scale = size3*cos(angle)/(x3end-x3beg); /* scale x1 and x3 coordinates */ for (i1=0; i1<n1; i1++) x1[i1] *= x1scale; for (i3=0; i3<n3; i3++) x3[i3] *= x3scale; /* transform and skew coordinates */ matrix[0] = 1; matrix[1] = tan(angle); matrix[2] = 0; matrix[3] = 1; matrix[4] = 0; matrix[5] = 0; translate(size2-f3*x3scale,size1+f1*x1scale-f3*x3scale*tan(angle)); concat(matrix); rectclip(f3*x3scale,-x1end*x1scale,size3*cos(angle),size1); rotate(-90); /* draw contours */ for (ic=0; ic<nc; ic++) { setlinewidth(cwidth[ic]); if (strcmp(ccolor[ic],"none")) setcolor(ccolor[ic]); else setgray(cgray[ic]); if (cdash[ic]!=0.0) setdash(&cdash[ic],1,0.0); else setdash(&cdash[ic],0,0.0); lcsize = 0.; if (nlabelc>0) { if((ic-labelcf+1)%labelcper==0 && ic>=labelcf-1 && ic<labelcf-1+labelcper*nlabelc) { setlinewidth(cwidth[ic]); lcsize = labelcsize; } else { lcsize = 0.; setlinewidth(0.25*cwidth[ic]); } } /* no labels -> lcsize=0 to psContour */ psContour(c[ic],n1,x1,n3,x3,zside,0,labelcfont,labelccolor,wside,nplaces); } /* unscale x1 and x3 coordinates */ for (i1=0; i1<n1; i1++) x1[i1] /= x1scale; for (i3=0; i3<n3; i3++) x3[i3] /= x3scale; rotate(90); translate(-size2+f3*x3scale,-size1-f1*x1scale+f3*x3scale*tan(angle)); /* end side */ grestore(); /* restore graphics state */ grestore(); psCubeAxesBox(xbox,ybox,size1,size2,size3,angle, x1beg,x1end,p1beg,p1end, d1num,f1num,n1tic,grid1,label1, x2beg,x2end,p2beg,p2end, d2num,f2num,n2tic,grid2,label2, x3beg,x3end,p3beg,p3end, d3num,f3num,n3tic,grid3,label3, labelfont,labelsize, title,titlefont,titlesize, titlecolor,axescolor,gridcolor); /* end PostScript */ showpage(); endeps(); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -