root/trunk/pst-map3d/pstricks.pro

Revision 5, 20.5 kB (checked in by jms, 2 years ago)

Déplacement des fichiers de Manuel dans le répertoire pst-map3d.

Line 
1% $Id: pstricks.pro 7 2007-12-29 22:21:13Z herbert $
2%
3% PostScript prologue for pstricks.tex.
4% Version 1.03, 2008/01/01
5% For distribution and copyright, see pstricks.tex.
6%
7%
8systemdict /.setopacityalpha known not {/.setopacityalpha { pop } def } if
9systemdict /.setblendmode known not {/.setblendmode { pop } def } if
10systemdict /.setshapealpha known not {/.setshapealpha { pop } def } if
11%
12/tx@Dict 200 dict def tx@Dict begin
13/ADict 25 dict def
14/CM { matrix currentmatrix } bind def
15/SLW /setlinewidth load def
16/CLW /currentlinewidth load def
17/CP /currentpoint load def
18/ED { exch def } bind def
19/L /lineto load def
20/T /translate load def
21/TMatrix { } def
22/RAngle { 0 } def
23/Sqrt { dup 0 lt { pop 0 } { sqrt } ifelse } def  % return 0 for negative arguments
24/Atan { /atan load stopped { pop pop 0 } if } def % return 0 if atan not known
25/ATAN1 {neg -1 atan 180 sub } def               % atan(x) (only one parameter)
26/Div { dup 0 eq { pop } { div } ifelse } def    % control the division
27/tan { dup cos abs 1.e-10 lt
28  { pop 1.e10 }                                 % return 1.e10 as infinit
29  { dup sin exch cos div } ifelse               % default sin/cos
30} def
31/Tan { dup sin exch cos Div } def               % sin(x)/cos(x) x in degrees
32/Acos {dup dup mul neg 1 add dup 0 lt {         % arc cos, returns 0 when negative root
33  pop pop 0 }{ sqrt exch atan} ifelse } def
34/NET { neg exch neg exch T } def                % change coordinate system to the negative one         
35/Pyth { dup mul exch dup mul add sqrt } def     % Pythagoras, expects 2 parameter
36/Pyth2 {                                        % Pythagoras, xA yA xB yB
37  3 -1 roll             % xA xB yB yA
38  sub                   % xA xB yB-yA
39  3 1 roll              % yB-yA xA xB
40  sub                   % yB-yA xA-xB
41  Pyth } def
42/PtoC { 2 copy cos mul 3 1 roll sin mul } def   % Polar to Cartesian
43%----------------- hv added 20050516 ---------------
44/PiDiv2 1.57079632680 def
45/Pi 3.14159265359 def
46/TwoPi 6.28318530718 def
47/Euler 2.71828182846 def
48%/e Euler bind def
49/RadtoDeg { 180 mul Pi div } bind def % convert from radian to degrees
50/DegtoRad { Pi mul 180 div } bind def % viceversa
51%----------------- hv end---------------------------
52/PathLength@ { /z z y y1 sub x x1 sub Pyth add def /y1 y def /x1 x def } def
53/PathLength { flattenpath /z 0 def
54  { /y1 ED /x1 ED /y2 y1 def /x2 x1 def
55  }{ /y ED /x ED PathLength@ } {} { /y y2 def /x x2 def PathLength@ }
56  /pathforall load stopped { pop pop pop pop } if z } def
57/STP { .996264 dup scale } def
58/STV { SDict begin normalscale end STP  } def
59%
60%%-------------- DG begin patch 15 ---------------%%
61%/DashLine { dup 0 gt { /a .5 def PathLength exch div } { pop /a 1 def
62%PathLength } ifelse /b ED /x ED /y ED /z y x add def b a .5 sub 2 mul y
63%mul sub z Div round z mul a .5 sub 2 mul y mul add b exch Div dup y mul
64%/y ED x mul /x ED x 0 gt y 0 gt and { [ y x ] 1 a sub y mul } { [ 1 0 ]
65%0 } ifelse setdash stroke } def
66/DashLine {
67  dup 0 gt { /a .5 def PathLength exch div } { pop /a 1 def PathLength } ifelse
68  /b ED /x1 ED /y1 ED /x ED /y ED
69  /z y x add y1 add x1 add def
70  /Coef b a .5 sub 2 mul y mul sub z Div round
71    z mul a .5 sub 2 mul y mul add b exch Div def
72  /y y Coef mul def
73  /x x Coef mul def
74  /y1 y1 Coef mul def
75  /x1 x1 Coef mul def
76  x1 0 gt y1 0 gt or x 0 gt or y 0 gt and
77    { [ y x y1 x1 ] 1 a sub y mul }
78    { [ 1 0 ] 0 } ifelse
79  setdash stroke
80} def
81%%-------------- DG end patch 15 ---------------%%
82/DotLine {
83  /b PathLength def
84  /a ED /z ED /y CLW def
85  /z y z add def
86  a 0 gt {
87    /b b a div def
88  }{
89    a 0 eq {
90      /b b y sub def
91    }{ a -3 eq {
92      /b b y add def } if
93    } ifelse
94  } ifelse
95  [ 0 b b z Div round Div dup 0 le { pop 1 } if ]
96  a 0 gt { 0 }{ y 2 div a -2 gt { neg }if } ifelse
97  setdash 1 setlinecap stroke
98} def
99%
100/LineFill { % hv ------------ patch 7 -------------
101  gsave
102  abs /hatchWidthInc ED
103  abs /hatchSepInc ED
104  abs CLW add /a ED
105  a 0 dtransform round exch round exch
106  2 copy idtransform
107  exch Atan rotate
108  idtransform pop /a ED
109  .25 .25 itransform pathbbox
110  /y2 ED
111  a Div ceiling cvi /x2 ED /y1 ED
112  a Div cvi /x1 ED /y2 y2 y1 sub def
113  clip
114  newpath
115  2 setlinecap
116  systemdict
117  /setstrokeadjust known { true setstrokeadjust } if
118  x2 x1 sub 1 add {
119    x1 a mul y1 moveto 0 y2 rlineto stroke
120    /x1 x1 1 add
121      hatchWidthInc 0 gt { CLW add } if
122    def
123    hatchSepInc 0 gt hatchWidthInc 0 gt or {
124      /a a hatchSepInc add def
125      CLW hatchWidthInc add SLW
126    } if
127  } repeat
128  grestore
129  pop pop } def
130%
131%gsave abs CLW add /a ED a 0 dtransform round exch round exch
132%2 copy idtransform exch Atan rotate idtransform pop /a ED .25 .25
133%% DG/SR modification begin - Dec. 12, 1997 - Patch 2
134%%itransform translate pathbbox /y2 ED a Div ceiling cvi /x2 ED /y1 ED a
135%itransform pathbbox /y2 ED a Div ceiling cvi /x2 ED /y1 ED a
136%% DG/SR modification end
137%Div cvi /x1 ED /y2 y2 y1 sub def clip newpath 2 setlinecap systemdict
138%/setstrokeadjust known { true setstrokeadjust } if x2 x1 sub 1 add { x1
139%% DG/SR modification begin - Jun.  1, 1998 - Patch 3 (from Michael Vulis)
140%% a mul y1 moveto 0 y2 rlineto stroke /x1 x1 1 add def } repeat grestore }
141%% def
142%a mul y1 moveto 0 y2 rlineto stroke /x1 x1 1 add def } repeat grestore
143%pop pop } def
144%% DG/SR modification end
145%
146/BeginArrow { ADict begin
147  /@mtrx CM def
148  gsave
149  2 copy T
150  2 index sub neg exch
151  3 index sub exch Atan
152  rotate newpath
153} def
154%
155/EndArrow { @mtrx setmatrix CP grestore end } def
156%
157/Arrow {
158  CLW mul add dup
159  2 div /w ED
160  mul dup /h ED
161  mul /a ED
162  { 0 h T 1 -1 scale } if
163  w neg h moveto
164  0 0 L w h L w neg a neg rlineto
165  gsave fill grestore
166} def
167%
168/ArrowD { % the sides are drawn as curves (hv 20071211)
169  CLW mul add dup
170  2 div /w ED
171  mul dup /h ED
172  mul /Inset ED
173  { 0 h T 1 -1 scale } if % changes the direction
174% we use y=w/h^2 * x^2 as equation for the control points
175% for the coordinates the arrow is seen from top to bottom
176% the bottom (tip) is (0;0)
177  w neg h moveto % lower left of >
178  w 9 div 4 mul neg h 3 div 2 mul
179  w 9 div neg       h 3 div 
180  0 0 curveto    % tip of >
181  w 9 div        h 3 div 
182  w 9 div 4 mul  h 3 div 2 mul
183  w h curveto % upper left of >
184  w neg Inset neg rlineto % move to x=0 and inset
185  gsave fill grestore
186} def
187%
188/Tbar {
189  CLW mul add /z ED
190  z -2 div CLW 2 div moveto
191  z 0 rlineto stroke
192  0 CLW moveto
193} def
194%
195/Bracket {
196  CLW mul add dup CLW sub 2 div
197  /x ED mul CLW add /y ED /z CLW 2 div def
198  x neg y moveto
199  x neg CLW 2 div L x CLW 2 div L x y L stroke
200  0 CLW moveto
201} def
202%
203/RoundBracket {
204  CLW mul add dup 2 div
205  /x ED mul /y ED /mtrx CM def
206  0 CLW 2 div T x y mul 0 ne { x y scale } if
207  1 1 moveto
208  .85 .5 .35 0 0 0 curveto
209  -.35 0 -.85 .5 -1 1 curveto
210  mtrx setmatrix stroke 0 CLW moveto
211} def
212%
213/SD { 0 360 arc fill } def
214%
215/EndDot { % DS is the dot size
216  { /z DS def } { /z 0 def } ifelse
217  /b ED 0 z DS SD b { 0 z DS CLW sub SD } if
218  0 DS z add CLW 4 div sub moveto } def
219%
220/Shadow { [ { /moveto load } { /lineto load } { /curveto load } {
221  /closepath load } /pathforall load stopped { pop pop pop pop CP /moveto
222  load } if ] cvx newpath 3 1 roll T exec } def
223%
224%/NArray {
225%   aload length 2 div dup dup cvi eq not { exch pop } if /n exch
226%   cvi def
227%} def
228%
229/NArray { % holds the coordinates and on top of stack the showpoints boolean
230  /showpoints ED
231  counttomark 2 div dup cvi /n ED
232  n eq not { exch pop } if
233  showpoints { ] aload /Points ED } { n 2 mul 1 add -1 roll pop } ifelse
234} def
235/Line {
236  NArray n 0 eq not
237    { n 1 eq { 0 0 /n 2 def } if ArrowA /n n 2 sub def
238      n { Lineto } repeat
239      CP 4 2 roll ArrowB L pop pop
240    } if
241} def
242/Arcto { /a [ 6 -2 roll ] cvx def a r /arcto load stopped { 5 } { 4 }
243  ifelse { pop } repeat a } def
244/CheckClosed { dup n 2 mul 1 sub index eq 2 index n 2 mul 1 add index eq
245  and { pop pop /n n 1 sub def } if } def
246/Polygon { NArray n 2 eq { 0 0 /n 3 def } if n 3 lt { n { pop pop }
247  repeat } { n 3 gt { CheckClosed } if n 2 mul -2 roll /y0 ED /x0 ED /y1
248  ED /x1 ED x1 y1 /x1 x0 x1 add 2 div def /y1 y0 y1 add 2 div def x1 y1
249  moveto /n n 2 sub def n { Lineto } repeat x1 y1 x0 y0 6 4 roll Lineto
250  Lineto pop pop closepath } ifelse } def
251/Diamond {
252  /mtrx CM def
253  T rotate
254  /h ED
255  /w ED
256  dup 0 eq { pop } { CLW mul neg
257    /d ED
258    /a w h Atan def
259    /h d a sin Div h add def
260    /w d a cos Div w add def } ifelse
261  mark w 2 div h 2 div w 0 0 h neg w neg 0 0 h w 2 div h 2 div
262  /ArrowA { moveto } def
263  /ArrowB { } def
264  false Line
265  closepath mtrx setmatrix } def
266% DG modification begin - Jan. 15, 1997
267%/Triangle { /mtrx CM def translate rotate /h ED 2 div /w ED dup 0 eq {
268%pop } { CLW mul /d ED /h h d w h Atan sin Div sub def /w w d h w Atan 2
269%div dup cos exch sin Div mul sub def } ifelse mark 0 d w neg d 0 h w d 0
270%d /ArrowA { moveto } def /ArrowB { } def false Line closepath mtrx
271%setmatrix } def
272/Triangle { /mtrx CM def translate rotate /h ED 2 div /w ED dup
273CLW mul /d ED /h h d w h Atan sin Div sub def /w w d h w Atan 2
274div dup cos exch sin Div mul sub def mark 0 d w neg d 0 h w d 0
275d /ArrowA { moveto } def /ArrowB { } def false Line closepath mtrx
276% DG/SR modification begin - Jun.  1, 1998 - Patch 3 (from Michael Vulis)
277% setmatrix } def
278setmatrix pop } def
279% DG/SR modification end
280/CCA { /y ED /x ED 2 copy y sub /dy1 ED x sub /dx1 ED /l1 dx1 dy1 Pyth
281def } def
282/CCA { /y ED /x ED 2 copy y sub /dy1 ED x sub /dx1 ED /l1 dx1 dy1 Pyth
283def } def
284/CC { /l0 l1 def /x1 x dx sub def /y1 y dy sub def /dx0 dx1 def /dy0 dy1
285def CCA /dx dx0 l1 c exp mul dx1 l0 c exp mul add def /dy dy0 l1 c exp
286mul dy1 l0 c exp mul add def /m dx0 dy0 Atan dx1 dy1 Atan sub 2 div cos
287abs b exp a mul dx dy Pyth Div 2 div def /x2 x l0 dx mul m mul sub def
288/y2 y l0 dy mul m mul sub def /dx l1 dx mul m mul neg def /dy l1 dy mul
289m mul neg def } def
290/IC { /c c 1 add def c 0 lt { /c 0 def } { c 3 gt { /c 3 def } if }
291ifelse /a a 2 mul 3 div 45 cos b exp div def CCA /dx 0 def /dy 0 def }
292def
293/BOC { IC CC x2 y2 x1 y1 ArrowA CP 4 2 roll x y curveto } def
294/NC { CC x1 y1 x2 y2 x y curveto } def
295/EOC { x dx sub y dy sub 4 2 roll ArrowB 2 copy curveto } def
296/BAC { IC CC x y moveto CC x1 y1 CP ArrowA } def
297/NAC { x2 y2 x y curveto CC x1 y1 } def
298/EAC { x2 y2 x y ArrowB curveto pop pop } def
299/OpenCurve {
300  NArray n 3 lt
301    { n { pop pop } repeat }
302    { BOC /n n 3 sub def n { NC } repeat EOC } ifelse
303} def
304/AltCurve { { false NArray n 2 mul 2 roll [ n 2 mul 3 sub 1 roll ] aload
305/Points ED n 2 mul -2 roll } { false NArray } ifelse n 4 lt { n { pop
306pop } repeat } { BAC /n n 4 sub def n { NAC } repeat EAC } ifelse } def
307/ClosedCurve { NArray n 3 lt { n { pop pop } repeat } { n 3 gt {
308CheckClosed } if 6 copy n 2 mul 6 add 6 roll IC CC x y moveto n { NC }
309repeat closepath pop pop } ifelse } def
310/SQ { /r ED r r moveto r r neg L r neg r neg L r neg r L fill } def
311/ST { /y ED /x ED x y moveto x neg y L 0 x L fill } def
312/SP { /r ED gsave 0 r moveto 4 { 72 rotate 0 r L } repeat fill grestore }
313def
314/FontDot { DS 2 mul dup matrix scale matrix concatmatrix exch matrix
315rotate matrix concatmatrix exch findfont exch makefont setfont } def
316/Rect { x1 y1 y2 add 2 div moveto x1 y2 lineto x2 y2 lineto x2 y1 lineto
317x1 y1 lineto closepath } def
318/OvalFrame { x1 x2 eq y1 y2 eq or { pop pop x1 y1 moveto x2 y2 L } { y1
319y2 sub abs x1 x2 sub abs 2 copy gt { exch pop } { pop } ifelse 2 div
320exch { dup 3 1 roll mul exch } if 2 copy lt { pop } { exch pop } ifelse
321/b ED x1 y1 y2 add 2 div moveto x1 y2 x2 y2 b arcto x2 y2 x2 y1 b arcto
322x2 y1 x1 y1 b arcto x1 y1 x1 y2 b arcto 16 { pop } repeat closepath }
323ifelse } def
324/Frame { CLW mul /a ED 3 -1 roll 2 copy gt { exch } if a sub /y2 ED a add
325/y1 ED 2 copy gt { exch } if a sub /x2 ED a add /x1 ED 1 index 0 eq {
326pop pop Rect } { OvalFrame } ifelse } def
327/BezierNArray { /f ED counttomark 2 div dup cvi /n ED n eq not { exch pop
328} if n 1 sub neg 3 mod 3 add 3 mod { 0 0 /n n 1 add def } repeat f { ]
329aload /Points ED } { n 2 mul 1 add -1 roll pop } ifelse } def
330/OpenBezier { BezierNArray n 1 eq { pop pop } { ArrowA n 4 sub 3 idiv { 6
3312 roll 4 2 roll curveto } repeat 6 2 roll 4 2 roll ArrowB curveto }
332ifelse } def
333/ClosedBezier { BezierNArray n 1 eq { pop pop } { moveto n 1 sub 3 idiv {
3346 2 roll 4 2 roll curveto } repeat closepath } ifelse } def
335/BezierShowPoints { gsave Points aload length 2 div cvi /n ED moveto n 1
336sub { lineto } repeat CLW 2 div SLW [ 4 4 ] 0 setdash stroke grestore }
337def
338/Parab { /y0 exch def /x0 exch def /y1 exch def /x1 exch def /dx x0 x1
339sub 3 div def /dy y0 y1 sub 3 div def x0 dx sub y0 dy add x1 y1 ArrowA
340x0 dx add y0 dy add x0 2 mul x1 sub y1 ArrowB curveto /Points [ x1 y1 x0
341y0 x0 2 mul x1 sub y1 ] def } def
342%
343/Grid {
344  newpath
345  /a 4 string def
346  /b ED /c ED /n ED
347  cvi dup 1 lt { pop 1 } if
348  /s ED
349  s div dup 0 eq { pop 1 } if
350  /dy ED s div dup 0 eq { pop 1 } if
351  /dx ED dy div round dy mul
352  /y0 ED dx div round dx mul
353  /x0 ED dy div round cvi
354  /y2 ED dx div round cvi
355  /x2 ED dy div round cvi
356  /y1 ED dx div round cvi
357  /x1 ED
358  /h y2 y1 sub 0 gt { 1 } { -1 } ifelse def
359  /w x2 x1 sub 0 gt { 1 } { -1 } ifelse def
360  b 0 gt {
361    /z1 b 4 div CLW 2 div add def
362%    /Helvetica findfont b scalefont setfont
363    /b b .95 mul CLW 2 div add def } if
364  systemdict /setstrokeadjust known
365    { true setstrokeadjust /t { } def }
366    { /t { transform 0.25 sub round 0.25 add exch 0.25 sub round 0.25 add
367       exch itransform } bind def } ifelse
368  gsave n 0 gt { 1 setlinecap [ 0 dy n div ] dy n div 2 div setdash } { 2 setlinecap } ifelse
369  /i x1 def
370  /f y1 dy mul n 0 gt { dy n div 2 div h mul sub } if def
371  /g y2 dy mul n 0 gt { dy n div 2 div h mul add } if def
372  x2 x1 sub w mul 1 add dup 1000 gt { pop 1000 } if
373  { i dx mul dup y0 moveto
374    b 0 gt
375      { gsave c i a cvs dup stringwidth pop
376        /z2 ED w 0 gt {z1} {z1 z2 add neg} ifelse
377        h 0 gt {b neg}{z1} ifelse
378        rmoveto show grestore } if
379    dup t f moveto
380    g t L stroke
381    /i i w add def
382  } repeat
383  grestore
384  gsave
385  n 0 gt
386  % DG/SR modification begin - Nov. 7, 1997 - Patch 1
387  %{ 1 setlinecap [ 0 dx n div ] dy n div 2 div setdash }
388    { 1 setlinecap [ 0 dx n div ] dx n div 2 div setdash }
389  % DG/SR modification end
390    { 2 setlinecap } ifelse
391  /i y1 def
392  /f x1 dx mul n 0 gt { dx n div 2 div w mul sub } if def
393  /g x2 dx mul n 0 gt { dx n div 2 div w mul add } if def
394  y2 y1 sub h mul 1 add dup 1000 gt { pop 1000 } if
395  { newpath i dy mul dup x0 exch moveto
396    b 0 gt { gsave c i a cvs dup stringwidth pop
397      /z2 ED
398      w 0 gt {z1 z2 add neg} {z1} ifelse
399      h 0 gt {z1} {b neg} ifelse
400      rmoveto show grestore } if
401    dup f exch t moveto
402    g exch t L stroke
403    /i i h add def
404  } repeat
405  grestore
406} def
407%
408/ArcArrow {
409  /d ED /b ED /a ED
410  gsave
411  newpath 0 -1000 moveto clip
412  newpath
413  0 1 0 0 b
414  grestore
415  c mul
416  /e ED
417  pop pop pop r a e d PtoC y add exch x add
418  exch r a PtoC y add exch x add exch b pop pop pop pop a e d CLW 8 div c
419  mul neg d
420} def
421%
422/Ellipse { /mtrx CM def T scale 0 0 1 5 3 roll arc mtrx setmatrix } def
423%
424/ArcAdjust { %%%% Vincent Guirardel
425% given a target length (targetLength) and an initial angle (angle0) [in the stack],
426% let  M(angle0)=(rx*cos(angle0),ry*sin(angle0))=(x0,y0).
427% This computes an angle t such that (x0,y0) is at distance
428% targetLength from the point M(t)=(rx*cos(t),ry*sin(t)).
429% NOTE: this an absolute angle, it does not have to be added or substracted to angle0
430% contrary to TvZ's code.
431% To achieve, this, one iterates the following process: start with some angle t,
432% compute the point M' at distance targetLength of (x0,y0) on the semi-line [(x0,y0) M(t)].
433% Now take t' (= new angle) so that (0,0) M(t') and M' are aligned.
434%
435% Another difference with TvZ's code is that we need d (=add/sub) to be defined.
436% the value of d = add/sub is used to know on which side we have to move.
437% It is only used in the initialisation of the angle before the iteration.
438%
439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
440% Input stack:  1: target length 2: initial angle
441% variables used : rx, ry, d (=add/sub)
442%
443  /targetLength ED /angle0 ED
444  /x0 rx angle0 cos mul def
445  /y0 ry angle0 sin mul def
446% we are looking for an angle t such that (x0,y0) is at distance targetLength
447% from the point M(t)=(rx*cos(t),ry*sin(t)))
448%initialisation of angle (using 1st order approx = TvZ's code)
449  targetLength 57.2958 mul
450  angle0 sin rx mul dup mul
451  angle0 cos ry mul dup mul
452  add sqrt div
453% if initialisation angle is two large (more than 90 degrees) set it to 90 degrees
454% (if the ellipse is very curved at the point where we draw the arrow, %
455% the value can be much more than 360 degrees !)
456% this should avoid going on the wrong side (more than 180 degrees) or go near
457% a bad attractive point (at 180 degrees)
458  dup 90 ge { pop 90 } if
459  angle0 exch d % add or sub
460% maximum number of times to iterate the iterative procedure:
461% iterative procedure: takes an angle t on top of stack, computes a
462% better angle (and put it on top of stack)
463  30 { dup
464% compute distance D between (x0,y0) and M(t)
465    dup cos rx mul x0 sub dup mul exch sin ry mul y0 sub dup mul add sqrt
466% if D almost equals targetLength, we stop
467    dup targetLength sub abs 1e-5 le { pop exit } if
468% stack now contains D t
469% compute the point M(t') at distance targetLength of (x0,y0) on the semi-line [(x0,y0) M(t)]:
470% M(t')= ( (x(t)-x0)*targetLength/d+x0 , (y(t)-y0)*targetLength/d+y0 )
471    exch dup cos rx mul x0 sub  exch sin ry mul y0 sub
472% stack contains:  y(t)-y0, x(t)-x0, d
473    2 index Div targetLength mul y0 add ry Div exch
474    2 index Div targetLength mul x0 add rx Div
475% stack contains x(t')/rx , y(t')/ry , d
476% now compute t', and remove D from stack
477    atan exch pop
478  } repeat
479% we don't look at what happened... in particular, if targetLength is greater
480% than the diameter of the ellipse...
481% the final angle will be around /angle0 + 180. maybe we should treat this pathological case...
482% after iteration, stack contains an angle t such that M(t) is the tail of the arrow
483% to give back the result as a an angle relative to angle0 we could add the following line:
484% angle0 sub 0 exch d
485%
486% begin bug fix 2006-01-11
487% we want to adjust the new angle t' by a multiple of 360 so that  | t'-angle0 | <= 180
488%(we don't want to make the ellipse turn more or less than it should)...
489dup angle0 sub dup abs 180 gt { 180 add 360 div floor 360 mul sub } { pop } ifelse
490% end bug fix
491} def
492%
493/EllipticArcArrow {
494  /d ED      % is add or sub
495  /b ED      % arrow procedure
496  /a1 ED     % angle
497  gsave
498  newpath
499  0 -1000 moveto
500  clip                  % Set clippath far from arrow.
501  newpath
502  0 1 0 0 b             % Draw arrow to determine length.
503  grestore
504% Length of arrow is on top of stack. Next 3 numbers are junk.
505%
506  a1 exch ArcAdjust   % Angular position of base of arrow.
507  /a2 ED
508  pop pop pop
509  a2 cos rx mul xOrig add % hv 2007-08-29   x->xOrig
510  a2 sin ry mul yOrig add % hv 2007-08-29   y->yOrig
511  a1 cos rx mul xOrig add %
512  a1 sin ry mul yOrig add %
513% Now arrow tip coor and base coor are on stack.
514  b pop pop pop pop       % Draw arrow, and discard coordinates.
515  a2 CLW 8 div
516% change value of d (test it by looking if  `` 1 1 d '' gives 2 or not )
517  1 1 d 2 eq { /d { sub } def } { /d { add } def } ifelse
518  ArcAdjust
519% resets original value of d
520  1 1 d 2 eq { /d { sub } def } { /d { add } def } ifelse  % Adjust angle to give overlap.
521} def
522%%------------------ tvz/DG/hv (2004-05-10) end -------------------%%
523%
524/Rot { CP CP translate 3 -1 roll neg rotate NET  } def
525%
526/RotBegin {
527  tx@Dict /TMatrix known not { /TMatrix { } def /RAngle { 0 } def } if
528  /TMatrix [ TMatrix CM ] cvx def
529  /a ED
530  a Rot /RAngle [ RAngle dup a add ] cvx def
531} def
532%
533/RotEnd { /TMatrix [ TMatrix setmatrix ] cvx def /RAngle [ RAngle pop ] cvx def } def
534%
535/PutCoor { gsave CP T CM STV exch exec moveto setmatrix CP grestore } def
536/PutBegin { /TMatrix [ TMatrix CM ] cvx def CP 4 2 roll T moveto } def
537/PutEnd { CP /TMatrix [ TMatrix setmatrix ] cvx def moveto } def
538/Uput { /a ED add 2 div /h ED 2 div /w ED /s a sin def /c a cos def /b s
539abs c abs 2 copy gt dup /q ED { pop } { exch pop } ifelse def /w1 c b
540div w mul def /h1 s b div h mul def q { w1 abs w sub dup c mul abs } {
541h1 abs h sub dup s mul abs } ifelse } def
542/UUput { /z ED abs /y ED /x ED q { x s div c mul abs y gt } { x c div s
543mul abs y gt } ifelse { x x mul y y mul sub z z mul add sqrt z add } { q
544{ x s div } { x c div } ifelse abs } ifelse a PtoC h1 add exch w1 add
545exch } def
546/BeginOL { dup (all) eq exch TheOL eq or { IfVisible not { Visible
547/IfVisible true def } if } { IfVisible { Invisible /IfVisible false def
548} if } ifelse } def
549/InitOL { /OLUnit [ 3000 3000 matrix defaultmatrix dtransform ] cvx def
550/Visible { CP OLUnit idtransform T moveto } def /Invisible { CP OLUnit
551neg exch neg exch idtransform T moveto } def /BOL { BeginOL } def
552/IfVisible true def } def
553end
554%-----------------------------------------------------------------------------%
555
556% END pstricks.pro
Note: See TracBrowser for help on using the browser.