Debian Codegraph @

texmf-dist/tex/latex/lapdf/lapdf.sty

raw
1 % =========================================================================
2 % LAPDF.STY: Version 1.1, Copyright(C) 2006-2011, Detlef Reimers
3 % Lapdf is distributed under the terms of the GNU general public licence
4 % -------------------------------------------------------------------------
5 % Email: [email protected] Website: http://detlefreimers.de
6 % =========================================================================
7 \NeedsTeXFormat{LaTeX2e}
8 \ProvidesPackage{lapdf}[2006/04/09 v1.0 Drawing with pdfTeX]
9 \RequirePackage{calc}
10
11 \newtoks\@c \newtoks\@d \newtoks\@e \newtoks\@f
12
13 \let\@ta\@tempcnta \let\@tb\@tempcntb \newcount\@@s
14 \newcount\@@i \newcount\@@k \newcount\@@n \newcount\col
15 \newcount\@az \newcount\@bz \newcount\@cz \newcount\@xz
16 \newcount\@ca \newcount\@cb \newcount\@cc \newcount\@cd
17 \newcount\@ce \newcount\@cf \newcount\@cg \newcount\@ch
18 \newcount\@ci \newcount\@ck \newcount\@cl \newcount\@cm
19 \newcount\@cn
20
21 \let\@tbox\@tempboxa
22 \let\@@a\@ovdx \let\@@b\@ovdy \let\@@t\@ovxx \let\@@u\@ovyy
23 \newdimen\wid \newdimen\tmp
24 \newdimen\@@d \newdimen\@@m \newdimen\@@x \newdimen\@@y
25 \newdimen\@@A \newdimen\@@B \newdimen\@@C \newdimen\@@D
26 \newdimen\@@T \newdimen\@@U \newdimen\@@X \newdimen\@@Y
27 \newdimen\@CR \newdimen\@CG \newdimen\@CB
28 \newdimen\@ax \newdimen\@ay \newdimen\@az
29 \newdimen\@bx \newdimen\@by \newdimen\@bz
30 \newdimen\@cx \newdimen\@cy \newdimen\@cz
31 \newdimen\@dx \newdimen\@dy \newdimen\@dz
32 \newdimen\@ex \newdimen\@ey \newdimen\@ez
33 \newdimen\@fx \newdimen\@fy \newdimen\@fz
34 \newdimen\@gx \newdimen\@gy \newdimen\@gz
35 \newdimen\@hx \newdimen\@hy \newdimen\@hz
36 \newdimen\@rx \newdimen\@ry \newdimen\@rz \newdimen\@rw
37 \newdimen\@sx \newdimen\@sy \newdimen\@tx \newdimen\@ty
38 \newdimen\@ux \newdimen\@uy \newdimen\@vx \newdimen\@vy
39 \newdimen\@wx \newdimen\@wy
40 \newdimen\@xx \newdimen\@xy \newdimen\@xz
41 \newdimen\@zx \newdimen\@zy \newdimen\@zz
42 \newdimen\@yx \newdimen\@yy
43
44 % -------------------------------------------------------------------------
45 \@ck=0
46 \wid=0.35pt
47
48 % -------------------------------------------------------------------------
49 \DeclareOption{black}{%
50 \@cl=0
51 \gdef\Resetcol{}
52 \gdef\Stepcol(#1,#2,#3){}
53 \gdef\Nextcol(#1,#2){}
54 }
55 \DeclareOption{color}{%
56 \@cl=1
57 \gdef\Resetcol{\col=-1}
58 \gdef\Stepcol(#1,#2,#3){%
59 \@cc=\col \Add(\@cc,#3)
60 \ifnum#1<0 \@ca=0 \else \@ca=#1 \fi
61 \ifnum#2>95 \@cb=95 \else \@cb=#2 \fi
62 \ifnum\col<\@ca \col=\@ca \else
63 \ifnum\col>\@cb \col=\@ca \else
64 \ifnum\@cc<\@ca \col=\@ca \else
65 \ifnum\@cc>\@cb \col=\@ca \else \col=\@cc \fi\fi\fi\fi
66 \ifnum\col<96%
67 \Colval(\col,8,\@rx)
68 \Colval(\col,0,\@gx)
69 \Colval(\col,16,\@bx)
70 \Setcol(\Np\@rx,\Np\@gx,\Np\@bx) \fi}
71 \gdef\Nextcol(#1,#2){\Stepcol(#1,#2,1)}
72 }
73
74 % -------------------------------------------------------------------------
75 % Calculates the cromatic intensity of a specific color. n is the color,
76 % d is the color offset (r: 8, g: 0, b: 16) and r is the result register.
77 % \Colval(n,d,r)
78 % -------------------------------------------------------------------------
79 \gdef\Colval(#1,#2,#3){%
80 \ifnum#1>71 \@cm=3 \else \ifnum#1>47 \@cm=2 \else
81 \ifnum#1>23 \@cm=1 \else \@cm=0 \fi \fi \fi
82 \@cn=#1 \Add(\@cn,#2) \Mod(\@cn,24)
83 \Sub(\@cn,8) \Abs(\@cn)
84 \ifnum\@cn<4 \Dset(#3,1) \else
85 \ifnum\@cn<8 \Dset(#3,8) \Dsub(#3,\@cn)
86 \Div(#3,4) \else \Dset(#3,0) \fi \fi
87 \Dset(\@tx,5) \Dsub(\@tx,\@cm) \Dmul(#3,\@tx) \Div(#3,5) \Crnd(#3)}
88
89 % -------------------------------------------------------------------------
90 % This macro is only necessary, because my TeX compiler under MacOS9.2
91 % says 'out of color stack space' without the rounding. With this function,
92 % all color values have two digits or less. \Crnd(col)
93 % -------------------------------------------------------------------------
94 \gdef\Crnd(#1){\Ddiv(#1,0.0999pt) \Mul(#1,10) \Dint(#1) \Ddiv(#1,100pt)}
95
96 % -------------------------------------------------------------------------
97 \ExecuteOptions{black}
98 \ProcessOptions
99 \ifnum\@cl>0 \AtBeginDocument{\Resetcol} \fi
100
101 % -------------------------------------------------------------------------
102 % Strips the pt dimension
103 % -------------------------------------------------------------------------
104 {\catcode`t=12\catcode`p=12\gdef\nP#1pt{#1}}
105 \gdef\Np#1{\expandafter\nP\the#1}%
106
107 % -------------------------------------------------------------------------
108 % \Lapdf{} the Lapdf logo
109 % -------------------------------------------------------------------------
110 \def\Lapdf{L\kern-.2em\lower.5ex\hbox{A}\kern-.15emPDF}
111
112 % -------------------------------------------------------------------------
113 % \pdfTeX{} a pdfTeX logo
114 % -------------------------------------------------------------------------
115 \def\pdfTeX{\hbox{pdf}\kern+.05em\TeX{}}
116
117 % -------------------------------------------------------------------------
118 % \PDF{cmd} for the pdf specials, which are used here
119 % -------------------------------------------------------------------------
120 \gdef\PDF#1{\@killglue\special{pdf:#1}}
121
122 % -------------------------------------------------------------------------
123 % \lapdf(x1,y1)(x2,y2) the lapdf environment
124 % -------------------------------------------------------------------------
125 \newcommand{\pdf}{\Gsave \Scale(\Np\unitlength,\Np\unitlength)
126 \Setwidth(0.02) \Setcap(1) \Setdash([] 0)}
127 \def\endpdf{\Grestore}
128
129 \newcommand{\lapdf}{\@pdfpict}
130 \gdef\@pdfpict(#1,#2)(#3,#4){\begin{picture}(#1,#2)(#3,#4) \begin{pdf}}
131 \def\endlapdf{\end{pdf} \end{picture}}
132
133 % -------------------------------------------------------------------------
134 % Gets the unit length from document. Define and set a register.
135 % -------------------------------------------------------------------------
136 \gdef\Ul{\unitlength}
137 \gdef\Set(#1,#2){#1=#2}
138 \gdef\Dset(#1,#2){#1=#2pt}
139 \gdef\Defnum(#1,#2){\newcount#1 #1=#2}
140 \gdef\Defdim(#1,#2){\newdimen#1 #1=#2pt}
141
142 % -------------------------------------------------------------------------
143 % Two macros for count or dimen registers. If nested, you have to use
144 % brackets around the inner looop.
145 % \whilenum{num condition}{commands} \whiledim{dim condition}{commands}
146 % -------------------------------------------------------------------------
147 \gdef\Whilenum#1#2{\loop\ifnum#1#2\repeat}
148 \gdef\Whiledim#1#2{\loop\ifdim#1pt#2\repeat}
149
150 % -------------------------------------------------------------------------
151 % Arithmetic with count registers.
152 % -------------------------------------------------------------------------
153 \gdef\Add(#1,#2){\advance#1#2}
154 \gdef\Sub(#1,#2){\advance#1-#2}
155 \gdef\Mul(#1,#2){\multiply#1#2}
156 \gdef\Div(#1,#2){\divide#1#2}
157 \gdef\@Abs(#1){\ifnum#1<\z@ #1=-#1 \@@s=-1 \else \@@s=1 \fi}
158 \gdef\Abs(#1){\ifnum#1<\z@ #1=-#1 \fi}
159 \gdef\Sig(#1,#2){\ifnum#1<\z@ \Set(#2,-1) \else \Set(#2,1) \fi}
160 \gdef\Mod(#1,#2){\@@i=#1 \Div(\@@i,#2) \Mul(\@@i,#2) \Sub(#1,\@@i)}
161
162 % -------------------------------------------------------------------------
163 % Arithmetic with dimen registers. Dmul & Ddiv use the calc package.
164 % -------------------------------------------------------------------------
165 \gdef\Dadd(#1,#2){\advance#1#2pt}
166 \gdef\Dsub(#1,#2){\advance#1-#2pt}
167 \gdef\Dmul(#1,#2){\setlength{#1}{#1*\ratio{#2}{1pt}}}
168 \gdef\Ddiv(#1,#2){\setlength{#1}{1pt*\ratio{#1}{#2}}}
169 \gdef\@Dabs(#1){\ifdim#1<\z@ #1=-#1 \@@s=-1 \else \@@s=1 \fi}
170 \gdef\Dabs(#1){\ifdim#1<\z@ #1=-#1 \fi}
171 \gdef\Dint(#1){\@@i=#1 \Div(\@@i,65536) \Dset(#1,\@@i)}
172 \gdef\Dsig(#1,#2){\ifdim#1<\z@ \Set(#2,-1) \else \Set(#2,1) \fi}
173 \gdef\Dmod(#1,#2){\@@m=#1 \Ddiv(\@@m,#2pt)
174 \Dint(\@@m) \Dmul(\@@m,#2pt) \Sub(#1,\@@m)}
175
176 % -------------------------------------------------------------------------
177 % Conversion to radian or degree.
178 % \Rad(x,result) \Deg(x,result)
179 % -------------------------------------------------------------------------
180 \gdef\Rad(#1,#2){\Dset(#2,#1) #2=0.017453#2}
181 \gdef\Deg(#1,#2){\Dset(#2,#1) #2=57.29578#2}
182
183 % -------------------------------------------------------------------------
184 % Calculates the sinus of an angle r in radian. The result is returned
185 % in register r. First, we reduce the argument to [0,2pi]. \Sin(x,r)
186 % -------------------------------------------------------------------------
187 \gdef\Sin(#1,#2){%
188 \Dset(\@@x,#1) \Dmod(\@@x,6.2832)
189 \@@y=\@@x \@@a=\@@x
190 \Dset(\@@d,1) \@ta=1
191 \@whiledim{\@@d>0pt}\do{%
192 \Dmul(\@@a,\@@x) \Add(\@ta,1) \Div(\@@a,\@ta)
193 \Dmul(\@@a,\@@x) \Add(\@ta,1) \Div(\@@a,\@ta)
194 \@@a=-\@@a \Add(\@@y,\@@a) \@@d=\@@a \Dabs(\@@d)} #2=\@@y}
195
196 % -------------------------------------------------------------------------
197 % Calculates the cosinus of an angle r in radian. The result is returned
198 % in register r. First, we reduce the argument to [0,2pi]. \Cos(x,r)
199 % -------------------------------------------------------------------------
200 \gdef\Cos(#1,#2){%
201 \Dset(\@@x,#1) \Dmod(\@@x,6.2832)
202 \Dset(\@@d,1) \@ta=0
203 \Dset(\@@y,1) \Dset(\@@a,1)
204 \@whiledim{\@@d>0pt}\do{%
205 \Dmul(\@@a,\@@x) \Add(\@ta,1) \Div(\@@a,\@ta)
206 \Dmul(\@@a,\@@x) \Add(\@ta,1) \Div(\@@a,\@ta)
207 \@@a=-\@@a \Add(\@@y,\@@a) \@@d=\@@a \Dabs(\@@d)} #2=\@@y}
208
209 % -------------------------------------------------------------------------
210 % Calculates the tangens of an angle r in radian. The result is returned
211 % in register r. First, we reduce the argument to [0,2pi]. We limit the
212 % maximum value at |n/2*pi| to 5. \Tan(x,r)
213 % -------------------------------------------------------------------------
214 \gdef\Tan(#1,#2){%
215 \Dset(\@@U,#1) \Dmod(\@@U,6.2832)
216 \Sin(\Np\@@U,\@@X) \Cos(\Np\@@U,\@@Y)
217 \ifdim\@@Y=0pt \Dset(\@@X,5) \else \Ddiv(\@@X,\@@Y) \fi
218 #2=\@@X}
219
220 % -------------------------------------------------------------------------
221 % Calculates the arcus sinus of x. The result is returned in register r.
222 % \Asin(x,r)
223 % -------------------------------------------------------------------------
224 \gdef\Asin(#1,#2){%
225 \Dset(\@@x,#1) \@ta=1
226 \ifdim\@@x<1.0pt
227 \ifdim\@@x>-1.0pt
228 \@@y=\@@x \@@t=\@@x \Dset(\@@d,1)
229 \@whiledim{\@@d>0pt}\do{%
230 \Mul(\@@t,\@ta) \Dmul(\@@t,\@@x) \Add(\@ta,1)
231 \Div(\@@t,\@ta) \Dmul(\@@t,\@@x) \Add(\@ta,1)
232 \@@u=\@@t \Div(\@@t,\@ta) \Add(\@@y,\@@t)
233 \@@d=\@@t \Dabs(\@@d) \@@t=\@@u}
234 \else \Dset(\@@y,-1.5708) \fi
235 \else \Dset(\@@y,1.5708) \fi #2=\@@y}
236
237 % -------------------------------------------------------------------------
238 % Calculates the arcus cosinus of x. The result is returned in register r.
239 % \Acos(x,r)
240 % -------------------------------------------------------------------------
241 \gdef\Acos(#1,#2){%
242 \Asin(#1,\@@y) \Dset(#2,1.5708) \Sub(#2,\@@y)}
243
244 % -------------------------------------------------------------------------
245 % Calculates the arcus tangens of x. The result is returned in register r.
246 % Because the power series of atan converges too slowly, we use the
247 % addition theorem of atan and split the calculation to get accurate
248 % results. \Atan(x,r)
249 % -------------------------------------------------------------------------
250 \gdef\Atan(#1,#2){%
251 \Dset(\@@x,#1) \@ta=1 \@Dabs(\@@x)
252 \ifdim\@@x<0.2500pt \Dset(\@@u,0.00000)
253 \@@a=1.0\@@x \Dsub(\@@a,0) \@@b=0.0\@@x \Dadd(\@@b,1)
254 \else
255 \ifdim\@@x<0.6875pt \Dset(\@@u,0.46365)
256 \@@a=2.0\@@x \Dsub(\@@a,1) \@@b=1.0\@@x \Dadd(\@@b,2)
257 \else
258 \ifdim\@@x<1.1875pt \Dset(\@@u,0.78540)
259 \@@a=1.0\@@x \Dsub(\@@a,1) \@@b=1.0\@@x \Dadd(\@@b,1)
260 \else
261 \ifdim\@@x<3.375pt \Dset(\@@u,0.98279)
262 \@@a=2.0\@@x \Dsub(\@@a,3) \@@b=3.0\@@x \Dadd(\@@b,2)
263 \else \Dset(\@@u,1.57080)
264 \@@a=0.0\@@x \Dsub(\@@a,1) \@@b=1.0\@@x \Dadd(\@@b,0)
265 \fi\fi\fi\fi
266 \Ddiv(\@@a,\@@b) \@@x=\@@a \@@y=\@@x \@@t=\@@x \Dset(\@@d,1)
267 \@whiledim{\@@d>0pt}\do{%
268 \Dmul(\@@t,\@@x) \Add(\@ta,2)
269 \Dmul(\@@t,\@@x) \Div(\@@t,\@ta)
270 \@@t=-\@@t \Add(\@@y,\@@t)
271 \@@d=\@@t \ifdim\@@d<0pt \@@d=-\@@d \fi}
272 \Add(\@@y,\@@u) \Mul(\@@y,\@@s) #2=\@@y}
273
274 % -------------------------------------------------------------------------
275 % Calculates the sinus hyperbolicus. The result is returned in register r.
276 % \Sinh(x,r)
277 % -------------------------------------------------------------------------
278 \gdef\Sinh(#1,#2){%
279 \Dset(\@@x,#1) \@ta=1
280 \@@y=\@@x \@@t=\@@x \Dset(\@@d,1)
281 \@whiledim{\@@d>0pt}\do{%
282 \Dmul(\@@t,\@@x) \Add(\@ta,1) \Div(\@@t,\@ta)
283 \Dmul(\@@t,\@@x) \Add(\@ta,1) \Div(\@@t,\@ta)
284 \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)} #2=\@@y}
285
286 % -------------------------------------------------------------------------
287 % Calculates the cosinus hyperbolicus. The result is returned in register
288 % r. \Cosh(x,r)
289 % -------------------------------------------------------------------------
290 \gdef\Cosh(#1,#2){%
291 \Dset(\@@x,#1) \@ta=0
292 \Dset(\@@y,1) \Dset(\@@t,1) \Dset(\@@d,1)
293 \@whiledim{\@@d>0pt}\do{%
294 \Dmul(\@@t,\@@x) \Add(\@ta,1) \Div(\@@t,\@ta)
295 \Dmul(\@@t,\@@x) \Add(\@ta,1) \Div(\@@t,\@ta)
296 \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)} #2=\@@y}
297
298 % -------------------------------------------------------------------------
299 % Calculates the tangens hyperbolicus. The result is returned in register
300 % r. \Tanh(x,r)
301 % -------------------------------------------------------------------------
302 \gdef\Tanh(#1,#2){%
303 \Dset(\@@a,#1) \Dset(\@@b,#1)
304 \Cosh(#1,\@@a) \Sinh(#1,\@@b)
305 \Ddiv(\@@b,\@@a) #2=\@@b}
306
307 % -------------------------------------------------------------------------
308 % Calculates the area sinus of x. The result is returned register r.
309 % \Asinh(x,r)
310 % -------------------------------------------------------------------------
311 \gdef\Asinh(#1,#2){%
312 \Dset(\@@a,#1) \Dmul(\@@a,\@@a)
313 \Dadd(\@@a,1) \Sqrt(\Np\@@a,\@@a)
314 \Dadd(\@@a,#1) \Ln(\Np\@@a,\@@a) #2=\@@a}
315
316 % -------------------------------------------------------------------------
317 % Calculates the area cosinus of x. The result is returned register r.
318 % \Acosh(x,r)
319 % -------------------------------------------------------------------------
320 \gdef\Acosh(#1,#2){%
321 \Dset(\@@a,#1)
322 \ifdim\@@a<12pt \Dmul(\@@a,\@@a)
323 \Dsub(\@@a,1) \Sqrt(\Np\@@a,\@@a)
324 \Dadd(\@@a,#1) \Ln(\Np\@@a,\@@a)
325 \else \Add(\@@a,\@@a) \Ln(\Np\@@a,\@@a) \fi #2=\@@a}
326
327 % -------------------------------------------------------------------------
328 % Calculates the area tangens of x. The result is returned register r.
329 % We limit the maximum value of atanh to 5. \Atanh(x,r)
330 % -------------------------------------------------------------------------
331 \gdef\Atanh(#1,#2){%
332 \Dset(\@@a,#1) \@Dabs(\@@a)
333 \ifdim\@@a>0.9999pt \Dset(\@@a,5) \else
334 \Dset(\@@b,1) \Sub(\@@b,\@@a) \Dadd(\@@a,1)
335 \Ln(\Np\@@a,\@@a) \Ln(\Np\@@b,\@@b)
336 \Sub(\@@a,\@@b) \Div(\@@a,2) \fi
337 \Mul(\@@a,\@@s) #2=\@@a}
338
339 % -------------------------------------------------------------------------
340 % Calculates the natural logarithm. The result is returned in register r.
341 % For large numbers we reduce the argument x, using ln(x)=ln(x/e^k)+k.
342 % For small numbers we enlarge the argument x, using ln(x)=ln(x*e^k)-k.
343 % The value of k is added at the end. \Ln(x,r)
344 % -------------------------------------------------------------------------
345 \gdef\Ln(#1,#2){%
346 \Dset(\@@x,#1) \Dset(\@@t,2.71828) \@ta=1 \@tb=0
347 \@whiledim{\@@x>\@@t}\do{\Ddiv(\@@x,\@@t) \Add(\@tb,1)}
348 \@whiledim{\@@x<1pt}\do{\Dmul(\@@x,\@@t) \Sub(\@tb,1)}
349 \@@t=\@@x \Dadd(\@@t,1)
350 \Dsub(\@@x,1) \Ddiv(\@@x,\@@t)
351 \@@y=\@@x \@@t=\@@x \Dset(\@@d,1)
352 \@whiledim{\@@d>0pt}\do{%
353 \Dmul(\@@t,\@@x) \Dmul(\@@t,\@@x)
354 \@@u=\@@t \Add(\@ta,2) \Div(\@@t,\@ta)
355 \Add(\@@y,\@@t) \@@d=\@@t \ifdim\@@d<0pt \@@d=-\@@d \fi
356 \@@t=\@@u} \Mul(\@@y,2) \Dadd(\@@y,\@tb) #2=\@@y}
357
358 % -------------------------------------------------------------------------
359 % Calculates the logarithm of x to basis a. The result is returned in
360 % register r. \Log(a,x,r)
361 % -------------------------------------------------------------------------
362 \gdef\Log(#1,#2,#3){%
363 \Ln(#1,\@ax) \Ln(#2,\@@x)
364 \Ddiv(\@@x,\@ax) #3=\@@x}
365
366 % -------------------------------------------------------------------------
367 % Calculates the natural power of x. The result is returned in register r.
368 % \Exp(x,r)
369 % -------------------------------------------------------------------------
370 \gdef\Exp(#1,#2){%
371 \Dset(\@@x,#1) \@ta=1
372 \Dset(\@@y,1) \Dset(\@@t,1) \Dset(\@@d,1)
373 \@whiledim{\@@d>0pt}\do{%
374 \Dmul(\@@t,\@@x) \Div(\@@t,\@ta) \Add(\@ta,1)
375 \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)} #2=\@@y}
376
377 % -------------------------------------------------------------------------
378 % Calculates the x-th power of number a. The result is returned in
379 % register r. \Pow(a,x,r)
380 % -------------------------------------------------------------------------
381 \gdef\Pow(#1,#2,#3){%
382 \Dset(\@@x,#1) \Dset(\@@y,#2)
383 \ifdim\@@y=1.0pt #3=\@@x \else
384 \ifdim\@@x>0pt
385 \Ln(#1,\@@y) \Dset(\@@x,#2) \Dmul(\@@x,\@@y) \@ta=1
386 \Dset(\@@y,1) \Dset(\@@t,1) \Dset(\@@d,1)
387 \@whiledim{\@@d>0pt}\do{%
388 \Dmul(\@@t,\@@x) \Div(\@@t,\@ta) \Add(\@ta,1)
389 \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)}
390 #3=\@@y \else #3=\@@x \fi \fi}
391
392 % -------------------------------------------------------------------------
393 % Calculates the n-th root of a number x. The result is returned in
394 % register r. \Root(x,n,r)
395 % -------------------------------------------------------------------------
396 \gdef\Root(#1,#2,#3){%
397 \Dset(\@@x,#1) \Dset(\@@y,#2)
398 \ifdim\@@y=1pt #3=\@@x \else
399 \ifdim\@@x>0pt
400 \Ln(#1,\@@x) \Dset(\@@y,#2) \Ddiv(\@@x,\@@y) \@ta=1
401 \Dset(\@@y,1) \Dset(\@@t,1) \Dset(\@@d,1)
402 \@whiledim{\@@d>0pt}\do{%
403 \Dmul(\@@t,\@@x) \Div(\@@t,\@ta) \Add(\@ta,1)
404 \Add(\@@y,\@@t) \@@d=\@@t \Dabs(\@@d)}
405 #3=\@@y \else #3=\@@x \fi \fi}
406
407 % -------------------------------------------------------------------------
408 % Calculates the n-th potenz (pos or neg integer) of a number a. The
409 % result is returned in register r. \Pot(a,n,r)
410 % -------------------------------------------------------------------------
411 \gdef\Pot(#1,#2,#3){%
412 \Dset(\@@x,1) \@cm=#2 \@Abs(\@cm) \@ta=0
413 \@whilenum{\@ta<\@cm}\do{%
414 \Dmul(\@@x,#1pt) \Add(\@ta,1)}
415 \ifnum\@@s<0 \Dset(#3,1) \Ddiv(#3,\@@x) \else #3=\@@x \fi}
416
417 % -------------------------------------------------------------------------
418 % Calculates the square root of a number x. The result is returned in
419 % register r. First we reduce the argument to get fewer steps. \Sqrt(x,r)
420 % -------------------------------------------------------------------------
421 \gdef\Sqrt(#1,#2){%
422 \Dset(\@@t,#1) \Dset(\@@x,1) \@@d=\@@x \@@b=\@@x
423 \ifdim\@@t=0pt \Dset(#2,0) \else
424 \@whiledim{\@@t>4pt}\do{\Div(\@@t,4) \Mul(\@@b,2)}
425 \@whiledim{\@@d>0pt}\do{\@@y=\@@t
426 \Ddiv(\@@y,\@@x) \Sub(\@@y,\@@x) \Div(\@@y,2)
427 \@@d=\@@y \Dabs(\@@d) \Add(\@@x,\@@y)} #2=\Np\@@b\@@x \fi}
428
429 % -------------------------------------------------------------------------
430 % Calculates the distance between two points. The result is returned in
431 % register r. \Len(x1,y1)(x2,y2)(r)
432 % -------------------------------------------------------------------------
433 \gdef\Len(#1,#2)(#3,#4)(#5){%
434 \Dset(\@@a,#3) \Sub(\@@a,#1pt)
435 \Dset(\@@b,#4) \Sub(\@@b,#2pt)
436 \Dmul(\@@a,\@@a) \Dmul(\@@b,\@@b)
437 \Add(\@@a,\@@b) \Sqrt(\Np\@@a,#5)}
438
439 % -------------------------------------------------------------------------
440 % Calculates the hypothenuse of a rectangular triangle. The result is
441 % returned in register r. \Hypot(a,b,r)
442 % -------------------------------------------------------------------------
443 \gdef\Hypot(#1,#2,#3){%
444 \Dset(\@@a,#1) \Dset(\@@b,#2)
445 \Dmul(\@@a,\@@a) \Dmul(\@@b,\@@b)
446 \Add(\@@a,\@@b) \Sqrt(\Np\@@a,#3)}
447
448 % -------------------------------------------------------------------------
449 % Calculates the directional angle between two points. The result in rad
450 % is returned in register r. The first point is the reference point.
451 % \Direc(x1,y1)(x2,y2)(r)
452 % -------------------------------------------------------------------------
453 \gdef\Direc(#1,#2)(#3,#4)(#5){%
454 \Dset(\@@X,#3) \Dset(\@@A,#1) \Sub(\@@X,\@@A)
455 \Dset(\@@Y,#4) \Dset(\@@B,#2) \Sub(\@@Y,\@@B)
456 \@@U=\@@X \Abs(\@@U)
457 \ifdim\@@U<0.001pt \Dset(\@@A,1.5708)
458 \ifdim\@@Y<0pt \Dadd(\@@A,3.1416) \fi
459 \else \@@A=\@@Y \Ddiv(\@@A,\@@X) \Atan(\Np\@@A,\@@A)
460 \ifdim\@@X<0pt \Dadd(\@@A,3.1416)
461 \else \ifdim\@@Y<0pt \Dadd(\@@A,6.2832) \fi\fi\fi #5=\@@A}
462
463 % -------------------------------------------------------------------------
464 % Rotate a point around the origin by angle a. The result is returned in
465 % x2,y2. \Rotpoint(a)(x1,y1)(x2,y2)
466 % -------------------------------------------------------------------------
467 \gdef\Rotpoint(#1)(#2,#3)(#4,#5){%
468 \Dset(\@zx,#2) \Dset(\@zy,#3)
469 \Dset(\@yx,#2) \Dset(\@yy,#3)
470 \Rad(#1,\@@U)
471 \Sin(\Np\@@U,\@@A) \Cos(\Np\@@U,\@@B)
472 \Dmul(\@zx,\@@B) \Dmul(\@zy,\@@A)
473 \Dmul(\@yx,\@@A) \Dmul(\@yy,\@@B)
474 \Sub(\@zx,\@zy) \Add(\@yx,\@yy)
475 #4=\@zx #5=\@yx}
476
477 % -------------------------------------------------------------------------
478 % Draws a small point, filled with gray value g (0..1) at x,y.
479 % \Point(g)(x,y)
480 % -------------------------------------------------------------------------
481 \gdef\Point(#1)(#2,#3){\Gsave \Setwidth(0.01) \Setcol(0,0,0)%
482 \Circle(32)(#2,#3,0.065) \Fill(#1,#1,#1) \Grestore}
483
484 % -------------------------------------------------------------------------
485 % TeX typesetting a text at x,y with positional specification s. We have
486 % to temporary leave lapdf and reenter afterwords. If you want to add any
487 % macro from the picture environment, you have to use the same procedure.
488 % \Text(x,y,s){text}
489 % -------------------------------------------------------------------------
490 \gdef\Text(#1,#2,#3)#4{%
491 \end{pdf} \normalsize \put(#1,#2){\makebox(0,0)[#3]{#4}} \begin{pdf}}
492
493 % -------------------------------------------------------------------------
494 % \Setcol(r,g,b) set a color
495 % \Setgray(v) set a gray
496 % \@setcol(switch,r,g,b) helper function
497 % rg and g are fore filling (f is first param)
498 % RG and G are fore stroking (s is first param)
499 % -------------------------------------------------------------------------
500 \gdef\@setcol(#1,#2,#3,#4){\def\@c{#1}
501 \Dset(\@CR,#2) \Dset(\@CG,#3) \Dset(\@CB,#4)
502 \ifnum\@cl=1
503 \if\@c f \@f={rg} \else \@f={RG} \fi
504 \def\@e{#2 #3 #4}
505 \else
506 \ifdim\@ax=1.0pt \def\@e{1} \else \def\@e{0} \fi
507 \fi
508 \PDF{\@e\space \the\@f}}
509
510 \gdef\Setcol(#1,#2,#3){\@setcol(s,#1,#2,#3)}
511 \gdef\Setgray(#1){\@setcol(s,#1,#1,#1)}
512
513 % -------------------------------------------------------------------------
514 % Some useful predefined colors. All names start with capital letters.
515 % -------------------------------------------------------------------------
516 \gdef\Black{\Setcol(0,0,0)}
517 \gdef\Dred{\Setcol(0.7,0,0)}
518 \gdef\Dgreen{\Setcol(0,0.7,0)}
519 \gdef\Dblue{\Setcol(0,0,0.7)}
520 \gdef\Dcyan{\Setcol(0,0.7,0.7)}
521 \gdef\Dmagenta{\Setcol(0.7,0,0.7)}
522 \gdef\Dyellow{\Setcol(0.7,0.7,0)}
523 \gdef\Dgray{\Setcol(0.4,0.4,0.4)}
524 \gdef\Gray{\Setcol(0.8,0.8,0.8)}
525 \gdef\Red{\Setcol(1,0,0)}
526 \gdef\Green{\Setcol(0,1,0)}
527 \gdef\Blue{\Setcol(0,0,1)}
528 \gdef\Cyan{\Setcol(0,1,1)}
529 \gdef\Magenta{\Setcol(1,0,1)}
530 \gdef\Yellow{\Setcol(1,1,0)}
531 \gdef\White{\Setcol(1,1,1)}
532
533 % -------------------------------------------------------------------------
534 % The first macro strokes with current and fills with specified color.
535 % \Fill(r,g,b)
536 % The second macro simply uses gray instead of a color value
537 % \Gfill(gr)
538 % The third strokes and fills with the current color (CR, CG, CB).
539 % \Sfill
540 % -------------------------------------------------------------------------
541 \gdef\Fill(#1,#2,#3){\@setcol(f,#1,#2,#3) \PDF{B*}}
542 \gdef\Gfill(#1){\@setcol(f,#1,#1,#1) \PDF{B*}}
543 \gdef\Sfill{\Fill(\Np\@CR,\Np\@CG,\Np\@CB)}
544
545 % -------------------------------------------------------------------------
546 % The main PDF commands, please read a PDF-Specification fore their meaning
547 % and also the documentation of Lapdf
548 % -------------------------------------------------------------------------
549 \gdef\Gsave{\PDF{q}}
550 \gdef\Grestore{\PDF{Q}}
551 \gdef\Setclip{\PDF{W* n}}
552 \gdef\Stroke{\PDF{S}}
553 \gdef\Closepath{\PDF{h}}
554 \gdef\Setwidth(#1){\PDF{#1 w}}
555 \gdef\Thick{\PDF{0.03 w}}
556 \gdef\Thin{\PDF{0.01 w}}
557 \gdef\Setcap(#1){\PDF{#1 J}}
558 \gdef\Setjoin(#1){\PDF{#1 j}}
559 \gdef\Setflat(#1){\PDF{#1 i}}
560 \gdef\Setmiter(#1){\PDF{#1 M}}
561 \gdef\Setdash(#1){\PDF{#1 d}}
562 \gdef\Bezier(#1,#2,#3,#4,#5,#6){\PDF{#1 #2 #3 #4 #5 #6 c}}
563 \gdef\Concat(#1,#2,#3,#4,#5,#6){\PDF{#1 #2 #3 #4 #5 #6 cm}}
564 \gdef\Translate(#1,#2){\PDF{1 0 0 1 #1 #2 cm}}
565 \gdef\Scale(#1,#2){\PDF{#1 0 0 #2 0 0 cm}}
566 \gdef\Rotate(#1){\Cos(#1,\@ax) \Sin(#1,\@bx)
567 \@cx=-\@bx \@rotate(\Np\@ax,\Np\@bx,\Np\@cx)}
568 \gdef\@rotate(#1,#2,#3){\PDF{#1 #2 #3 #1 0 0 cm}}
569 \gdef\Rect(#1,#2,#3,#4){\PDF{#1 #2 #3 #4 re}}
570
571 % -------------------------------------------------------------------------
572 % \Dash(n) 4 predefined standard dashes (0..3).
573 % -------------------------------------------------------------------------
574 \gdef\Dash(#1){\def\@c{#1}
575 \ifnum\@c=0 \PDF{[] 0 d} \fi
576 \ifnum\@c=1 \PDF{[0.1 0.1] 0 d} \fi
577 \ifnum\@c=2 \PDF{[0.1 0.1 0.025 0.1] 0 d} \fi
578 \ifnum\@c=3 \PDF{[0.025 0.1] 0 d} \fi}
579
580 % -------------------------------------------------------------------------
581 % Move to point and line drawing in affine space.
582 % \Moveto(x1,y1) \Lineto(x1,y1) \Line(x1,y1,x2,y2)
583 % -------------------------------------------------------------------------
584 \gdef\Moveto(#1,#2){\Dset(\@xx,#1) \Dset(\@xy,#2) \PDF{#1 #2 m}}
585 \gdef\Lineto(#1,#2){\Dset(\@xx,#1) \Dset(\@xy,#2) \PDF{#1 #2 l}}
586 \gdef\Line(#1,#2)(#3,#4){\Moveto(#1,#2) \Lineto(#3,#4)}
587
588 % -------------------------------------------------------------------------
589 % Move to point in homogeneous space.
590 % \Rmoveto(x1,y1,z1)
591 % -------------------------------------------------------------------------
592 \gdef\Rmoveto(#1,#2,#3){\Dset(\@xx,#1) \Dset(\@xy,#2) \Dset(\@xz,#3)
593 \PDF{#1 #2 m}}
594
595 % -------------------------------------------------------------------------
596 % Helper macros for all the grid drawings.
597 % -------------------------------------------------------------------------
598 \gdef\@Putline(#1,#2)(#3,#4)(#5){\put(#1,#2){\line(#3,#4){#5}}}
599 \gdef\@Putvector(#1,#2)(#3,#4)(#5){\put(#1,#2){\vector(#3,#4){#5}}}
600 \gdef\@Puttext(#1,#2)[#3]#4{\put(#1,#2){\makebox(0,0)[#3]{#4}}}
601
602 % -------------------------------------------------------------------------
603 % Helper: Draws a graphic dot at point (x,y).
604 % \@Gdot(x,y)
605 % -------------------------------------------------------------------------
606 \gdef\@Gbox{\setbox\@tbox\hbox{\hskip-\@halfwidth%
607 \vrule\@height\@halfwidth\@depth\@halfwidth\@width\@wholewidth}}
608
609 \gdef\@Gdot(#1,#2){\@killglue
610 \raise#2\hb@xt@\z@{\kern#1\unhcopy\@tbox\hss}}
611
612 % -------------------------------------------------------------------------
613 % Helper: Draws a dashed line with n points per unitlength from current
614 % point to x,y. \@Gline(n)(x,y)
615 % -------------------------------------------------------------------------
616 \gdef\@Gline(#1)(#2,#3){%
617 \@cm=#1 \@ci=0
618 \@dx=#2\Ul \@dy=#3\Ul
619 \Div(\@dx,\@cm) \Div(\@dy,\@cm)
620 \Add(\@cm,1) \@Gbox
621 \@whilenum{\@ci<\@cm}\do{%
622 \@@X=\@ci\@dx \@@Y=\@ci\@dy
623 \@Gdot(\@@X,\@@Y) \Add(\@ci,1)}}
624
625 % -------------------------------------------------------------------------
626 % Helper: Draws a dashed circle of radius r with 10 points per unitlength.
627 % \@Gcircle(r)
628 % -------------------------------------------------------------------------
629 \gdef\@Gcircle(#1){%
630 \@cm=#1 \Mul(\@cm,63) \@ci=0
631 \Dset(\@dx,6.2832) \Div(\@dx,\@cm) \@Gbox
632 \@whilenum{\@ci<\@cm}\do{%
633 \@dy=\@ci\@dx
634 \Cos(\Np\@dy,\@@X) \@@X=#1\@@X
635 \Sin(\Np\@dy,\@@Y) \@@Y=#1\@@Y
636 \@Gdot(\Np\@@X\Ul,\Np\@@Y\Ul) \Add(\@ci,1)}}
637
638 % -------------------------------------------------------------------------
639 % Draws a linear grid with n points per unitlength. A grid is drawn if g>0.
640 % Value a may be 0 (no axes), 1 (simple axes), 2 (additional tickmarks)
641 % or 3 (additional values). \Lingrid(n)(g,a)(xmin,max)(ymin,ymax)
642 % -------------------------------------------------------------------------
643 \gdef\Lingrid(#1)(#2,#3)(#4,#5)(#6,#7){%
644 \end{pdf}
645 \scriptsize
646 \linethickness{\wid}
647 \@cd=#7 \Sub(\@cd,#6) \@cg=\@cd \Mul(\@cg,#1)
648 \@cb=#4 \@cc=#5 \Add(\@cc,1)
649 \ifnum#4=0
650 \ifnum#3>1 \@Putline(-0.1,0)(1,0)(0.1) \fi
651 \ifnum#3>2 \@Puttext(-0.15,0)[rc]{0} \fi \fi
652 \ifnum#6=0
653 \ifnum#3>1 \@Putline(0,-0.1)(0,1)(0.1) \fi
654 \ifnum#3>2 \@Puttext(0,-0.15)[ct]{0} \fi \fi
655 \@whilenum{\@cb<\@cc}\do{%
656 \ifnum#2=1 \put(\@cb,#6){\@Gline(\@cg)(0,\@cd)} \fi
657 \ifnum\@cb=0 \else
658 \ifnum#3>1 \@Putline(\@cb,-0.1)(0,1)(0.1) \fi
659 \ifnum#3>2 \@Puttext(\@cb,-0.15)[ct]{\the\@cb} \fi \fi
660 \Add(\@cb,1)}
661 \@cd=#5 \Sub(\@cd,#4) \@cg=\@cd \Mul(\@cg,#1)
662 \@cb=#6 \@cc=#7 \Add(\@cc,1)
663 \@whilenum{\@cb<\@cc}\do{%
664 \ifnum#2=1 \put(#4,\@cb){\@Gline(\@cg)(\@cd,0)} \fi
665 \ifnum\@cb=0 \else
666 \ifnum#3>1 \@Putline(-0.1,\@cb)(1,0)(0.1) \fi
667 \ifnum#3>2 \@Puttext(-0.15,\@cb)[rc]{\the\@cb} \fi \fi
668 \Add(\@cb,1)}
669 \Dset(\@@X,#5) \Dsub(\@@X,#4) \Dadd(\@@X,0.4)
670 \Dset(\@@Y,#7) \Dsub(\@@Y,#6) \Dadd(\@@Y,0.4)
671 \ifnum#3>0 \@Putvector(#4,0)(1,0)(\Np\@@X)
672 \@Putvector(0,#6)(0,1)(\Np\@@Y) \fi
673 \begin{pdf}}
674
675 % -------------------------------------------------------------------------
676 % Draws a grid with n points per unitlength. It is horizontal logarithmic
677 % and vertical linear. A grid is drawn if g>0. Value a may be 0 (no axes),
678 % 1 (simple axes), 2 (additional tickmarks) or 3 (additional values).
679 % \Logxgrid(n)(g,a)(xmin,max)(ymin,ymax)
680 % -------------------------------------------------------------------------
681 \gdef\Logxgrid(#1)(#2,#3)(#4,#5)(#6,#7){%
682 \end{pdf}
683 \scriptsize
684 \linethickness{\wid}
685 \@cd=#7 \Sub(\@cd,#6) \@cg=\@cd \Mul(\@cg,#1)
686 \@cb=1 \@cc=0 \@ca=#4
687 \ifnum#6=0
688 \ifnum#3>1 \@Putline(0,-0.1)(0,1)(0.1) \fi
689 \ifnum#3>2 \@Puttext(0,-0.15)[ct]{$10^{\the\@ca}$} \fi \fi
690 \@whilenum{\@ca<#5}\do{\Log(10,\@cb,\@@X) \Dadd(\@@X,\@cc) \Mul(\@@X,5)
691 \ifnum#2=1 \put(\Np\@@X,#6){\@Gline(\@cg)(0,\@cd)} \fi
692 \ifnum\@cb<10 \Add(\@cb,1)
693 \else \@cb=2 \Add(\@cc,1) \Add(\@ca,1)
694 \ifnum#3>1 \@Putline(\Np\@@X,-0.1)(0,1)(0.1) \fi
695 \ifnum#3>2 \@Puttext(\Np\@@X,-0.15)[ct]{$10^{\the\@ca}$} \fi \fi}
696 \@cd=#5 \Sub(\@cd,#4) \Mul(\@cd,5) \@cg=\@cd \Mul(\@cg,#1)
697 \@cb=#6 \@cc=#7 \Add(\@cc,1)
698 \@whilenum{\@cb<\@cc}\do{%
699 \ifnum#2=1 \put(0,\@cb){\@Gline(\@cg)(\@cd,0)} \fi
700 \ifnum#3>1 \@Putline(-0.1,\@cb)(1,0)(0.1) \fi
701 \ifnum#3>2 \@Puttext(-0.15,\@cb)[rc]{\the\@cb} \fi \Add(\@cb,1)}
702 \Dset(\@@X,#5) \Dsub(\@@X,#4) \Mul(\@@X,5) \Dadd(\@@X,0.4)
703 \Dset(\@@Y,#7) \Dsub(\@@Y,#6) \Dadd(\@@Y,0.4)
704 \ifnum#3>0 \@Putvector(-0.1,0)(1,0)(\Np\@@X)
705 \@Putvector(0,#6)(0,1)(\Np\@@Y) \fi
706 \begin{pdf}}
707
708 % -------------------------------------------------------------------------
709 % Draws a grid with n points per unitlength. It is horizontal linear and
710 % vertical logarithmic. A grid is drawn if g>0. Value a may be 0 (no axes),
711 % 1 (simple axes), 2 (additional tickmarks) or 3 (additional values).
712 % \Logygrid(n)(g,a)(xmin,max)(ymin,ymax)
713 % -------------------------------------------------------------------------
714 \gdef\Logygrid(#1)(#2,#3)(#4,#5)(#6,#7){%
715 \end{pdf}
716 \scriptsize
717 \linethickness{\wid}
718 \@cd=#7 \Sub(\@cd,#6) \@cg=\@cd \Mul(\@cg,#1)
719 \@cb=1 \@cc=0 \@ca=#4
720 \ifnum#6=0
721 \ifnum#3>1 \@Putline(-0.1,0)(1,0)(0.1) \fi
722 \ifnum#3>2 \@Puttext(-0.15,0)[rc]{$10^{\the\@ca}$} \fi \fi
723 \@whilenum{\@ca<#5}\do{\Log(10,\@cb,\@@Y) \Dadd(\@@Y,\@cc) \Mul(\@@Y,5)
724 \ifnum#2=1 \put(#6,\Np\@@Y){\@Gline(\@cg)(\@cd,0)} \fi
725 \ifnum\@cb<10 \Add(\@cb,1)
726 \else \@cb=2 \Add(\@cc,1) \Add(\@ca,1)
727 \ifnum#3>1 \@Putline(-0.1,\Np\@@Y)(1,0)(0.1) \fi
728 \ifnum#3>2 \@Puttext(-0.15,\Np\@@Y)[rc]{$10^{\the\@ca}$} \fi \fi}
729 \@cd=#5 \Sub(\@cd,#4) \Mul(\@cd,5) \@cg=\@cd \Mul(\@cg,#1)
730 \@cb=#6 \@cc=#7 \Add(\@cc,1)
731 \@whilenum{\@cb<\@cc}\do{%
732 \ifnum#2=1 \put(\@cb,0){\@Gline(\@cg)(0,\@cd)} \fi
733 \ifnum#3>1 \@Putline(\@cb,-0.1)(0,1)(0.1) \fi
734 \ifnum#3>2 \@Puttext(\@cb,-0.15)[ct]{\the\@cb} \fi \Add(\@cb,1)}
735 \Dset(\@@Y,#5) \Dsub(\@@Y,#4) \Mul(\@@Y,5) \Dadd(\@@Y,0.4)
736 \Dset(\@@X,#7) \Dsub(\@@X,#6) \Dadd(\@@X,0.4)
737 \ifnum#3>0 \@Putvector(#6,0)(1,0)(\Np\@@X)
738 \@Putvector(0,-0.1)(0,1)(\Np\@@Y) \fi
739 \begin{pdf}}
740
741 % -------------------------------------------------------------------------
742 % Draws a grid with n points per unitlength. It is logarithmic in both
743 % directions. A grid is drawn if g>0. Value a may be 0 (no axes),
744 % 1 (simple axes), 2 (additional tickmarks) or 3 (additional values).
745 % \Logxygrid(n)(g,a)(xmin,max)(ymin,ymax)
746 % -------------------------------------------------------------------------
747 \gdef\Logxygrid(#1)(#2,#3)(#4,#5)(#6,#7){%
748 \end{pdf}
749 \scriptsize
750 \linethickness{\wid}
751 \@cd=#7 \Sub(\@cd,#6) \Mul(\@cd,5) \@cg=\@cd \Mul(\@cg,#1)
752 \@cb=1 \@cc=0 \@ca=#4
753 \ifnum#6=0
754 \ifnum#3>1 \@Putline(0,-0.1)(0,1)(0.1) \fi
755 \ifnum#3>2 \@Puttext(0,-0.15)[ct]{$10^{\the\@ca}$} \fi \fi
756 \@whilenum{\@ca<#5}\do{\Log(10,\@cb,\@@X) \Dadd(\@@X,\@cc) \Mul(\@@X,5)
757 \ifnum#2=1 \put(\Np\@@X,#6){\@Gline(\@cg)(0,\@cd)} \fi
758 \ifnum\@cb<10 \Add(\@cb,1)
759 \else \@cb=2 \Add(\@cc,1) \Add(\@ca,1)
760 \ifnum#3>1 \@Putline(\Np\@@X,-0.1)(0,1)(0.1) \fi
761 \ifnum#3>2 \@Puttext(\Np\@@X,-0.15)[ct]{$10^{\the\@ca}$} \fi \fi}
762 \@cd=#5 \Sub(\@cd,#4) \Mul(\@cd,5) \@cg=\@cd \Mul(\@cg,#1)
763 \@cb=1 \@cc=0 \@ca=#6
764 \ifnum#6=0
765 \ifnum#3>1 \@Putline(-0.1,0)(1,0)(0.1) \fi
766 \ifnum#3>2 \@Puttext(-0.15,0)[rc]{$10^{\the\@ca}$} \fi \fi
767 \@whilenum{\@ca<#7}\do{\Log(10,\@cb,\@@Y) \Dadd(\@@Y,\@cc) \Mul(\@@Y,5)
768 \ifnum#2=1 \put(#6,\Np\@@Y){\@Gline(\@cg)(\@cd,0)} \fi
769 \ifnum\@cb<10 \Add(\@cb,1)
770 \else \@cb=2 \Add(\@cc,1) \Add(\@ca,1)
771 \ifnum#3>1 \@Putline(-0.1,\Np\@@Y)(1,0)(0.1) \fi
772 \ifnum#3>2 \@Puttext(-0.15,\Np\@@Y)[rc]{$10^{\the\@ca}$} \fi \fi}
773 \Dset(\@@X,#5) \Dsub(\@@X,#4) \Mul(\@@X,5) \Dadd(\@@X,0.4)
774 \Dset(\@@Y,#7) \Dsub(\@@Y,#6) \Mul(\@@Y,5) \Dadd(\@@Y,0.4)
775 \ifnum#3>0 \@Putvector(-0.1,0)(1,0)(\Np\@@X)
776 \@Putvector(0,-0.1)(0,1)(\Np\@@Y) \fi
777 \begin{pdf}}
778
779 % -------------------------------------------------------------------------
780 % Draws a polar grid with 10 points per unitlength and maximum radius r.
781 % If g>0, a grid is drawn. Value a may be 0 (no axes), 1 (simple axes),
782 % 2 (additional tickmarks), 3 (additional values, angles in degree) or
783 % 4 (like 3, but angles in multiples of pi). \Polgrid(g,a)(r)
784 % -------------------------------------------------------------------------
785 \gdef\Polgrid(#1,#2)(#3){%
786 \end{pdf}
787 \scriptsize
788 \linethickness{\wid}
789 \@ca=0
790 \@whilenum{\@ca<#3}\do{%
791 \Add(\@ca,1) \ifnum#1>0 \@Gcircle(\@ca) \fi
792 \ifnum#2>1
793 \ifnum\@ca=0 \else
794 \@Putline(\@ca,-0.1)(0,1)(0.1) \@Putline(-\@ca,-0.1)(0,1)(0.1)
795 \@Putline(-0.1,\@ca)(1,0)(0.1) \@Putline(-0.1,-\@ca)(1,0)(0.1)
796 \ifnum#2>2 \@Puttext(\@ca,-0.15)[tc]{\the\@ca} \fi \fi \fi}
797 \@ca=0 \@cb=0
798 \@whilenum{\@ca<360}\do{%
799 \@cb=#3 \Mul(\@cb,10) \Rad(\@ca,\@ax)
800 \ifnum#1>0
801 \Cos(\Np\@ax,\@@X) \Mul(\@@X,#3)
802 \Sin(\Np\@ax,\@@Y) \Mul(\@@Y,#3)
803 \put(0,0){\@Gline(\@cb)(\Np\@@X,\Np\@@Y)} \fi
804 \ifnum#2>2
805 \Dset(\@@U,#3) \Dadd(\@@U,0.35)
806 \Cos(\Np\@ax,\@@X) \Dmul(\@@X,\@@U)
807 \Sin(\Np\@ax,\@@Y) \Dmul(\@@Y,\@@U)
808 \ifnum#2>3 \@cb=\@ca \Div(\@cb,15)
809 \ifnum\@ca=0 \@Puttext(\Np\@@X,\Np\@@Y)[cc]{0}
810 \else \@cc=\@cb \Mod(\@cc,6)
811 \ifnum\@cc=0 \Div(\@cb,6)
812 \ifnum\@cb=2 \@Puttext(\Np\@@X,\Np\@@Y)[cc]{$\pi$}
813 \else \@Puttext(\Np\@@X,\Np\@@Y)[cc]{$\frac{\the\@cb}{2}\pi$} \fi
814 \else \@Puttext(\Np\@@X,\Np\@@Y)[cc]{$\frac{\the\@cb}{12}\pi$} \fi \fi
815 \else \@Puttext(\Np\@@X,\Np\@@Y)[cc]{$\the\@ca^{\circ}$} \fi \fi
816 \Add(\@ca,15)}
817 \ifnum#2>0 \Dset(\@@X,#3) \Mul(\@@X,2)
818 \@Putline(-#3,0)(1,0)(\Np\@@X) \@Putline(0,-#3)(0,1)(\Np\@@X) \fi
819 \begin{pdf}}
820
821 % -------------------------------------------------------------------------
822 % Plots a function with n line segments from x1 to x2. You have to define
823 % a function \Fx with the command: \def\Fx(#1,#2){..}. #1 is the x value
824 % and #2 is the result register. \Fplot(n)(x1,x2) Examples:
825 % \def\Fx(#1,#2){\Sin(#1,#2) \Mul(#2,3) \Dadd(#2,1)} y=3*sin(x)+1
826 % \def\Fx(#1,#2){\Dset(\x,#1) \Dsub(\x,2) \Exp(\Np\x,#2)} y=exp(x-2)
827 % -------------------------------------------------------------------------
828 \gdef\Fplot(#1)(#2,#3){%
829 \Dset(\@dx,#3) \Dsub(\@dx,#2) \Div(\@dx,#1)
830 \Dset(\@ux,#2) \Fx(\Np\@ux,\@uy)
831 \Moveto(\Np\@ux,\Np\@uy)
832 \@whiledim{\@ux<#3pt}\do{\Add(\@ux,\@dx)
833 \ifdim\@ux>#3pt \Dset(\@ux,#3) \fi
834 \Fx(\Np\@ux,\@uy) \Lineto(\Np\@ux,\Np\@uy)}}
835
836 % -------------------------------------------------------------------------
837 % Plots a parametric function with n line segments for t1 to t2. You have
838 % to define two functions \Tx and \Ty with the commands: \def\Tx(#1,#2){..}
839 % and \def\Ty(#1,#2){..}. Here #1 is the t value and #2 is the result
840 % register. \Tplot(n)(t1,t2) Example:
841 % \def\Tx(#1,#2){\Dset(#2,#1) \Mul(#2,2) \Dsub(#2,1)} x=2*t-1
842 % \def\Ty(#1,#2){\Dset(\t,#1) #2=\t \Dmul(#2,#2) \Add(#2,\t)} y=t^2+t
843 % -------------------------------------------------------------------------
844 \gdef\Tplot(#1)(#2,#3){%
845 \Dset(\@dx,#3) \Dsub(\@dx,#2) \Div(\@dx,#1)
846 \Dset(\@@U,#2) \Tx(\Np\@@U,\@ux)
847 \Dset(\@@U,#2) \Ty(\Np\@@U,\@uy)
848 \Moveto(\Np\@ux,\Np\@uy)
849 \@whiledim{\@@U<#3pt}\do{\Add(\@@U,\@dx)
850 \ifdim\@@U>#3pt \Dset(\@@U,#3) \fi
851 \Tx(\Np\@@U,\@ux) \Ty(\Np\@@U,\@uy)
852 \Lineto(\Np\@ux,\Np\@uy)}}
853
854 % -------------------------------------------------------------------------
855 % Converts a polar function r=f(a) to parametric cartesian form with:
856 % x=f(a)*cos(a), y=f(a)*sin(a). The result is returned in regs x and y.
857 % \Pxy(a,x,y)
858 % -------------------------------------------------------------------------
859 \gdef\Pxy(#1,#2,#3){%
860 \Px(#1,#2) #3=#2
861 \Cos(#1,\@@T) \Dmul(#2,\@@T)
862 \Sin(#1,\@@T) \Dmul(#3,\@@T)}
863
864 % -------------------------------------------------------------------------
865 % Plots a polar function with n line segments from a1 to a2. You have to
866 % define a function \Px with the command: \def\Px(#1,#2){..}. #1 is the x
867 % value and #2 is the result register. \Pplot(n)(a1,a2) Examples:
868 % \def\Px(#1,#2){\Dset(\a,#1) #2=2\a \Sin(\Np#2,#2)} r=cos(2a)
869 % \def\Px(#1,#2){\Dset(\Sin(#1,#2) \Dadd(#2,1)} r=1+sin(a)
870 % -------------------------------------------------------------------------
871 \gdef\Pplot(#1)(#2,#3){%
872 \Dset(\@tx,#2) \Dset(\@ty,#3)
873 \Dmul(\@tx,3.14159pt) \Dmul(\@ty,3.14159pt)
874 \@dx=\@ty \Sub(\@dx,\@tx) \Div(\@dx,#1)
875 \@@U=\@tx \Pxy(\Np\@@U,\@ux,\@uy)
876 \Moveto(\Np\@ux,\Np\@uy)
877 \@whiledim{\@@U<\@ty}\do{\Add(\@@U,\@dx)
878 \ifdim\@@U>\@ty \@@U=\@ty \fi
879 \Pxy(\Np\@@U,\@ux,\@uy)
880 \Lineto(\Np\@ux,\Np\@uy)}}
881
882 % -------------------------------------------------------------------------
883 % Calculates the derivative dy/dx of a predefined real function \Fx.
884 % The value is x and the result is stored in register n. \Df(x,n)
885 % -------------------------------------------------------------------------
886 \gdef\Df(#1,#2){%
887 \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
888 \Fx(\Np\@dy,#2) \Fx(\Np\@dx,\@dx) \Sub(#2,\@dx) #2=32#2}
889
890 % -------------------------------------------------------------------------
891 % Calculates the partial derivative dx/dt of a predefined parameter curve
892 % \Tx. The value is t and the result is stored in register n. \Dtx(t,n)
893 % -------------------------------------------------------------------------
894 \gdef\Dtx(#1,#2){%
895 \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
896 \Tx(\Np\@dy,#2) \Tx(\Np\@dx,\@dx) \Sub(#2,\@dx) #2=32#2}
897
898 % -------------------------------------------------------------------------
899 % Calculates the partial derivative dy/dt of a predefined parameter curve
900 % \Ty. The value is t and the result is stored in register n. \Dty(t,n)
901 % -------------------------------------------------------------------------
902 \gdef\Dty(#1,#2){%
903 \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
904 \Ty(\Np\@dy,#2) \Ty(\Np\@dx,\@dx) \Sub(#2,\@dx) #2=32#2}
905
906 % -------------------------------------------------------------------------
907 % Calculates the total derivative dy/dx of a predefined parameter curve
908 % \Ty, \Tx. The value is t and the result is stored in register n. \Dtt(t,n)
909 % -------------------------------------------------------------------------
910 \gdef\Dtt(#1,#2){%
911 \Dty(#1,#2) \Dtx(#1,\@dz) \Ddiv(#2,\@dz)}
912
913 % -------------------------------------------------------------------------
914 % Calculates the partial derivative dx/da of a predefined polar curve \Px.
915 % The value is a and the result is stored in register n. \Dpx(a,n)
916 % -------------------------------------------------------------------------
917 \gdef\Dpx(#1,#2){%
918 \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
919 \Px(\Np\@dy,#2) \Cos(\Np\@dy,\@dy) \Dmul(#2,\@dy)
920 \Px(\Np\@dx,\@tx) \Cos(\Np\@dx,\@dx) \Dmul(\@tx,\@dx)
921 \Sub(#2,\@tx) #2=32#2}
922
923 % -------------------------------------------------------------------------
924 % Calculates the partial derivative dy/da of a predefined polar curve \Px.
925 % The value is a and the result is stored in register n. \Dpy(a,n)
926 % -------------------------------------------------------------------------
927 \gdef\Dpy(#1,#2){%
928 \Dset(\@dx,#1) \@dy=\@dx \Dadd(\@dy,0.015625) \Dsub(\@dx,0.015625)
929 \Px(\Np\@dy,#2) \Sin(\Np\@dy,\@dy) \Dmul(#2,\@dy)
930 \Px(\Np\@dx,\@tx) \Sin(\Np\@dx,\@dx) \Dmul(\@tx,\@dx)
931 \Sub(#2,\@tx) #2=32#2}
932
933 % -------------------------------------------------------------------------
934 % Calculates the total derivative dy/dx of a predefined polar curve \Px.
935 % The value is a and the result is stored in register n. \Dtp(a,n)
936 % -------------------------------------------------------------------------
937 \gdef\Dtp(#1,#2){%
938 \Dpy(#1,#2) \Dpx(#1,\@dz) \Ddiv(#2,\@dz)}
939
940 % -------------------------------------------------------------------------
941 % Draws a full ellipse with two rational quadratic bezier curves. x,y is
942 % the center, a and b are the diameters, n is the number of segments and c
943 % is the rotation angle in degree. \Ellipse(n)(x,y)(a,b,c)
944 % -------------------------------------------------------------------------
945 \gdef\Ellipse(#1)(#2,#3)(#4,#5,#6){%
946 \@tb=#1 \Mul(\@tb,3) \Rad(#6,\@sx)
947 \Dset(\@ux,#2) \Dset(\@uy,#3)
948 \Dset(\@vx,#2) \Dset(\@vy,#3)
949 \Dset(\@wx,#2) \Dset(\@wy,#3)
950 \Dset(\@ax,#4) \Dset(\@ay,#5)
951 \Sin(\Np\@sx,\@sy) \Cos(\Np\@sx,\@sx)
952 \@bx=0.866\@ax \@by=0.500\@ay
953 \@cx=\@bx \@cy=\@by
954 \Dmul(\@bx,\@sx)\Dmul(\@by,\@sy)
955 \Dmul(\@cx,\@sy)\Dmul(\@cy,\@sx)
956 \Sub(\@ux,\@bx) \Sub(\@ux,\@by)
957 \Sub(\@uy,\@cx) \Add(\@uy,\@cy)
958 \Add(\@wx,\@bx) \Sub(\@wx,\@by)
959 \Add(\@wy,\@cx) \Add(\@wy,\@cy)
960 \@bx=0.000\@ax \@by=2.000\@ay
961 \@cx=\@bx \@cy=\@by
962 \Dmul(\@bx,\@sx)\Dmul(\@by,\@sy)
963 \Dmul(\@cx,\@sy)\Dmul(\@cy,\@sx)
964 \Add(\@vx,\@bx) \Sub(\@vx,\@by)
965 \Add(\@vy,\@cx) \Add(\@vy,\@cy)
966 \Rmoveto(\Np\@ux,\Np\@uy,2)
967 \Rcurveto(#1)(\Np\@vx,\Np\@vy,1)(\Np\@wx,\Np\@wy,2)
968 \Rcurveto(\@tb)(\Np\@vx,\Np\@vy,-1)(\Np\@ux,\Np\@uy,2)}
969
970 % -------------------------------------------------------------------------
971 % Draws a full circle with two rational quadratic Bezier curves.
972 % \Circle(n)(x,y,radius)
973 % -------------------------------------------------------------------------
974 \gdef\Circle(#1)(#2,#3,#4){%
975 \Set(\@tb,#1) \Mul(\@tb,2)
976 \Dset(\@ux,#2) \Dset(\@uy,#3)
977 \Dset(\@vx,#2) \Dset(\@vy,#3)
978 \Dset(\@wx,#2) \Dset(\@wy,#3)
979 \Dset(\@ax,#4) \Dset(\@ay,#4) \Dset(\@az,#4)
980 \@ax=0.866\@ax \@ay=0.500\@ay \@az=2.000\@az
981 \Sub(\@ux,\@ax) \Add(\@wx,\@ax)
982 \Sub(\@uy,\@ay) \Sub(\@vy,\@az) \Sub(\@wy,\@ay)
983 \Rmoveto(\Np\@ux,\Np\@uy,2)
984 \Rcurveto(#1)(\Np\@vx,\Np\@vy,1)(\Np\@wx,\Np\@wy,2)
985 \Rcurveto(\@tb)(\Np\@vx,\Np\@vy,-1)(\Np\@ux,\Np\@uy,2)}
986
987 % -------------------------------------------------------------------------
988 % Draws a rectangle between two points, rotated at point x1,y1 by angle a
989 % in degree. \Rectangle(x1,y1)(x2,y2)(a)
990 % -------------------------------------------------------------------------
991 \gdef\Rectangle(#1,#2)(#3,#4)(#5){%
992 \Dset(\@cx,#3) \Dset(\@cy,#4) \Dset(\@@U,#5)
993 \@bx=\@cx \Dset(\@by,0) \Dset(\@dx,0) \@dy=\@cy
994 \Rotpoint(#5)(\Np\@bx,\Np\@by)(\@ux,\@uy)
995 \Rotpoint(#5)(\Np\@cx,\Np\@cy)(\@vx,\@vy)
996 \Rotpoint(#5)(\Np\@dx,\Np\@dy)(\@wx,\@wy)
997 \Dadd(\@ux,#1) \Dadd(\@uy,#2)
998 \Dadd(\@vx,#1) \Dadd(\@vy,#2)
999 \Dadd(\@wx,#1) \Dadd(\@wy,#2)
1000 \Polygon(#1,#2)(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy)(\Np\@wx,\Np\@wy)(#1,#2)}
1001
1002 % -------------------------------------------------------------------------
1003 % Draws a triangle between three points, rotated at point x1,y1 by angle a
1004 % in degree. \Triangle(x1,y1)(x2,y2)(x3,y3)(a)
1005 % -------------------------------------------------------------------------
1006 \gdef\Triangle(#1,#2)(#3,#4)(#5,#6)(#7){%
1007 \Dset(\@bx,#3) \Dsub(\@bx,#1)
1008 \Dset(\@by,#4) \Dsub(\@by,#2)
1009 \Dset(\@cx,#5) \Dsub(\@cx,#1)
1010 \Dset(\@cy,#6) \Dsub(\@cy,#2)
1011 \Rotpoint(#7)(\Np\@bx,\Np\@by)(\@ux,\@uy)
1012 \Rotpoint(#7)(\Np\@cx,\Np\@cy)(\@vx,\@vy)
1013 \Dadd(\@ux,#1) \Dadd(\@uy,#2)
1014 \Dadd(\@vx,#1) \Dadd(\@vy,#2)
1015 \Polygon(#1,#2)(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy)(#1,#2)}
1016
1017 % -------------------------------------------------------------------------
1018 % Draws a equilateral polygon with radius r and n vertices. It is rotated
1019 % around the center x,y by an angle a in degree. The first (unrotated)
1020 % point is r,0. \Epolygon(n)(x,y)(r,a)
1021 % -------------------------------------------------------------------------
1022 \gdef\Epolygon(#1)(#2,#3)(#4,#5){%
1023 \Rotpoint(#5)(#4,0)(\@vx,\@vy)
1024 \Dadd(\@vx,#2) \Dadd(\@vy,#3)
1025 \@ch=0
1026 \Moveto(\Np\@vx,\Np\@vy)
1027 \@whilenum{\@ch<#1}\do{\Add(\@ch,1)
1028 \Dset(\@ax,6.2832) \Div(\@ax,#1) \Mul(\@ax,\@ch)
1029 \Cos(\Np\@ax,\@vx) \Dmul(\@vx,#4pt)
1030 \Sin(\Np\@ax,\@vy) \Dmul(\@vy,#4pt)
1031 \Rotpoint(#5)(\Np\@vx,\Np\@vy)(\@vx,\@vy)
1032 \Dadd(\@vx,#2) \Dadd(\@vy,#3)
1033 \Lineto(\Np\@vx,\Np\@vy)}}
1034
1035 % -------------------------------------------------------------------------
1036 % Draws a sector of a circle with center xm,ym, radius r, direction a and
1037 % angle b in degree with n segments. \Sector(n)(xm,ym)(a,b)(r)
1038 % -------------------------------------------------------------------------
1039 \gdef\Sector(#1)(#2,#3)(#4,#5)(#6){%
1040 \Dset(\@ax,#4) \Dset(\@bx,#5) \Dset(\@rx,#6) \@ch=0
1041 \Rad(#4,\@sx) \Cos(\Np\@sx,\@sx) \Dmul(\@sx,\@rx)
1042 \Rad(#4,\@sy) \Sin(\Np\@sy,\@sy) \Dmul(\@sy,\@rx)
1043 \Dadd(\@sx,#2) \Dadd(\@sy,#3)
1044 \Line(#2,#3)(\Np\@sx,\Np\@sy)
1045 \@whilenum{\@ch<#1}\do{\Add(\@ch,1)
1046 \Dset(\@dx,#5) \Div(\@dx,#1) \Mul(\@dx,\@ch) \Dadd(\@dx,#4)
1047 \Rad(\Np\@dx,\@sx) \Cos(\Np\@sx,\@sx) \Dmul(\@sx,\@rx)
1048 \Rad(\Np\@dx,\@sy) \Sin(\Np\@sy,\@sy) \Dmul(\@sy,\@rx)
1049 \Dadd(\@sx,#2) \Dadd(\@sy,#3) \Lineto(\Np\@sx,\Np\@sy)} \Lineto(#2,#3)}
1050
1051 % -------------------------------------------------------------------------
1052 % These draw a circular arc (or a circular vector) with center xm,ym,
1053 % radius r, direction a and angle b in degree with n segments. Both use
1054 % \@Arc. \Arc(n)(xm,ym)(a,b)(r) \Varc(n)(xm,ym)(a,b)(r)
1055 % -------------------------------------------------------------------------
1056 \gdef\Arc(#1)(#2,#3)(#4,#5)(#6){\@Arc(#1)(#2,#3)(#4,#5)(#6,0)}
1057 \gdef\Varc(#1)(#2,#3)(#4,#5)(#6){\@Arc(#1)(#2,#3)(#4,#5)(#6,1)}
1058
1059 % -------------------------------------------------------------------------
1060 % Helper macro that draws a circular arc (t=0) or vector (t=1).
1061 % It is called by \Arc and \Varc. \@Arc(n)(xm,ym)(a,b)(r,t)
1062 % -------------------------------------------------------------------------
1063 \gdef\@Arc(#1)(#2,#3)(#4,#5)(#6,#7){%
1064 \Dset(\@ax,#4) \Dset(\@bx,#5) \Dset(\@rx,#6) \@ch=0
1065 \Rad(#4,\@vx) \Cos(\Np\@vx,\@vx) \Dmul(\@vx,\@rx)
1066 \Rad(#4,\@vy) \Sin(\Np\@vy,\@vy) \Dmul(\@vy,\@rx)
1067 \Dadd(\@vx,#2) \Dadd(\@vy,#3)
1068 \@whilenum{\@ch<#1}\do{\Add(\@ch,1) \@ux=\@vx \@uy=\@vy
1069 \Dset(\@dx,#5) \Div(\@dx,#1) \Mul(\@dx,\@ch) \Dadd(\@dx,#4)
1070 \Rad(\Np\@dx,\@vx) \Cos(\Np\@vx,\@vx) \Dmul(\@vx,\@rx)
1071 \Rad(\Np\@dx,\@vy) \Sin(\Np\@vy,\@vy) \Dmul(\@vy,\@rx)
1072 \Dadd(\@vx,#2) \Dadd(\@vy,#3)
1073 \ifnum#7=0 \Polygon(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy) \else
1074 \ifnum\@ch<#1 \Polygon(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy) \else
1075 {\Vpolygon(\Np\@ux,\Np\@uy)(\Np\@vx,\Np\@vy) \Stroke} \fi \fi}}
1076
1077 % -------------------------------------------------------------------------
1078 % Draws a circular arc with center xm,ym, radius r, direction a and angle b
1079 % with n segments. The incoming direction goes from the current point. The
1080 % last point x2, y2 gives the outgoing direcion. Lines from the current
1081 % point and to the end point are also drawn. \Arcto(n)(x1,y1)(x2,y2)(r)
1082 % -------------------------------------------------------------------------
1083 \gdef\Arcto(#1)(#2,#3)(#4,#5)(#6){%
1084 \Dset(\@yx,#2) \Dset(\@yy,#3)
1085 \Dset(\@zx,#4) \Dset(\@zy,#5) \Dset(\@rx,#6)
1086 \Direc(#2,#3)(\Np\@xx,\Np\@xy)(\@ax)
1087 \Direc(#2,#3)(\Np\@zx,\Np\@zy)(\@ay)
1088 \Len(\Np\@yx,\Np\@yy)(\Np\@xx,\Np\@xy)(\@dx)
1089 \Len(\Np\@yx,\Np\@yy)(\Np\@zx,\Np\@zy)(\@dy)
1090 \Len(\Np\@xx,\Np\@xy)(\Np\@zx,\Np\@zy)(\@dz)
1091 \Cos(\Np\@ay,\@ex) \Dmul(\@ex,\@dx) \Add(\@ex,\@xx)
1092 \Add(\@ex,\@yx) \@ex=0.5\@ex
1093 \Sin(\Np\@ay,\@ey) \Dmul(\@ey,\@dx) \Add(\@ey,\@xy)
1094 \Add(\@ey,\@yy) \@ey=0.5\@ey
1095 \Direc(\Np\@yx,\Np\@yy)(\Np\@ex,\Np\@ey)(\@az)
1096 \@cy=2.0\@dx \Dmul(\@cy,\@dy)
1097 \Dmul(\@dx,\@dx) \Dmul(\@dy,\@dy) \Dmul(\@dz,\@dz)
1098 \Add(\@dx,\@dy) \Sub(\@dx,\@dz) \Ddiv(\@dx,\@cy)
1099 \Acos(\Np\@dx,\@cx) \@cy=0.5\@cx
1100 \Dset(\@@U,1.5708) \Sub(\@@U,\@cy)
1101 \Tan(\Np\@@U,\@dx) \Dmul(\@dx,\@rx) \Cos(\Np\@@U,\@@U)
1102 \Cos(\Np\@ax,\@ux) \Dmul(\@ux,\@dx) \Add(\@ux,\@yx)
1103 \Sin(\Np\@ax,\@uy) \Dmul(\@uy,\@dx) \Add(\@uy,\@yy)
1104 \Cos(\Np\@ay,\@vx) \Dmul(\@vx,\@dx) \Add(\@vx,\@yx)
1105 \Sin(\Np\@ay,\@vy) \Dmul(\@vy,\@dx) \Add(\@vy,\@yy)
1106 \Polygon(\Np\@xx,\Np\@xy)(\Np\@ux,\Np\@uy) \Stroke
1107 \Rcurve(#1)(\Np\@ux,\Np\@uy,1)(#2,#3,\Np\@@U)(\Np\@vx,\Np\@vy,1)
1108 \Lineto(#4,#5) \Stroke}
1109
1110 % -------------------------------------------------------------------------
1111 % Draws a vector from point x1,y1 to point x2,y2. \Vect(x1,y1)(x2,y2)
1112 % -------------------------------------------------------------------------
1113 \gdef\Vect(#1,#2)(#3,#4){%
1114 \Dset(\@ux,#1) \Dset(\@uy,#2)
1115 \Len(\Np\@ux,\Np\@uy)(#3,#4)(\@tx)
1116 \Direc(\Np\@ux,\Np\@uy)(#3,#4)(\@ty)
1117 \@cd=0 \Deg(\Np\@ty,\@ty)
1118 \@dx=\@tx \Dsub(\@dx,0.20) \Dset(\@dy,0.05)
1119 \@ex=\@dx \@ey=-\@dy
1120 \Rotpoint(\Np\@ty)(\Np\@dx,\Np\@dy)(\@dx,\@dy)
1121 \Rotpoint(\Np\@ty)(\Np\@ex,\Np\@ey)(\@ex,\@ey)
1122 \Add(\@dx,\@ux) \Add(\@dy,\@uy)
1123 \Add(\@ex,\@ux) \Add(\@ey,\@uy)
1124 \Polygon(\Np\@ux,\Np\@uy)(#3,#4)(\Np\@dx,\Np\@dy)(\Np\@ex,\Np\@ey)(#3,#4)
1125 \Sfill}
1126
1127 % -------------------------------------------------------------------------
1128 % Draws a vector from the current point to point x1,y1. \Vecto(x1,y1)
1129 % -------------------------------------------------------------------------
1130 \gdef\Vecto(#1,#2){\Vect(\Np\@xx,\Np\@xy)(#1,#2)}
1131
1132 % -------------------------------------------------------------------------
1133 % Computes the function value of a polynom (dregree <= 3) at x and stores
1134 % the result in y. \Fpoly(x,y)
1135 % -------------------------------------------------------------------------
1136 \gdef\Fpoly(#1,#2){#2=\@ax
1137 \Dmul(#2,#1) \Add(#2,\@bx)
1138 \Dmul(#2,#1) \Add(#2,\@cx)
1139 \Dmul(#2,#1) \Add(#2,\@dx)}
1140
1141 % -------------------------------------------------------------------------
1142 % Computes the first derivative of a polynom (degree <= 3) at x and stores
1143 % the result in y. \Dpoly(x,y)
1144 % -------------------------------------------------------------------------
1145 \gdef\Dpoly(#1,#2){#2=\@ax
1146 \Dmul(#2,#1) \Mul(#2,3)
1147 \Add(#2,\@bx) \Add(#2,\@bx)
1148 \Dmul(#2,#1) \Add(#2,\@cx)}
1149
1150 % -------------------------------------------------------------------------
1151 % Draws a polynom y=ax^3+bx^2+cx+d from x1 to x2 with a cubic bezier curve.
1152 % All coefficients may be zero. So you can draw lines, parabolas and cubics.
1153 % \Polynom(x1,x2)(a,b,c,d)
1154 % -------------------------------------------------------------------------
1155 \gdef\Polynom(#1,#2)(#3,#4,#5,#6){%
1156 \Dset(\@sx,#1) \Dset(\@vx,#2)
1157 \Dset(\@ax,#3) \Dset(\@bx,#4)
1158 \Dset(\@cx,#5) \Dset(\@dx,#6)
1159 \@zx=\@vx \Sub(\@zx,\@sx)
1160 \Div(\@zx,3)
1161 \@tx=\@sx \Add(\@tx,\@zx)
1162 \@ux=\@vx \Sub(\@ux,\@zx)
1163 \Dpoly(\@sx,\@wx) \Dmul(\@wx,\@zx)
1164 \Dpoly(\@vx,\@wy) \Dmul(\@wy,\@zx)
1165 \Fpoly(\@sx,\@sy) \Fpoly(\@vx,\@vy)
1166 \@ty=\@sy \Add(\@ty,\@wx)
1167 \@uy=\@vy \Sub(\@uy,\@wy)
1168 \Moveto(\Np\@sx,\Np\@sy)
1169 \Bezier(\Np\@tx,\Np\@ty,\Np\@ux,\Np\@uy,\Np\@vx,\Np\@vy)}
1170
1171 % -------------------------------------------------------------------------
1172 % Draws the tangent of a polynom y=ax^3+bx^2+cx+d at abszissa x from x1
1173 % to x2 and marks the touching point. \Tangent(x)(x1,x2)(a,b,c,d)
1174 % -------------------------------------------------------------------------
1175 \gdef\Tangent(#1)(#2,#3)(#4,#5,#6,#7){%
1176 \Dset(\@xx,#1)
1177 \Dset(\@sx,#2) \Dset(\@tx,#3)
1178 \Dset(\@ax,#4) \Dset(\@bx,#5)
1179 \Dset(\@cx,#6) \Dset(\@dx,#7)
1180 \Fpoly(\@xx,\@xy) \Dpoly(\@xx,\@wx)
1181 \@sy=\@wx \@ty=\@wx
1182 \Dmul(\@sy,\@sx) \Dmul(\@ty,\@tx)
1183 \Add(\@sy,\@xy) \Add(\@ty,\@xy)
1184 \Dmul(\@wx,\@xx)
1185 \Sub(\@sy,\@wx) \Sub(\@ty,\@wx)
1186 \Line(\Np\@sx,\Np\@sy)(\Np\@tx,\Np\@ty)
1187 \Stroke
1188 \Point(1)(#1,\Np\@xy)}
1189
1190 % -------------------------------------------------------------------------
1191 % Draws a sequence of line segments. You have to provide m points
1192 % with m=i+1 (i=1,2,..). \Polygon(x1,y1)(x2,y2)...(xm,ym)
1193 % -------------------------------------------------------------------------
1194 \gdef\Polygon{\@ifnextchar ({\@polygon}{\@ck=0}}
1195 \gdef\@polygon(#1,#2){\@ifnextchar ({\@pdraw(#1,#2)}{\@ck=0}}
1196 \gdef\@pdraw(#1,#2)(#3,#4){\ifnum\@ck=0 \@ck=1 \Moveto(#1,#2) \fi
1197 \Lineto(#3,#4) \Polygon(#3,#4)}
1198
1199 % -------------------------------------------------------------------------
1200 % Draws a sequence of vector segments. You have to provide m points
1201 % with m=i+1 (i=1,2,..). \Vpolygon(x1,y1)(x2,y2)...(xm,ym)
1202 % -------------------------------------------------------------------------
1203 \gdef\Vpolygon{\@ifnextchar ({\@Vdraw}{\relax}}
1204 \gdef\@Vdraw(#1,#2){\@ifnextchar ({\@Vcoord(#1,#2)}{\relax}}
1205 \gdef\@Vcoord(#1,#2)(#3,#4){\Vect(#1,#2)(#3,#4) \Vpolygon(#3,#4)}
1206
1207 % -------------------------------------------------------------------------
1208 % Draws a sequence of quadratic bezier curves.
1209 % You have to provide m points with m=2*i+1 (i=1,2,..).
1210 % \Quadratic(x1,y1)(x2,y2)(x3,y3)...(xm,ym)
1211 % -------------------------------------------------------------------------
1212 \gdef\Quadratic{\@ifnextchar ({\@Qdraw}{\relax}}
1213 \gdef\@Qdraw(#1,#2){\@ifnextchar ({\@Qcoord(#1,#2)}{\relax}}
1214 \gdef\@Qcoord(#1,#2)(#3,#4)(#5,#6){%
1215 \Dset(\@ax,#1) \Dset(\@ay,#2)
1216 \Dset(\@bx,#3) \Dset(\@by,#4)
1217 \Dset(\@cx,#5) \Dset(\@cy,#6)
1218 \Mul(\@bx,2) \Mul(\@by,2)
1219 \Add(\@ax,\@bx)\Div(\@ax,3)
1220 \Add(\@ay,\@by)\Div(\@ay,3)
1221 \Add(\@cx,\@bx)\Div(\@cx,3)
1222 \Add(\@cy,\@by)\Div(\@cy,3)
1223 \Moveto(#1,#2) \Bezier(\Np\@ax,\Np\@ay,\Np\@cx,\Np\@cy,#5,#6)
1224 \Quadratic(#5,#6)}
1225
1226 % -------------------------------------------------------------------------
1227 % Draws a sequence of n cubic bezier curves.
1228 % You have to provide m points with m=3*i+1 (i=1,2,..).
1229 % \Cubic(x1,y1)(x2,y2)(x3,y3)(x4,y4)...(xm,ym)
1230 % -------------------------------------------------------------------------
1231 \gdef\Cubic{\@ifnextchar ({\@Cdraw}{\relax}}
1232 \gdef\@Cdraw(#1,#2){\@ifnextchar ({\@Ccoord(#1,#2)}{\relax}}
1233 \gdef\@Ccoord(#1,#2)(#3,#4)(#5,#6)(#7,#8){%
1234 \Moveto(#1,#2) \Bezier(#3,#4,#5,#6,#7,#8)
1235 \Cubic(#7,#8)}
1236
1237 % -------------------------------------------------------------------------
1238 % This is the general macro for drawing integral bezier curves. It draws
1239 % bezier curves of degree 1..7. The degree depends on the number of
1240 % coordinates. If \@ce is zero, the curve is drawn, depending on the
1241 % counter \@ci. If \@ce is not zero, the coordinates are read until no
1242 % more open cordinates are found. \Curveto needs \Moveto in front to
1243 % draw from the current point.
1244 % \Curve(n)(x0,y0)..., \Curveto(n)(x1,y1)...
1245 % -------------------------------------------------------------------------
1246 \gdef\Curve{\@cg=0\@ce=1\@ifnextchar ({\@Draw}{\@Draw(0)}}
1247 \gdef\Curveto{\@cg=0\@ce=0\@ifnextchar ({\@Draw}{\@Draw(0)}}
1248
1249 \gdef\@Draw(#1){\@ifnextchar ({\@Coord(#1)}{%
1250 \@ci=0 \ifcase\@cf\or\@Acurve\or
1251 \@Bcurve\or\@Ccurve\or\@Dcurve\or
1252 \@Ecurve\or\@Fcurve\or\@Gcurve\fi}}
1253
1254 \gdef\@Coord(#1)(#2,#3){%
1255 \ifnum#1=0
1256 \Add(\@cf,1) \Euclid(#2,#3)
1257 \else
1258 \@cf=0 \@ca=#1
1259 \@cb=\@ca \Add(\@cb,1)
1260 \ifnum\@ce=1
1261 \Dset(\@ax,#2)\Dset(\@ay,#3)
1262 \Moveto(\Np\@ax,\Np\@ay)
1263 \else
1264 \Add(\@cf,1)
1265 \@ax=\@xx \@ay=\@xy
1266 \Dset(\@bx,#2)\Dset(\@by,#3)
1267 \fi\fi \Curve(0)}
1268
1269 % -------------------------------------------------------------------------
1270 % This sets the points in euclidean (affine) coordinate space
1271 % -------------------------------------------------------------------------
1272 \gdef\Euclid(#1,#2){%
1273 \ifcase\@cf\or
1274 \Dset(\@bx,#1)\Dset(\@by,#2)\or
1275 \Dset(\@cx,#1)\Dset(\@cy,#2)\or
1276 \Dset(\@dx,#1)\Dset(\@dy,#2)\or
1277 \Dset(\@ex,#1)\Dset(\@ey,#2)\or
1278 \Dset(\@fx,#1)\Dset(\@fy,#2)\or
1279 \Dset(\@gx,#1)\Dset(\@gy,#2)\or
1280 \Dset(\@hx,#1)\Dset(\@hy,#2)\fi}
1281
1282 % -------------------------------------------------------------------------
1283 % This is the general macro to draw rational bezier curves. It draws
1284 % bezier curves of degree 1..7. The degree depends on the number of
1285 % coordinates. If \@ce is zero, the curve is drawn, depending on the
1286 % counter \@ci. If \@ci is not zero, the coordinates are read until no
1287 % more open cordinates are found. \Rcurveto needs \Rmoveto in front to
1288 % draw from the current point.
1289 % \Rcurve(n)(x0,y0,z0)..., \Rcurveto(n)(x1,y1,z1)...
1290 % -------------------------------------------------------------------------
1291 \gdef\Rcurve{\@cg=1\@ce=1\@ifnextchar ({\@Rdraw}{\@Rdraw(0)}}
1292 \gdef\Rcurveto{\@cg=1\@ce=0\@ifnextchar ({\@Rdraw}{\@Rdraw(0)}}
1293
1294 \gdef\@Rdraw(#1){\@ifnextchar ({\@Rcoord(#1)}{%
1295 \@ci=0 \ifcase\@cf\or\@Acurve\or
1296 \@Bcurve\or\@Ccurve\or\@Dcurve\or
1297 \@Ecurve\or\@Fcurve\or\@Gcurve\fi}}
1298
1299 \gdef\@Rcoord(#1)(#2,#3,#4){%
1300 \ifnum#1=0
1301 \Add(\@cf,1) \Homogen(#2,#3,#4)
1302 \else
1303 \@cf=0 \@ca=#1
1304 \@cb=\@ca \Add(\@cb,1)
1305 \ifnum\@ce=1
1306 \Dset(\@ax,#2)\Dset(\@ay,#3)\Dset(\@az,#4)
1307 \Rmoveto(\Np\@ax,\Np\@ay,\Np\@az)
1308 \Dmul(\@ax,\@az)\Dmul(\@ay,\@az)
1309 \else
1310 \Add(\@cf,1)
1311 \@ax=\@xx \@ay=\@xy \@az=\@xz
1312 \Dmul(\@ax,\@az)\Dmul(\@ay,\@az)
1313 \Dset(\@bx,#2)\Dset(\@by,#3)\Dset(\@bz,#4)
1314 \Dmul(\@bx,\@bz)\Dmul(\@by,\@bz)
1315 \fi\fi \Rcurve(0)}
1316
1317 % -------------------------------------------------------------------------
1318 % For rational bezier curves, this adds a weight component to the points
1319 % and multiplies the components by the weights. Now, we can treat the
1320 % curve as integral bezier curve with 3 components (homogen coordinates)
1321 % px=px*w, py=py*w, pz=w. \Homogen(px,py,w)
1322 % -------------------------------------------------------------------------
1323 \gdef\Homogen(#1,#2,#3){%
1324 \ifcase\@cf\or
1325 \Dset(\@bx,#1)\Dset(\@by,#2)\Dset(\@bz,#3)\Dmul(\@bx,\@bz)\Dmul(\@by,\@bz)
1326 \or
1327 \Dset(\@cx,#1)\Dset(\@cy,#2)\Dset(\@cz,#3)\Dmul(\@cx,\@cz)\Dmul(\@cy,\@cz)
1328 \or
1329 \Dset(\@dx,#1)\Dset(\@dy,#2)\Dset(\@dz,#3)\Dmul(\@dx,\@dz)\Dmul(\@dy,\@dz)
1330 \or
1331 \Dset(\@ex,#1)\Dset(\@ey,#2)\Dset(\@ez,#3)\Dmul(\@ex,\@ez)\Dmul(\@ey,\@ez)
1332 \or
1333 \Dset(\@fx,#1)\Dset(\@fy,#2)\Dset(\@fz,#3)\Dmul(\@fx,\@fz)\Dmul(\@fy,\@fz)
1334 \or
1335 \Dset(\@gx,#1)\Dset(\@gy,#2)\Dset(\@gz,#3)\Dmul(\@gx,\@gz)\Dmul(\@gy,\@gz)
1336 \or
1337 \Dset(\@hx,#1)\Dset(\@hy,#2)\Dset(\@hz,#3)\Dmul(\@hx,\@hz)\Dmul(\@hy,\@hz)
1338 \fi}
1339
1340 % -------------------------------------------------------------------------
1341 % For rational bezier curves, this projects homogeneous coordinates into
1342 % affine space by dividing each component through the interpolated weight
1343 % if pz=0 px=py=0 else px=px/pz, py=py/pz. \Affine
1344 % -------------------------------------------------------------------------
1345 \gdef\Affine{%
1346 \ifdim\@zz=\z@ \Dset(\@zx,0) \Dset(\@zy,0)
1347 \else \Ddiv(\@zx,\@zz) \Ddiv(\@zy,\@zz)\fi}
1348
1349 % -------------------------------------------------------------------------
1350 % Linear interpolation between two coordinates. We have to take care, not
1351 % to change the contents of #1 and #2, because these are fixed bezier
1352 % coordinates. The interpolation value is returned in register #3.
1353 % b0=a0+i*(a1-a0)/n
1354 % -------------------------------------------------------------------------
1355 \gdef\@One(#1,#2,#3){#3=#2
1356 \Sub(#3,#1) \Mul(#3,\@ci)
1357 \Div(#3,\@ca) \Add(#3,#1)}
1358
1359 % -------------------------------------------------------------------------
1360 % Two degree interpolation between three coordinates.
1361 % c0=b0+i*(b1-b0)/n, c1=b1+i*(b2-b1)/n, c=c0+i*(c1-c0)/n
1362 % -------------------------------------------------------------------------
1363 \gdef\@Two(#1,#2,#3,#4){%
1364 \@One(#1,#2,\@sx)
1365 \@One(#2,#3,\@sy)
1366 \@One(\@sx,\@sy,#4)}
1367
1368 % -------------------------------------------------------------------------
1369 % Three degree interpolation between four coordinates.
1370 % d0=c0+i*(c1-c0)/n, d1=c1+i*(c2-c1)/n, d=d0+i*(d1-d0)/n
1371 % -------------------------------------------------------------------------
1372 \gdef\@Three(#1,#2,#3,#4,#5){%
1373 \@Two(#1,#2,#3,\@tx)
1374 \@Two(#2,#3,#4,\@ty)
1375 \@One(\@tx,\@ty,#5)}
1376
1377 % -------------------------------------------------------------------------
1378 % Four degree interpolation between five coordinates.
1379 % e0=d0+i*(d1-d0)/n, e1=d1+i*(d2-d1)/n, e=e0+i*(e1-e0)/n
1380 % -------------------------------------------------------------------------
1381 \gdef\@Four(#1,#2,#3,#4,#5,#6){%
1382 \@Three(#1,#2,#3,#4,\@ux)
1383 \@Three(#2,#3,#4,#5,\@uy)
1384 \@One(\@ux,\@uy,#6)}
1385
1386 % -------------------------------------------------------------------------
1387 % Five degree interpolation between six coordinates.
1388 % f0=e0+i*(e1-e0)/n, f1=e1+i*(e2-e1)/n, f=f0+i*(f1-f0)/n
1389 % -------------------------------------------------------------------------
1390 \gdef\@Five(#1,#2,#3,#4,#5,#6,#7){%
1391 \@Four(#1,#2,#3,#4,#5,\@vx)
1392 \@Four(#2,#3,#4,#5,#6,\@vy)
1393 \@One(\@vx,\@vy,#7)}
1394
1395 % -------------------------------------------------------------------------
1396 % Six degree interpolation between seven coordinates.
1397 % g0=f0+i*(f1-f0)/n, g1=f1+i*(f2-f1)/n, g=g0+i*(g1-g0)/n
1398 % -------------------------------------------------------------------------
1399 \gdef\@Six(#1,#2,#3,#4,#5,#6,#7,#8){%
1400 \@Five(#1,#2,#3,#4,#5,#6,\@wx)
1401 \@Five(#2,#3,#4,#5,#6,#7,\@wy)
1402 \@One(\@wx,\@wy,#8)}
1403
1404 % -------------------------------------------------------------------------
1405 % Seven degree interpolation between eight coordinates.
1406 % h0=g0+i*(g1-g0)/n, h1=g1+i*(g2-g1)/n, h=h0+i*(h1-h0)/n
1407 % -------------------------------------------------------------------------
1408 \gdef\@Seven(#1,#2,#3,#4,#5,#6,#7,#8,#9){%
1409 \@Six(#1,#2,#3,#4,#5,#6,#7,\@yx)
1410 \@Six(#2,#3,#4,#5,#6,#7,#8,\@yy)
1411 \@One(\@yx,\@yy,#9)}
1412
1413 % -------------------------------------------------------------------------
1414 % Draws a one degree bezier curve (integral or rational).
1415 % -------------------------------------------------------------------------
1416 \gdef\@Acurve{%
1417 \@whilenum{\@ci<\@cb}\do{%
1418 \@One(\@ax,\@bx,\@zx)
1419 \@One(\@ay,\@by,\@zy)
1420 \ifnum\@cg=1
1421 \@One(\@az,\@bz,\@zz)\Affine\fi
1422 \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
1423
1424 % -------------------------------------------------------------------------
1425 % Draws a two degree bezier curve (integral or rational).
1426 % -------------------------------------------------------------------------
1427 \gdef\@Bcurve{%
1428 \@whilenum{\@ci<\@cb}\do{%
1429 \@Two(\@ax,\@bx,\@cx,\@zx)
1430 \@Two(\@ay,\@by,\@cy,\@zy)
1431 \ifnum\@cg=1
1432 \@Two(\@az,\@bz,\@cz,\@zz)\Affine\fi
1433 \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
1434
1435 % -------------------------------------------------------------------------
1436 % Draws a three degree bezier curve (integral or rational).
1437 % -------------------------------------------------------------------------
1438 \gdef\@Ccurve{%
1439 \@whilenum{\@ci<\@cb}\do{%
1440 \@Three(\@ax,\@bx,\@cx,\@dx,\@zx)
1441 \@Three(\@ay,\@by,\@cy,\@dy,\@zy)
1442 \ifnum\@cg=1
1443 \@Three(\@az,\@bz,\@cz,\@dz,\@zz)\Affine\fi
1444 \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
1445
1446 % -------------------------------------------------------------------------
1447 % Draws a four degree bezier curve (integral or rational).
1448 % -------------------------------------------------------------------------
1449 \gdef\@Dcurve{%
1450 \@whilenum{\@ci<\@cb}\do{%
1451 \@Four(\@ax,\@bx,\@cx,\@dx,\@ex,\@zx)
1452 \@Four(\@ay,\@by,\@cy,\@dy,\@ey,\@zy)
1453 \ifnum\@cg=1
1454 \@Four(\@az,\@bz,\@cz,\@dz,\@ez,\@zz)\Affine\fi
1455 \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
1456
1457 % -------------------------------------------------------------------------
1458 % Draws a five degree bezier curve (integral or rational).
1459 % -------------------------------------------------------------------------
1460 \gdef\@Ecurve{%
1461 \@whilenum{\@ci<\@cb}\do{%
1462 \@Five(\@ax,\@bx,\@cx,\@dx,\@ex,\@fx,\@zx)
1463 \@Five(\@ay,\@by,\@cy,\@dy,\@ey,\@fy,\@zy)
1464 \ifnum\@cg=1
1465 \@Five(\@az,\@bz,\@cz,\@dz,\@ez,\@fz,\@zz)\Affine\fi
1466 \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
1467
1468 % -------------------------------------------------------------------------
1469 % Draws a six degree bezier curve (integral or rational).
1470 % -------------------------------------------------------------------------
1471 \gdef\@Fcurve{%
1472 \@whilenum{\@ci<\@cb}\do{%
1473 \@Six(\@ax,\@bx,\@cx,\@dx,\@ex,\@fx,\@gx,\@zx)
1474 \@Six(\@ay,\@by,\@cy,\@dy,\@ey,\@fy,\@gy,\@zy)
1475 \ifnum\@cg=1
1476 \@Six(\@az,\@bz,\@cz,\@dz,\@ez,\@fz,\@gz,\@zz)\Affine\fi
1477 \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
1478
1479 % -------------------------------------------------------------------------
1480 % Draws a seven degree bezier curve (integral or rational).
1481 % -------------------------------------------------------------------------
1482 \gdef\@Gcurve{%
1483 \@whilenum{\@ci<\@cb}\do{%
1484 \@Seven(\@ax,\@bx,\@cx,\@dx,\@ex,\@fx,\@gx,\@hx,\@zx)
1485 \@Seven(\@ay,\@by,\@cy,\@dy,\@ey,\@fy,\@gy,\@hy,\@zy)
1486 \ifnum\@cg=1
1487 \@Seven(\@az,\@bz,\@cz,\@dz,\@ez,\@fz,\@gz,\@hz,\@zz)\Affine\fi
1488 \Lineto(\Np\@zx,\Np\@zy) \Add(\@ci,1)}}
1489
1490 % -------------------------------------------------------------------------
1491 \endinput
1492
1493 %% End of file `lapdf.sty'.