📄 zbufinout.c
字号:
/rectpath{newpath left bottom moveto left top lineto \n\right top lineto right bottom lineto closepath}bdf \n\/sf{dup 0 eq{pop df dup 3 mul}{dup} ifelse /clipflatness xdf setflat}bdf \n";static char str2[] = "\version cvr 38.0 le \n\{/setrgbcolor{ \n\currenttransfer exec 3 1 roll \n\currenttransfer exec 3 1 roll \n\currenttransfer exec 3 1 roll \n\setrgbcolor}bdf}if \n\/gettint{0 get}bdf \n\/puttint{0 exch put}bdf \n\/vms{/vmsv save def}bdf \n\/vmr{vmsv restore}bdf \n\/vmrs{vmr vms}bdf \n\/CD{/NF exch def \n\{exch dup/FID ne{exch NF 3 1 roll put} \n\{pop pop}ifelse}forall NF}bdf \n\/MN{1 index length/Len exch def \n\dup length Len add string dup \n\Len 4 -1 roll putinterval dup 0 4 -1 roll putinterval}bdf \n\/RC{256 string cvs(|______)anchorsearch \n\{1 index MN cvn/NewN exch def cvn \n\findfont dup maxlength dict CD dup/FontName NewN put dup \n\/Encoding MacVec put NewN exch definefont pop}{pop}ifelse}bdf \n\/RF{dup FontDirectory exch known{pop}{RC}ifelse}bdf \n\/FF{dup 256 string cvs(|______)exch MN cvn dup FontDirectory exch known \n\{exch}if pop findfont}bdf \n\userdict begin /BDFontDict 20 dict def end \n\BDFontDict begin \n\/bu{}def \n\/bn{}def \n\/setTxMode{pop}def \n\/gm{moveto}def \n\/show{pop}def \n\/gr{pop}def \n\/fnt{pop pop pop}def \n\/fs{pop}def \n\/fz{pop}def \n\/lin{pop pop}def \n\end \n\/MacVec 256 array def \n\MacVec 0 /Helvetica findfont \n\/Encoding get 0 128 getinterval putinterval \n\MacVec 127 /DEL put MacVec 16#27 /quotesingle put MacVec 16#60 /grave put \n\/NUL/SOH/STX/ETX/EOT/ENQ/ACK/BEL/BS/HT/LF/VT/FF/CR/SO/SI \n\/DLE/DC1/DC2/DC3/DC4/NAK/SYN/ETB/CAN/EM/SUB/ESC/FS/GS/RS/US \n\MacVec 0 32 getinterval astore pop \n\/Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis/Udieresis/aacute \n\/agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute/egrave \n\/ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde/oacute \n\/ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex/udieresis \n\/dagger/degree/cent/sterling/section/bullet/paragraph/germandbls \n\/register/copyright/trademark/acute/dieresis/notequal/AE/Oslash \n\/infinity/plusminus/lessequal/greaterequal/yen/mu/partialdiff/summation \n";static char str3[] = "\/product/pi/integral/ordfeminine/ordmasculine/Omega/ae/oslash \n\/questiondown/exclamdown/logicalnot/radical/florin/approxequal/Delta/guillemotleft \n\/guillemotright/ellipsis/nbspace/Agrave/Atilde/Otilde/OE/oe \n\/endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide/lozenge \n\/ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright/fi/fl \n\/daggerdbl/periodcentered/quotesinglbase/quotedblbase \n\/perthousand/Acircumflex/Ecircumflex/Aacute \n\/Edieresis/Egrave/Iacute/Icircumflex/Idieresis/Igrave/Oacute/Ocircumflex \n\/apple/Ograve/Uacute/Ucircumflex/Ugrave/dotlessi/circumflex/tilde \n\/macron/breve/dotaccent/ring/cedilla/hungarumlaut/ogonek/caron \n\MacVec 128 128 getinterval astore pop \n\/fps{currentflat exch dup 0 le{pop 1}if \n\{dup setflat 3 index stopped \n\{1.3 mul dup 3 index gt{pop setflat pop pop stop}if}{exit}ifelse \n\}loop pop setflat pop pop \n\}bdf \n\/fp{100 currentflat fps}bdf \n\/rfp{clipflatness currentflat fps}bdf \n\/fcp{100 clipflatness fps}bdf \n\/fclip{{clip}fcp}bdf \n\/feoclip{{eoclip}fcp}bdf \n\end %%. FreeHandDict \n\%%%%EndProcSet \n\%%%%BeginSetup \n\FreeHandDict begin \n\/ccmyk{dup 5 -1 roll sub 0 max exch}ndf \n\/setcmykcolor{1 exch sub ccmyk ccmyk ccmyk pop setrgbcolor}ndf \n\/setcmykcoloroverprint{4{dup -1 eq{pop 0}if 4 1 roll}repeat setcmykcolor}ndf \n\/findcmykcustomcolor{5 /packedarray where{pop packedarray}{array astore readonly}ifelse}ndf \n\/setcustomcolor{exch aload pop pop 4{4 index mul 4 1 roll}repeat setcmykcolor pop}ndf \n\/setseparationgray{1 exch sub dup dup dup setcmykcolor}ndf \n\/setoverprint{pop}ndf \n\/currentoverprint false ndf \n\/colorimage{pop pop \n\[5 -1 roll/exec cvx 6 -1 roll/exec cvx 7 -1 roll/exec cvx 8 -1 roll/exec cvx \n\/exch cvx/pop cvx/exch cvx/pop cvx/exch cvx/pop cvx/invbuf cvx]cvx image} \n\%%. version 47.1 of Postscript defines colorimage incorrectly (rgb model only) \n\version cvr 47.1 le{userdict begin bdf end}{ndf}ifelse \n\/customcolorimage{pop image}ndf \n\/separationimage{image}ndf \n\/newcmykcustomcolor{6 /packedarray where{pop packedarray}{array astore readonly}ifelse}ndf \n\/inkoverprint false ndf \n\/setinkoverprint{pop}ndf \n\/overprintprocess{pop}ndf \n\/setspotcolor \n\{spots exch get 0 5 getinterval exch setcustomcolor}ndf \n\/currentcolortransfer{currenttransfer dup dup dup}ndf \n\/setcolortransfer{systemdict begin settransfer end pop pop pop}ndf \n";static char str4[] = "\/setimagecmyk{dup length 4 eq \n\{aload pop} \n\{aload pop spots exch get 0 4 getinterval aload pop 4 \n\{4 index mul 4 1 roll}repeat 5 -1 roll pop} ifelse \n\systemdict /colorimage known{version cvr 47.1 gt}{false}ifelse \n\not{pop 1 currentgray sub}if \n\/ik xdf /iy xdf /im xdf /ic xdf \n\}ndf \n\/setcolor{dup length 4 eq \n\{aload overprintprocess setcmykcolor} \n\{aload 1 get spots exch get 5 get setinkoverprint setspotcolor} \n\ifelse}ndf \n\/bc2[0 0]def \n\/bc4[0 0 0 0]def \n\/c1[0 0 0 0]def \n\/c2[0 0 0 0]def \n\/absmax{2 copy abs exch abs gt{exch}if pop}bdf \n\/calcstep \n\{c1 length 4 eq \n\{ \n\0 1 3 \n\{c1 1 index get \n\c2 3 -1 roll get \n\sub \n\}for \n\absmax absmax absmax \n\} \n\{ \n\bc2 c1 1 get 1 exch put \n\c1 gettint c2 gettint \n\sub abs \n\}ifelse \n\graystep div abs round dup 0 eq{pop 1}if \n\dup /numsteps xdf 1 sub dup 0 eq{pop 1}if /numsteps1 xdf \n\}bdf \n\/cblend{ \n\c1 length 4 eq \n\{ \n\0 1 3 \n\{bc4 exch \n\c1 1 index get \n\c2 2 index get \n\1 index sub \n\frac mul add put \n\}for bc4 \n\}{ \n\bc2 \n\c1 gettint \n\c2 gettint \n\1 index sub \n\frac mul add \n\puttint bc2 \n\}ifelse \n\setcolor \n\}bdf \n";static char str5[] = "\/logtaper{/frac frac 9 mul 1 add log def}bdf \n\/imbits 1 def \n\/iminv false def \n\/invbuf{0 1 2 index length 1 sub{dup 2 index exch get 255 exch sub 2 index 3 1 roll put}for}bdf \n\/cyanrp{currentfile cyanbuf readhexstring pop iminv{invbuf}if}def \n\/magentarp{cyanbuf magentabuf copy}bdf \n\/yellowrp{cyanbuf yellowbuf copy}bdf \n\/blackrp{cyanbuf blackbuf copy}bdf \n\/fixtransfer{ \n\dup{ic mul ic sub 1 add}concatprocs exch \n\dup{im mul im sub 1 add}concatprocs exch \n\dup{iy mul iy sub 1 add}concatprocs exch \n\{ik mul ik sub 1 add}concatprocs \n\currentcolortransfer \n\5 -1 roll exch concatprocs 7 1 roll \n\4 -1 roll exch concatprocs 6 1 roll \n\3 -1 roll exch concatprocs 5 1 roll \n\concatprocs 4 1 roll \n\setcolortransfer \n\}bdf \n";fprintf(fp, "%s%s%s%s%s", str, str2, str3, str4, str5);}/* numbers the faces for checking */void numberFaces(faces, numfaces, fp)face **faces;int numfaces;FILE *fp;{ int i, j, mid[2]; double cent[2]; /* put face number at average point of each face */ for(i = 0; i < numfaces; i++) { /* figure midpoint, truncate (truncation not really necessary) */ for(j = 0, cent[0] = cent[1] = 0.0; j < faces[i]->numsides; j++) { cent[0] += faces[i]->c[j][0]; /* x coordinate sum */ cent[1] += faces[i]->c[j][1]; /* y coordinate sum */ } mid[0] = cent[0]/(((double) faces[i]->numsides)); /* average x */ mid[1] = cent[1]/(((double) faces[i]->numsides)); /* average y */ /* dump a label with associated garbage */ fprintf(fp, "%%%%IncludeFont: Times-Roman\n"); fprintf(fp, "/f1 /|______Times-Roman dup RF findfont def\n{\n"); fprintf(fp, "f1 [%g 0 0 %g 0 0] makesetfont\n", FONT, FONT); fprintf(fp, "%d %d moveto\n", mid[0], mid[1]); fprintf(fp, "0 0 32 0 0 (F%d) ts\n}\n", i); fprintf(fp, "[0 0 0 1]\nsts\nvmrs\n"); }}/* number a face for checking - used to cover up obscured faces' numbers*/void numberFace(fac, fp)face *fac;FILE *fp;{ int j, mid[2]; double cent[2]; /* figure midpoint, truncate (truncation not really necessary) */ for(j = 0, cent[0] = cent[1] = 0.0; j < fac->numsides; j++) { cent[0] += fac->c[j][0]; /* x coordinate sum */ cent[1] += fac->c[j][1]; /* y coordinate sum */ } mid[0] = cent[0]/(((double) fac->numsides)); /* average x */ mid[1] = cent[1]/(((double) fac->numsides)); /* average y */ /* dump a label with associated garbage */ fprintf(fp, "%%%%IncludeFont: Times-Roman\n"); fprintf(fp, "/f1 /|______Times-Roman dup RF findfont def\n{\n"); fprintf(fp, "f1 [%g 0 0 %g 0 0] makesetfont\n", FONT, FONT); fprintf(fp, "%d %d moveto\n", mid[0], mid[1]); fprintf(fp, "0 0 32 0 0 (%d) ts\n}\n", fac->index); fprintf(fp, "[0 0 0 1]\nsts\nvmrs\n");}/* dumps adjacency graph as a ps file - uses both input order and graph order*/void dumpAdjGraph(faces, numfaces, fp)face **faces;int numfaces;FILE *fp;{ int f, i; double x, y; /* current point in plot */ double stepx, stepy; /* step in x and y directions */ double font; /* font size */ /* start the input numbered graph refered to lower left corner - row numbers on right because it's easier */ /* set up the sizes - font never bigger than FONT; stepx, stepy <=1.25FONT */ stepx = MIN(1.25*FONT, (IMAGEX-OFFSETX)/(double)numfaces); stepy = MIN(1.25*FONT, (IMAGEY-OFFSETY)/(double)numfaces); font = MIN(stepx, stepy)/1.25; x = OFFSETX + numfaces*stepx; y = OFFSETY + numfaces*stepy; /* number columns - mark those divisible by ten */ for(f = 0; f < numfaces; f++) { if(f % 10 == 0 && f != 0) fprintf(fp, "%g %g dia\n", x-f*stepx, y+stepy); } /* number each row and fill it in - input ordering for(f = 0; f < numfaces; f++) { */ /* dump a row label with associated garbage fprintf(fp, "%%%%IncludeFont: Times-Roman\n"); fprintf(fp, "/f1 /|______Times-Roman dup RF findfont def\n{\n"); fprintf(fp, "f1 [%g 0 0 %g 0 0] makesetfont\n", FONT, FONT); fprintf(fp, "%g %g moveto\n", x+stepx, y-faces[f]->index*stepy); fprintf(fp, "0 0 32 0 0 (%d) ts\n}\n", faces[f]->index); fprintf(fp, "[0 0 0 1]\nsts\nvmrs\n"); */ /* dump dot if an edge for(i = 0; i < faces[f]->numbehind; i++) { fprintf(fp, "%g %g dot\n", x-(faces[f]->behind)[i]->index*stepx, y-faces[f]->index*stepy); } } */ /* dump title fprintf(fp, "%%%%IncludeFont: Times-Roman\n"); fprintf(fp, "/f1 /|______Times-Roman dup RF findfont def\n{\n"); fprintf(fp, "f1 [%g 0 0 %g 0 0] makesetfont\n", FONT, FONT); fprintf(fp, "%g %g moveto\n", OFFSETX, y+FONT); fprintf(fp, "0 0 32 0 0 (Input Ordering) ts\n}\n"); fprintf(fp, "[0 0 0 1]\nsts\nvmrs\n"); */ /* y += (numfaces*stepy + 3*FONT); /* offset 2nd array */ /* number each row and fill it in - graph ordering */ for(f = 0; f < numfaces; f++) { fprintf(fp, "%%%%IncludeFont: Times-Roman\n"); fprintf(fp, "/f1 /|______Times-Roman dup RF findfont def\n{\n"); fprintf(fp, "f1 [%g 0 0 %g 0 0] makesetfont\n", FONT, FONT); fprintf(fp, "%g %g moveto\n", x+stepx, y-faces[f]->depth*stepy); fprintf(fp, "0 0 32 0 0 (%d) ts\n}\n", faces[f]->depth); fprintf(fp, "[0 0 0 1]\nsts\nvmrs\n"); for(i = 0; i < faces[f]->numbehind; i++) { fprintf(fp, "%g %g dot\n", x-(faces[f]->behind)[i]->depth*stepx, y-faces[f]->depth*stepy); } } fprintf(fp, "%%%%IncludeFont: Times-Roman\n"); fprintf(fp, "/f1 /|______Times-Roman dup RF findfont def\n{\n"); fprintf(fp, "f1 [%g 0 0 %g 0 0] makesetfont\n", FONT, FONT); fprintf(fp, "%g %g moveto\n", OFFSETX, y+FONT); fprintf(fp, "0 0 32 0 0 (Graph Ordering) ts\n}\n"); fprintf(fp, "[0 0 0 1]\nsts\nvmrs\n");}/* dump face graph as a text file*/void dumpFaceText(faces, numfaces, fp)face **faces;int numfaces;FILE *fp;{ int f, i, first = 0, k; fprintf(fp, "depth order (input order) - lower numbers are deeper\n"); for(f = 0; f < numfaces; f++) { fprintf(fp, "%d (%d):", faces[f]->depth, faces[f]->index); for(i = 0; i < faces[f]->numbehind && faces[f]->behind != NULL; i++) { fprintf(fp, " %d (%d)", (faces[f]->behind)[i]->depth, (faces[f]->behind)[i]->index); if(i % 5 == 0 && i != 0) fprintf(fp, "\n"); } if((i-1) % 5 != 0 || i == 1) fprintf(fp, "\n"); } /* check to see that ordering is consistent with deeper lists */ for(f = 0; f < numfaces; f++) { for(k = 0; k < faces[f]->numbehind; k++) { if(faces[f]->depth >= (faces[f]->behind)[k]->depth) { if(first == 0) { first = 1; fprintf(fp, "\nVertices whose depth lists are inconsistent\n"); } fprintf(fp, "%d (%d):", faces[f]->depth, faces[f]->index); for(i = 0; i < faces[f]->numbehind && faces[f]->behind != NULL; i++) { fprintf(fp, " %d (%d)", (faces[f]->behind)[i]->depth, (faces[f]->behind)[i]->index); if(i % 5 == 0 && i != 0) fprintf(fp, "\n"); } if((i-1) % 5 != 0 || i == 1) fprintf(fp, "\n"); break; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -