% name of textfile: P9 curvetraceing (DL/Synergetics Feb 91 v1.0) % .... % ========= % This file requires the previous download of gonzo.psl % available from https://www.tinaja.com/pssamp1.shtml % Make sure the following line agrees with your own gonzo.psl location (C:/Users/don/Desktop/gonzo/gonzo.psl) run % use internal gonzo % ========== % Shows you several fundamental excercises in curvetracing that you % can use to draw smooth continuous lines and curves gutility begin % turn on the gonzo utilities nuisance begin % turn on the nuisance commands printerror % turn on the printing error trapper gonzo begin % turn on the gonzo justification /showfullgrid false def % show entire page grid? 20 20 10 setgrid % get on a grid showfullgrid {57 76 showgrid} if % and maybe show it /cstretch 0.04 def % slight character stretch /sstretch 0.02 def % slight space stretch /font2 /Helvetica-Narrow-Bold 0.8 gonzofont % pick a font %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % curvetrace rules: The curvetrace operator expects an array of form % [ x0 y0 ang0 x1 y1 ang1 .... xn yn angn ] curvetrace, where % % x0 is the horizontal position of your first point % y0 is the vertical position of your first point % ang0 is the direction you wish to LEAVE your first point % with 0 = east 90 = north 180 = west -90 = south % % xn is the horizontal position of your last point % yn is the vertical position of your last point % angn is the direction you wish to ENTER your last point % with 0 = east 90 = north 180 = west -90 = south % % if you want to see where you are, use /showtick true def. To remove % all ticks, use /showtick false def. % % special rule: if x0 and y0 are both exactly zero, then your curve APPENDS % an existing path; if not, a new path is begun. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE #1 % a plain old curvetrace gsave 14 55 translate 10 10 showgrid [1 1 90 3 7 0 5 4.5 -75 9 2.5 0] curvetrace 0.1 setlinewidth stroke 5 -1 (|2plain stroked curvetrace) cc grestore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE #2 % a plain old curvetrace showing your points for debugging gsave 14 40 translate 10 10 showgrid /showtick true def % turn on the ticks /ticklen 1 def /tickhead 0.25 def % set tick size [1 1 90 3 7 0 5 4.5 -75 9 2.5 0] curvetrace 0.1 setlinewidth stroke /showtick false def % turn ticks back off 5 -1 (|2showing points) cc grestore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE #3 % a curvetrace with a cusp % a cusp is done by repeating two x and y points having a different entry % and exit angle. Note how 4,2 repeats here. gsave 14 25 translate 10 10 showgrid [1 6 0 4 2 -90 4 2 90 9 8 0] curvetrace 0.1 setlinewidth stroke 5 -1 (|2curvetrace with a cusp) cc grestore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE #4 % variable linewidth curvetracing. % for variable linewidths, use an "up" path and a "down" path and then fill % between them. WATCH THE PATH SEQUENCE, OR STRANGE THINGS WILL HAPPEN! % Your second path should continue from where the first one leaves you and % end you up back at the beginning. gsave 14 10 translate 10 10 showgrid [1 3 0 4 5 45 9 7 0 9 7 180 6 5 -135 1 3 180] curvetrace fill 5 -1 (|2double filled curvetrace) cc grestore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE #5 % a filled curvetrace % All the previous examples have stroked the path. This one fills it instead gsave 34 55 translate 10 10 showgrid [3 7 45 6 6 -45 7 3 -135 4 4 135 3 7 45 ] curvetrace fill 5 -1 (|2plain filled curvetrace) cc grestore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE #6 % curvetraceing inside a path % The rule: If x0 and y0 are both exactly zero, then the curvetrace APPENDS % itself to an existing path. If not, a new path is begun gsave 34 40 translate 10 10 showgrid 1 5 mt % start the path 3 pr [0 0 0 5 9 180 6 5 0] curvetrace % add a curved portion 3 pr % add another straight part 0.3 setlinewidth 1 setlinecap stroke 5 -1 (|2curvetrace inside a path) cc grestore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE #7 % pipes, braids or wire are done with multiple stroking. % just use superstroke or superinsidestroke for fancy drawing. % with superstroke, an array of [ fattestthick fattestgray .... % thinnestthick thinnestgray] is expected gsave 34 25 translate 10 10 showgrid [2 3 0 8 7 0] curvetrace 1 setlinecap bestgray [0.6 0 0.45 0.9] superstroke % black 0.6 wide and gray 0.45 wide 5 -1 (|2pipe or wire) cc grestore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % EXAMPLE #8 % changing the tension. % an internal parameter called /tension decides how "gung ho" the curve % leaves and enters the points. The "best" tension value is usually % 2.8. Higher tension values make the curvetracing more "rigid" or % straight-line-like. Negative tension values make the curvetracing % "looser" or more loopey. Negative tensions go round the other way. gsave 34 10 translate 10 10 showgrid 0 setlinewidth /ctproc {[3 3 90 7 7 0] curvetrace stroke} def % define a simple curvetrace /tension 0.48 def ctproc % so loopey it overshoots /tension 0.55 def ctproc /tension 0.7 def ctproc % really gung ho /tension 1.0 def ctproc /tension 1.4 def ctproc /tension 2.0 def ctproc /tension 2.8 def ctproc % normal curve /tension 6.0 def ctproc % fairly rigid /tension 100 def ctproc % almost straight /tension -0.8 def ctproc % round the other way. 5 -1 (|2changing tension) cc grestore showpage % eof