%! % Revised fattail utilities fattail3.psl % ============================================================== % Copyright c 2018 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % Linking welcome. Reposting expressly forbidden. % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 1.1 % This is a revision of the fattail utilities of GuruGram 117. The new code is more % compact, relative for all but the tips, offset oriented, and includes optional controls % and web friendly color access. The Gonzo Utilities are not needed for the basic % fattail code but remain extremely useful for demos and general fattail apps %%////// Extracted Gonzo Utilities ////// /mt {moveto} store /rm {rmoveto} def /rl {rlineto} def /pr { 0 rl} def /pu {0 exch rl} def /pl {neg 0 rl} def /thingridlines {0} def /setgrid { /blocksize exch def translate % simplified blocksize dup scale} def /showgrid {gsave /vblocks exch def /hblocks exch def thingridlines setlinewidth [{0 0 moveto 0 vblocks rlineto stroke} 1 hblocks 1 add] xrpt [{0 0 moveto hblocks 0 rlineto stroke} 1 vblocks 1 add] yrpt fatterborder { gsave newpath 0 0.96 blocksize div dtransform round idtransform setlinewidth pop 2 setlinecap 0 0 moveto hblocks 0 rlineto 0 vblocks rlineto hblocks neg 0 rlineto closepath stroke grestore} if fat5 { gsave newpath 0 0.48 blocksize div dtransform round idtransform setlinewidth pop mark {5 0 moveto 0 vblocks rlineto stroke} 5 hblocks 5 div cvi] xrpt mark {0 5 moveto hblocks 0 rlineto stroke} 5 vblocks 5 div cvi] yrpt grestore} if fatter10 { gsave newpath 0 0.96 blocksize div dtransform round idtransform setlinewidth pop mark {10 0 moveto 0 vblocks rlineto stroke} 10 hblocks 10 div cvi] xrpt mark {0 10 moveto hblocks 0 rlineto stroke} 10 vblocks 10 div cvi] yrpt grestore} if grestore} def /fatterborder {true} store /fat5 {false} store /fatter10 { false} store /showdots { false } store /dot { showdots { currentpoint newpath 0.150 0 360 arc fill }if} def /mdot { m dot} def % repeats [ proc distance trips] xrpt /xrpt{gsave aload pop /trips exch def /dist exch def /rproc exch def trips { gsave rproc grestore dist 0 translate } repeat grestore} def /yrpt{gsave aload pop /trips exch def /dist exch def /rproc exch def trips { gsave rproc grestore 0 dist translate } repeat grestore} def /black {0 setwebtint} store % ///////// (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 %%%%%%%%%%%% extractable new fattaill utilities %%%%%%%%%%%%% % format tipx tipy arrlen tailoff tipthk tailthk tipsiz tipwid /grab {gsave aload pop /tipsiz exch store % collect data from input array /tipwid exch store /tailthk exch store /tipthk exch store /tailoff exch store /arrlen exch store /body arrlen tipsiz sub store tailoff 0 lt {/tailthk tailthk -1 mul store } if % always down on outside translate } store /showpoint {wantpoints {2 copy save /spsave exch store 5 setwebtint mt dot spsave restore} if} store /wantpoints true store /tailtension 2.5 pop 2 store % default = 2.5 /tiptension 1.5 pop 2 store % default =1.5 use 0.2 for twist! /strarrow { rotate 0 0 mt tipwid 2 div neg tipsiz neg rlineto % draw the point tipwid 0 rlineto closepath fill tipthk 2 div tailoff 0 lt {neg} if % repair negative offset tipsiz neg showpoint mt % position arrow right tipthk 2 div tailoff 0 lt {neg} if % repair negative offset body tiptension div tipsiz add neg showpoint % control 1 tailoff tailthk 2 div add arrlen neg body tailtension div add showpoint % control 2 tailoff tailthk 2 div add arrlen neg showpoint % tail right dest curveto tailthk neg 0 rlineto % tail bottom wantpoints {currentpoint showpoint} if tailoff tailthk 2 div sub arrlen neg body tailtension div add showpoint % control 3 tipthk 2 div neg tailoff 0 lt {neg} if % repair negative offset body tiptension div neg tipsiz sub showpoint % control 4 tipthk 2 div neg tailoff 0 lt {neg} if % repair negative offset tipsiz neg showpoint curveto % position arrow left fill grestore} store % fill arrow body /rtarrow { rotate 0 0 mt tipwid 2 div neg tipsiz neg rlineto % draw the point tipwid 0 rlineto closepath fill tipthk 2 div tipsiz neg showpoint mt % position arrow right tipthk 2 div arrlen tiptension div tipsiz add neg showpoint % control 1 arrlen neg arrlen tiptension div add tailoff tailthk 2 div add neg showpoint % control 2 arrlen neg tailoff tailthk 2 div add neg showpoint % tail lower destt curveto 0 tailthk rlineto wantpoints {currentpoint showpoint} if % tail top dest arrlen neg arrlen tiptension div add tailoff tailthk 2 div sub neg showpoint % control 3 tipthk 2 div neg arrlen tiptension div tipsiz add neg showpoint % control 4 tipthk 2 div neg tipsiz neg showpoint % position arrow left curveto fill grestore} store % fill arrow body % points /ftailsn {grab 0 strarrow} store /ftailew {grab 90 strarrow} store /ftailns {grab -1 1 scale 180 strarrow} store /ftailwe{grab 1 -1 scale -90 strarrow} store /rtailwn {grab 0 rtarrow} store /rtailen {grab -1 1 scale 0 rtarrow} store /rtailws {grab -1 1 scale 180 rtarrow} store /rtailes {grab 180 rtarrow} store /rtailne {grab -90 rtarrow} store /rtailsw {grab 90 rtarrow} store /rtailse {grab -1 1 scale 90 rtarrow} store /rtailnw {grab -1 1 scale -90 rtarrow} store %%%%%%%%% /figure1.124 { gsave 0 0 translate % needs external positioning 0 0 mt 30 pr 22 pu 30 pl closepath 213 setwebtint fill black 30 setwebtint 30 22 showgrid black % format tipx tipy arrlen tailoff tipthk tailthk tipwd tipsiz 196 setwebtint 12345 srand % change this for different arrow colors /cx {215 rand setwebtint} store cx [ 6 2 3 3.5 1 2 3 1 ] rtailne cx [2 9 8 3 1 4 3 1 ] ftailns cx [10 17 13 -3.5 1 4 3 1] ftailsn cx [1 19.5 2.5 14 1 3 3 1] rtailsw cx [19 15 10 4.5 1 2 3 1] rtailes cx [16 15 5 -2.5 1 3 3 1] ftailwe cx [9 2 5 8 1 4 3 1 ] ftailew cx [ 13 2 4 4 1 3 3 1]rtailnw cx [ 25 7 3 3 1 2 3 1 ] rtailen cx [ 24 12 5 9 1 3 3 1 ] rtailwn cx [ 22 14 7 5 1 4 3 1 ] rtailse cx [ 28 10 5 4 1 3 3 1 ] rtailws } store /figure1.118 {} store % used for early degub /figure2.118 {} store % used for early degub %%%%%%%%%%%% page content demo starts here %%%%%%%%%%%%%% % demo of fat tail utilities... 160 480 10 setgrid % gonzo works best at 10x scale figure1.124 showpage % EOF