%!PS % name of textfile: Pxx Perspective Revisited(DL/Synergetics Feb 02 Aug 19 v2.0) % .... % ========= % This file requires the previous download of gonzo.ps % available from http://www.tinaja.com/post01.asp % Make sure the following line agrees with your gonzo.ps location % Use DOUBLE SLASHES anytime you want a single slash in a PS string. % (C:\\windows\\desktop\\gonzo\\gonzo.ps) run % use internal gonzo % ========== % gonzo begin % gutility begin % printerror % nuisance begin %%% Gonzofont extractiosn %%%%% /gonzofont {dup type cvlit /arraytype eq {exch findfont exch makefont} {exch findfont exch scalefont} ifelse setfont mark /spacewidth ( ) stringwidth pop /cstretch cvx /add cvx /sstretch cvx /add cvx /def cvx currentfont dup backcdict exch (F?) dup 1 14 index (xxxxx) cvs 4 get put put /setfont cvx ] cvx def} def 50 dict /backcdict exch def /cstretch 0.2 def % minimum character kerning /sstretch -0.3 def /mt {moveto} def /li {lineto} def /rm {rmoveto} def /rl {rlineto} def /ct {curveto} def /cp {closepath} def /f {fill} def /pd {0 exch neg rl} def /pr { 0 rl} def /pu {0 exch rl} def /pl {neg 0 rl} def /line1 {.06 dup setlinewidth 5 mul /erase exch def} def /line2 {.12 dup setlinewidth 5 mul /erase exch def} def /line3 {.18 dup setlinewidth 5 mul /erase exch def} def % ///////// (A) WEB FRIENDLY COLOR UTILITIES ///////////// % tintmat is a self-generating list of 216 triple color values /webtintmat [ 0 1 5 { /a exch store 0 1 5 { /b exch store 0 1 5 { 5 div b 5 div a 5 div }for } for } for ] def % setwebtint accepts a color number 0 to 215 and then % sets the PostScript color generator for later use... /setwebtint { abs cvi 216 cvi mod % restrict range webtintmat exch 3 mul 3 getinterval % get values from table aload pop setrgbcolor} def % and set them % The blocks are arranged as red to the right, green % up in order of increasing blue. % Some "pure color" sequences are % red: 0 1 2 3 4 5 % orange: 0 7 8 15 16 23 (sort of) % yellow: 0 7 14 21 28 35 % green: 0 6 12 18 24 30 % aqua: 0 42 84 126 168 210 % blue: 0 36 72 108 144 180 % magenta: 0 37 74 111 148 185 % purple 0 73 73 110 147 183 (sort of) % gray 0 43 86 129 172 215 % Rewritten code does the 2 point "architect" perspective transform % 100 100 10 setgrid % not defined above % 26 17 showgrid %% fudged figure save /fudge exch store 0 0 translate 1 dup scale % adjust position % perspective transform is % x0 y0 z0 distances from observer to 0 0 0 perspective origin % x is left right y is in out z is up down % x' = y0(x-x0)/(y+y0) % y must go first !! % y' = y0(z-z0)/(y+y0) % this example will use a fixed y for a flat panel. /x0 -250 def % left right observer to 000 origin /y0 700 def % in out observer to 000 origin was 700 /z0 400 def % up-down observer to 000 origin /objrot 25 store % rotation of object in x y plane % This is the raw transform that accept three variables x,y,z and returns 2D x' y' /ptransform { /zz1 exch store /yy1 exch store /xx1 exch store /yy xx1 objrot sin mul yy1 objrot cos mul add store % rotate /xx xx1 objrot cos mul yy1 objrot sin mul sub store y0 xx x0 sub yy y0 add div mul % generate x' y0 zz1 z0 sub yy y0 add div mul % generate y' } def % This is a perspective moveto /pmoveto { 3 copy /lastzmt exch store /lastz lastzmt store /lastymt exch store /lasty lastymt store /lastxmt exch store /lastx lastxmt store ptransform moveto } def /plineto {3 copy /lastz exch store /lasty exch store /lastx exch store ptransform lineto } def /pcurveto {/z3 exch store /y3 exch store /x3 exch store % NOTE: NEEDS NINE VARS /z2 exch store /y2 exch store /x2 exch store /z1 exch store /y1 exch store /x1 exch store /lastz z3 store /lasty y3 store /lastx x3 store x1 y1 z1 ptransform x2 y2 z2 ptransform x3 y3 z3 ptransform curveto } def /pclosepath { lastxmt lastymt lastzmt ptransform lineto closepath } def % enter with yy pxzremap /pxzremap { /yy exch store mark {yy exch /pmoveto cvx } {yy exch /plineto cvx } { /zz3 exch store /xx3 exch store /zz2 exch store /xx2 exch store /zz1 exch store /xx1 exch store xx1 yy zz1 xx2 yy zz2 xx3 yy zz3 /pcurveto cvx} {/pclosepath cvx } pathforall ] newpath cvx exec } def /pyzremap { /xx exch store mark {/zz exch store neg /yy exch store xx yy zz /pmoveto cvx } {/zz exch store neg /yy exch store xx yy zz /plineto cvx } { /zz3 exch store neg /yy3 exch store /zz2 exch store neg /yy2 exch store /zz1 exch store neg /yy1 exch store xx yy1 zz1 xx yy2 zz3 xx yy3 zz3 /pcurveto cvx} {/pclosepath cvx } pathforall ] newpath cvx exec } def /pxyremap { /zz exch store mark {zz /pmoveto cvx } {zz /plineto cvx } { /yy3 exch store /xx3 exch store /yy2 exch store /xx2 exch store /yy1 exch store /xx1 exch store xx1 yy1 zz xx2 yy2 zz xx3 yy3 zz /pcurveto cvx} {/pclosepath cvx } pathforall ] newpath cvx exec } def % ptranslate accepts x y and z and moves the origin. Should be gsave bracketed % ALGORITHM WRONG. MAGNIFIED FRONT RETAINED. /ptranslate {/zf exch store /yf exch store /xf exch store 0 0 0 ptransform /yp exch store /xp exch store xf yf zf ptransform yp sub exch xp sub exch translate} def /showxz {/yyy exch store false charpath yyy pxzremap} def /showyz {/xxx exch store false charpath xxx pyzremap} def /showxy {/zzz exch store false charpath zzz pxyremap} def /font1 /StoneSerif-Bold 92 gonzofont font1 0 600 translate 1 dup scale /objrot 25 store % was 25 157 setwebtint 0 0 mt 100 pu 100 pr 100 pd closepath 0 pxzremap fill 213 setwebtint 8 8 mt 84 pu 84 pr 84 pd closepath 0 pxzremap fill 157 setwebtint 14 18 moveto (A) 0 showxz fill % yz runs negative into picture so lettering is right reading 18 setwebtint -100 0 mt 100 pu 100 pr 100 pd closepath 0 pyzremap fill 30 setwebtint -92 8 mt 84 pu 84 pr 84 pd closepath 0 pyzremap fill 18 setwebtint -86 18 moveto (B) 0 showyz fill 5 setwebtint 0 0 mt 100 pu 100 pr 100 pd closepath 100 pxyremap fill 173 setwebtint 8 8 mt 84 pu 84 pr 84 pd closepath 100 pxyremap fill 5 setwebtint 18 18 moveto (C) 100 showxy fill showpage % eof