% name of textfile: Pxx Perspective Revisited(DL/Synergetics Feb 02 v1.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 % Rewritten code does the 2 point "architect" perspective transform % 100 100 10 setgrid % 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 0.62 settint 0 0 mt 100 pu 100 pr 100 pd closepath 0 pxzremap 0.30 setgray fill 8 8 mt 84 pu 84 pr 84 pd closepath 0 pxzremap 0.85 setgray fill 14 18 moveto (A) 0 showxz 0.30 setgray fill % yz runs negative into picture so lettering is right reading 0.33 settint -100 0 mt 100 pu 100 pr 100 pd closepath 0 pyzremap 0.30 setgray fill -92 8 mt 84 pu 84 pr 84 pd closepath 0 pyzremap 0.85 setgray fill -86 18 moveto (B) 0 showyz 0.30 setgray fill 0 settint 0 0 mt 100 pu 100 pr 100 pd closepath 100 pxyremap 0.30 setgray fill 8 8 mt 84 pu 84 pr 84 pd closepath 100 pxyremap 0.85 setgray fill 14 18 moveto (C) 100 showxy 0.30 setgray fill showpage % eof