Debian Codegraph @

texmf-dist/source/latex/ebezier/ebezier.dtx

raw
1 % \iffalse meta comment
2 %
3 % Copyright (c) Gerhard A. Bachmaier 2001-2005
4 %
5 % This program can be redistributed and/or modified under the terms
6 % of the LaTeX Project Public License Distributed from CTAN
7 % archives in directory macros/latex/base/ as file lppl.txt; either
8 % version 1 of the License, or (at your option) any later version.
9 %
10 % Gerhard A. Bachmaier
11 % Institute for Medical Informatics, Statistics, and Documentation
12 % Medical University of Graz
13 % send bugs to: [email protected]
14 %
15 % \fi
16 %
17 % \iffalse
18 %
19 %<*driver>
20 \ProvidesFile{ebezier.drv}
21 %</driver>
22 %<package>\ProvidesPackage{ebezier}
23 [2005/03/01 v4]
24 %
25 %<*driver>
26 \documentclass{article}
27 \usepackage{ebezier}
28 \usepackage{calc}
29 \usepackage{doc}
30 \EnableCrossrefs
31 \CodelineIndex
32 %\DisableCrossrefs
33 \begin{document}
34 \DocInput{ebezier.dtx}
35 \end{document}
36 %</driver>
37 % \fi
38 %
39 % \CheckSum{1955}
40 %
41 % \DoNotIndex{\@X,\@Xa,\@Xb,\@Xc,\@Y,\@Ya,\@Yb,\@Yc}
42 % \DoNotIndex{\@Z,\@Za,\@Zb,\@Zc,\@Zd,\@Ze,\@Zf,\@Zg,\@Zh,\@Zi,\@Zj}
43 % \DoNotIndex{\@clnht,\@clnwd,\@dashdim,\@ifnextchar,\@killglue,\@ne}
44 % \DoNotIndex{\@ovdx,\@ovdy,\@ovri,\@ovro,\@ovxx,\@ovyy}
45 % \DoNotIndex{\@tempdima,\@tempdimb,\@tempdimc,\@tfor,\@und@fined}
46 % \DoNotIndex{\@whilenum,\@xdim,\@ydim,\advance,\approx,\bullet}
47 % \DoNotIndex{\c@@cnta,\c@@cntb,\c@@cntc,\c@@cntd,\chardef,\copy}
48 % \DoNotIndex{\csname,\def,\dimen,\divide,\do,\dp,\else,\endcsname,\fi}
49 % \DoNotIndex{\gdef,\hb@xt@,\hbox,\hskip,\hss,\ht,\ifdim,\ifnum,\ifx}
50 % \DoNotIndex{\ignorespaces,\kern,\let,\long,\loop,\lower,\Lpack}
51 % \DoNotIndex{\magstep,\magstephalf}
52 % \DoNotIndex{\multiply,\myname,\NeedsTeXFormat,\newcommand,\newcounter}
53 % \DoNotIndex{\newfont,\newif,\newlength,\newsavebox,\oval,\pi,\put}
54 % \DoNotIndex{\raise,\ratio,\realname,\relax,\repeat,\RequirePackage}
55 % \DoNotIndex{\reserved@a,\setbox,\setcounter,\setlength,\space,\sqrt}
56 % \DoNotIndex{\the,\thr@@,\tw@,\unhcopy,\unitlength,\value,\vrule,\wd,\z@}
57 %
58 % \title{Using ebezier}
59 % \author{Gerhard A. Bachmaier}
60 % \date{March 1, 2005}
61 %
62 % \renewcommand{\topfraction}{.6}
63 % \renewcommand{\bottomfraction}{.6}
64 % \setcounter{totalnumber}{5}
65 % \renewcommand{\textfraction}{.1}
66 % \setlength{\unitlength}{1pt}
67 % \setlength{\parskip}{3pt}
68 % \font \logo=logo10 scaled \magstep1
69 % \newcommand{\formstrut}{\rule{0mm}{2mm}}
70 % \providecommand{\Metafont}{%
71 % {\logo META}\discretionary{}{-}{}{\logo FONT}}
72 % \renewcommand{\thefootnote}{\fnsymbol{footnote}}
73 % \renewcommand{\arraystretch}{1.2}
74 % \newcommand\SB[2]{\setbox1=\hbox{#1#2}}
75 % \newcommand*{\Lpack}[1]{\textsf {#1}}
76 %
77 % \maketitle
78 %
79 % \begin{abstract}
80 % The package \Lpack{ebezier} is an extension of the (old)
81 % \Lpack{bezier.sty} which is now part of \LaTeXe. It defines
82 % linear and cubic Bernste\u\i{}n polynomials together with some
83 % plotting macros for arcs.
84 %
85 % With the aid of the \Lpack{calc} package also the calculation of
86 % square roots and henceforward lengths is supplied.
87 % \end{abstract}
88 %
89 %
90 % \StopEventually{}
91 %
92 % \section*{Preamble}
93 %
94 % If you want to draw complicated and/or lots of pictures, you should use
95 % \textsc{PostScript} for generating your plots and \Lpack{dvips} to include
96 % them in \TeX\ documents. \textsc{PostScript} can plot lines with arbitrary
97 % slope and unlimited length and circles with arbitrary radius just by using
98 % one command. See also the \LaTeX\ Graphics Companion\cite{T1} for further
99 % possibilities. There is also a new package \Lpack{pict2e}\cite{pict2e} a\-vail\-able
100 % which is preferrable for PDF and \textsc{PostScript}.
101 %
102 % This package will support also lines with arbitrary slopes and unlimited
103 % length, but each line has to be generated as a sample of points. Each
104 % point reduces \TeX's memory and you will very likely have to overcome some
105 % \texttt{TeX capacity excxeeded...} messages.
106 %
107 % Exact circles would involve trigonometric functions or square roots
108 % to be evaluated by \TeX.
109 % Even with some tricks for reducing the effort of the calculation algorithm
110 % there would be hundreds of calculations for each point.\footnote{%
111 % To use \TeX\ for complex computations is as satisfactory as using your desk
112 % calculator for writing tasks. But if you really want to do it e.g.\ the digits 7353
113 % can be read (rotating by $180^0$) as
114 % \texttt{ESEL}, the german word for ``donkey''.}
115 % But they may be quite
116 % well approximated by cubic bezier curves, also supplied in this package
117 % (The quality of interpolation is discussed in some detail in the Section
118 % \textit{Fitting Arcs}.) In fact, the small circles in the \LaTeX-\texttt{lcircle} fonts
119 % are also generated by the same method.
120 %
121 % For draft papers use all kind of bezier curves with small number of points,
122 % just for the final run increase the numbers. \TeX\ memory can be set free
123 % again with {\verb+\clearpage+} at the end of complicated pictures. It's
124 % also a good idea to have them at an extra page (option \verb+[p]+ for
125 % \texttt{figure} environments).
126 %
127 % For optical constructions the software LaTeXPiX\cite{PiX} may be a starting point.
128 % This software supports cubic bezier curves defined in this package or from
129 % \Lpack{bez123}\cite{T5}.
130 %
131 % \section{Mathematical Definitions}
132 %
133 % A Bernste\u\i{}n polynomial of degree $n-1\: (n\ge 2)$ is defined by
134 % $n$ points $z_1, z_2,\ldots,z_n$
135 %
136 % \[ \mathcal{B}_{n-1} [t] = \sum_{i=0}^{n-1} {n-1\choose i}
137 % (1-t)^{n-1-i} t^i z_{i+1}\quad t\in[0,1].\footnotemark\]%
138 % \footnotetext{There are also
139 % variants of this definitions with all coefficients $\equiv 1$.}
140 %
141 % The points $z_i, \: i\in\lbrace1,\ldots,n\rbrace$, may be considered as
142 % real numbers, then $\mathcal{B}$ is really a polynomial in $t$. Or they
143 % denote points in a plane, which notation we will use further. In this case
144 % both \emph{components} are polynominials and the graph for $\mathcal{B}$
145 % is---part of---an algebraic curve.
146 %
147 % \bigskip
148 %
149 % All these graphs have in common:
150 % \begin{itemize}
151 % \item The graph is contained in the convex hull of the defining points.
152 % \item The graph starts at $z_1$ and stops at $z_n$.
153 % \item At the endpoints the tangents coincident with
154 % the directions $z_1-z_2$ and $z_{n-1}-z_n$ correspondingly.
155 % \end{itemize}
156 %
157 % For $n=2$ the Bernste\u\i{}n polynomial $\mathcal{B}_1$ reduces to the
158 % linear form spanned by $z_1$ and $z_2$. The parametrization in $t$
159 %
160 % \[ \mathcal{B}_1 [t] =(1-t) z_1 + t z_2=: t[z_1,z_2]\]
161 %
162 % is also known as \emph{convex coordinates} for the segment
163 % $\overline{\formstrut z_1z_2}$.
164 %
165 % \begin{figure}[htb]
166 % \begin{center}
167 % \begin{picture}(100,60)
168 % \put(-25,-10){\framebox(155,70){}}
169 % \put(20,10){\line(2,1){60}}
170 % \put(20,10){\makebox(0,0){$\bullet$}}
171 % \put(80,40){\makebox(0,0){$\bullet$}}
172 % \put(40,20){\makebox(0,0){$\bullet$}}
173 % \put(-17,15){$z_1 (t=0)$}
174 % \put(75,47){$z_2 (t=1)$}
175 % \put(40,10){$t=1/3$}
176 % \end{picture}
177 % \end{center}
178 % \caption{Line defined by two points}
179 % \end{figure}
180 %
181 % \bigskip
182 %
183 % For $n=3$ the result is a (quadratic) parabola which can also
184 % be constructed as the convex hull of all tangents in the
185 % triangle $\Delta\,z_1 z_2 z_3$ (examplified in Fig.\ 2b).
186 %
187 % \begin{figure}[hbt]
188 % \begin{center}
189 % \begin{picture}(250,120)
190 % \put(-15,-10){\framebox(280,130){}}
191 % \Qbezier[300](0,0)(50,100)(100,0)
192 % \put(0,0){\makebox(0,0){$\bullet$}}
193 % \put(100,0){\makebox(0,0){$\bullet$}}
194 % \put(50,100){\makebox(0,0){$\bullet$}}
195 % \put(-6,10){$z_1$}
196 % \put(50,105){$z_2$}
197 % \put(99,10){$z_3$}
198 % \put(0,0){\line(1,2){50}}
199 % \put(100,0){\line(-1,2){50}}
200 %%
201 % \put(150,0){\makebox(0,0){$\bullet$}}
202 % \put(250,0){\makebox(0,0){$\bullet$}}
203 % \put(200,100){\makebox(0,0){$\bullet$}}
204 % \put(144,10){$z_1$}
205 % \put(200,105){$z_2$}
206 % \put(249,10){$z_3$}
207 % \put(150,0){\line(1,2){50}}
208 % \put(250,0){\line(-1,2){50}}
209 % \lbezier[50](160,20)(210,80)
210 % \lbezier[30](170,40)(220,60)
211 % \lbezier[30](180,60)(230,40)
212 % \lbezier[50](190,80)(240,20)
213 % \lbezier[50](155,10)(205,90)
214 % \lbezier[50](165,30)(215,70)
215 % \lbezier[30](175,50)(225,50)
216 % \lbezier[50](185,70)(235,30)
217 % \lbezier[50](195,90)(245,10)
218 % \end{picture}
219 % \end{center}
220 % \caption{Quadratic parabola (a) as Bernste\u\i{}n polynom of degree 2
221 % and (b) as hull of tangents}
222 % \end{figure}
223 %
224 % For $n=4$ finally we arrive at the cubic curves used e.g.\ in the \Metafont\
225 % book\cite{T3}.
226 %
227 % \begin{figure}[hbt]
228 % \begin{center}
229 % \begin{picture}(100,100)
230 % \put(-10,-10){\framebox(130,110){}}
231 % \Cbezier[500](0,0)(10,80)(70,40)(100,0)
232 % \put(5,0){$z_1$}
233 % \put(10,85){$z_2$}
234 % \put(70,50){$z_3$}
235 % \put(105,0){$z_4$}
236 % \end{picture}
237 % \end{center}
238 % \caption{A simple cubic parabola.}
239 % \end{figure}
240 %
241 %
242 % We will not use more complicated polynomials for several reasons:
243 %
244 % \begin{itemize}
245 % \item Higher degree polynomials require more operations to calculate
246 % just one point of the graph.
247 % \item For sketches (and \textbf{not} exact graphs!) cubic splines are
248 % sufficient to scope with all kind of different curvature requirements.
249 % \item \TeX\ can handle integers up to $2^{28}$, and ``real number'' lengths
250 % are transformed to integers (multiples of scaled points: 1\,pt=$2^{16}$ sp) \cite{T2}. To stay
251 % within this restricted range even for cubic beziers we have to do calculations
252 % in the right order. Changing the order of multiplication and divisions will
253 % result very soon in arithmetic overflows. Also multiplication with these pseudo-real
254 % numbers is not an associative operation (due to the range limits!).
255 % \item The maximum number of arguments for commands in \TeX\ is limited to nine,
256 % which is just enough for four points and a number.
257 % \end{itemize}
258 %
259 %
260 % %
261 % \section{The Plotting Macros}
262 %
263 % \subsection{Simple Beziers}
264 %
265 % There are two first level plot commands to be used in a
266 % \LaTeXe\ \texttt{picture} environment:
267 %
268 % \begin{verbatim}
269 % \lbezier[n](x1,y1)(x2,y2)
270 % \cbezier[n](x1,y1)(x2,y2)(x3,y3)(x4,y4)
271 % \end{verbatim}
272 %
273 % The arguments in square brackets are optional! If they are omitted or $n=0$ an adequate number
274 % will be calculated (cf. Section 8).
275 %
276 % \DescribeMacro{\qbezier}
277 % \verb+\lbezier+ draws line segments from point $(x_1,y_1)$
278 % to $(x_2,y_2)$, or more exactly, $n+1$ intermediate points, while
279 % \verb+\cbezier+ is an implementation of the cubic variant. Just for
280 % completeness let me remind you that the quadratic
281 % variant---\verb+\qbezier[n](x1,y1)(x2,y2)(x3,y3)+---is part of \LaTeXe.
282 %
283 % \DescribeMacro{\qbeziermax}
284 % $n$ is always limited by the number \verb+\qbeziermax+ (=500).
285 %
286 % You may change \verb+\qbeziermax+ by a command like (it is not a counter!)
287 % \verb+\renewcommand{\qbeziermax}{1000}+.
288 %
289 % \subsubsection{lbezier}
290 % \DescribeMacro{\lbezier}
291 % \verb+\lbezier+ is straightforward defined as
292 % linear polynomial. It produces equally spaced points.
293 %
294 % \begin{verbatim}
295 % ...
296 % \put(0,25){\line(1,0){90}}
297 % \lbezier[20](0,10)(90,10)
298 % \lbezier[200](0,-5)(90,-5)
299 % ...
300 % \end{verbatim}
301 %
302 % \begin{figure}[hbt]
303 % \begin{center}
304 % \begin{picture}(150,30)
305 % \put(-20,-15){\framebox(230,50){}}
306 % \put(0,25){\line(1,0){90}}
307 % \put(95,25){\makebox(100,0){\protect\LaTeXe\ \protect\texttt{line}}}
308 % \lbezier[20](0,10)(90,10)
309 % \put(95,10){\makebox(100,0){\protect\texttt{lbezier} (21 points)}}
310 % \lbezier[200](0,-5)(90,-5)
311 % \put(95,-5){\makebox(100,-5){\protect\texttt{lbezier} (201 points)}}
312 % \end{picture}
313 % \end{center}
314 % \caption{Different line commands}
315 % \end{figure}
316 %
317 % Use \verb+\lbezier+ only in cases where the line you want to plot is not within
318 % the scope of the \verb+\line+ command, i.e. the slope is not a small rational number
319 % and/or the length is too small.
320 %
321 % \subsubsection{cbezier}
322 %
323 % \DescribeMacro{\cbezier}
324 % Just like the \verb+\lbezier+ macro \verb+\cbezier+ uses no tricks to generate
325 % the third order polynomial. The examples are from the \Metafont\ book
326 % (pp. 13)\cite{T3}, where the influence of changing the order of the
327 % controlling points ($z_1$ up to $z_4$) is also demonstrated.
328 %
329 % \begin{verbatim}
330 % ...
331 % % z1=(0,16) z2=(40,84) z3=(136,96) z4=(250,0)
332 % % z12=(20,50) z23=(88,90) z34=(193,48) z123=(54,70)
333 % % z234=(140.5,69)
334 % \cbezier[400](0,16)(40,84)(136,96)(250,0)
335 % \lbezier[30](0,16)(40,84)
336 % \lbezier[30](40,84)(136,96)
337 % \lbezier[30](136,96)(250,0)
338 % \lbezier[30](20,50)(88,90)
339 % \lbezier[30](88,90)(193,48)
340 % \lbezier[30](54,70)(140.5,69)
341 % ...
342 % \end{verbatim}
343 % \begin{figure}[hbt]
344 % \begin{center}
345 % \begin{picture}(250,100)
346 % \put(-10,-10){\framebox(270,115){}}
347 % \cbezier[400](0,16)(40,84)(136,96)(250,0)
348 % \lbezier[30](0,16)(40,84)
349 % \lbezier[30](40,84)(136,96)
350 % \lbezier[30](136,96)(250,0)
351 % \lbezier[30](20,50)(88,90)
352 % \lbezier[30](88,90)(193,48)
353 % \lbezier[30](54,70)(140.5,69)
354 % \end{picture}
355 % \end{center}
356 % \caption{Iteration scheme for one point}
357 % \end{figure}
358 %
359 %
360 % \DescribeMacro{\Cbezier}
361 % The variant \verb+\Cbezier+ draws also dots and lines for the controlling points (see
362 % Fig.\ 6)\footnote{It resets also the plot symbol to the standard one; cf. Section 7}.
363 %
364 %
365 % \begin{figure}[hbt]
366 % \begin{center}
367 % \begin{picture}(184,100)
368 % \put(-10,-10){\framebox(204,100){}}
369 % \Cbezier[200](0,50)(12,72)(43,78)(84,50)
370 % \Cbezier[200](100,50)(143,78)(112,72)(184,50)
371 % \Cbezier[200](12,22)(0,0)(43,28)(84,0)
372 % \Cbezier[200](100,0)(184,0)(112,22)(143,28)
373 % \end{picture}
374 % \end{center}
375 % \caption{Examples for cubic curves with varying the order of the controlling points}
376 % \end{figure}
377 %
378 % \subsection{Circles and Arcs}
379 %
380 % All complex plotting commands in this package
381 % use a variant of \verb+\cbezier+ as building block. As
382 % in the \Metafont\ book circles and arcs may be represented by
383 % \verb+\cbezier+.
384 %
385 % To illustrate the procedure of the macro
386 % we do one calculation explicitely.
387 %
388 % E.g. we want to draw the upper right quarter of a circle with end points $z_1=(0,r)$
389 % and $z_4=(r,0)$. $z_2$ and $z_3$ determine the tangents. So we may introduce
390 % them as $z_2=(h,r)$ and $z_3=(r,h)$ with a---so far unspecified---parameter
391 % $h$.
392 %
393 % \begin{figure}[hbt]
394 % \begin{center}
395 % \begin{picture}(50,50)
396 % \put(20,10){\line(1,0){30}}
397 % \put(20,10){\line(0,1){30}}
398 % \put(20,40){\line(1,0){10}}
399 % \put(50,10){\line(0,1){10}}
400 % \put(30,40){\line(1,-1){20}}
401 % \put(20,40){\makebox(0,0){$\bullet$}}
402 % \put(50,20){\makebox(0,0){$\bullet$}}
403 % \put(30,40){\makebox(0,0){$\bullet$}}
404 % \put(50,10){\makebox(0,0){$\bullet$}}
405 % \put(5,35){$z_1$}
406 % \put(45,0){$z_4$}
407 % \put(52,18){$z_3$}
408 % \put(25,45){$z_2$}
409 % \put(-5,-10){\framebox(70,70){}}
410 % \end{picture}
411 % \end{center}
412 % \caption{Sketch for the geometrical configuration}
413 % \end{figure}
414 %
415 % If we substitute all points in the formula for the Bernste\u\i{}n
416 % polynomial for both components, we end at (for $t=1/2$)
417 % \[ x[\frac{1}{2}]=y[\frac{1}{2}]=\frac{r}{2}+\frac{3h}{8}\]
418 % These values should be $r/\sqrt{2}$ for a circle.
419 % So we arrive at
420 % \[ h=\frac{4}{3}\left(\sqrt{2}-1\right).\]
421 %
422 % \DescribeMacro{\cArc}
423 % \DescribeMacro{\cCircle}
424 % The plot commands are:
425 % \begin{verbatim}
426 % \cArc[n](xm,ym)(x1,y1)
427 % \cCircle[n](xm,ym){r}[loc]
428 % \end{verbatim}
429 %
430 % The optional qualifier $n$ determines the number
431 % of plotted points (There are as before $n+1$ plotted points for arcs; for circles the
432 % number depends on the specifier \textit{loc} and may be $n+1$, $2n+2$, or $4n+4$.).
433 %
434 % \verb+\cArc+ plots a half circle with centre $(x_m,y_m)$ and $x$-axis through
435 % $(x_1,y_1)$ counterclockwise.
436 %
437 % $r$ is the radius of the circle, specified as decimal constant in terms of
438 % \verb+\unitlength+.
439 %
440 % \verb+\cCircle+ plots full, halves and quarters of circles by specifying
441 % \textit{loc} (see the corresponding table).
442 %
443 % \begin{table}[hbtp]
444 % \caption{Location specifiers for \texttt{cCircle}s}
445 % \begin{center}
446 % \begin{tabular}{|l|l|}
447 % \hline
448 % \textit{loc} & specifies \dots\\
449 % \hline
450 % \texttt{f} & full circle\\
451 % \texttt{l} & left half circle\\
452 % \texttt{r} & right half circle\\
453 % \texttt{b} & bottom half circle\\
454 % \texttt{t} & top half circle\\
455 % \texttt{lb} or \texttt{bl} & left bottom quarter of the circle\\
456 % \texttt{lt} or \texttt{tl} & left top quarter of the circle\\
457 % \texttt{rb} or \texttt{br} & right bottom quarter of the circle\\
458 % \texttt{rt} or \texttt{tr} & right top quarter of the circle\\
459 % \hline
460 % \end{tabular}
461 % \end{center}
462 % \end{table}
463 %
464 % \begin{figure}[hbtp]
465 % \begin{center}
466 % \begin{picture}(300,100)
467 % \cCircle[1600](150,50){50}[f]
468 % \cCircle[150](100,0){50}[tr]
469 % \cCircle[150](100,100){50}[br]
470 % \cCircle[150](200,0){50}[tl]
471 % \cCircle[150](200,100){50}[bl]
472 % \cCircle[200](50,90){45}[b]
473 % \cCircle[200](50,0){45}[t]
474 % \cCircle[200](5,45){45}[r]
475 % \cCircle[200](95,45){45}[l]
476 % \cArc[200](250,70)(280,50)
477 % \cArc[200](250,60)(280,50)
478 % \cArc[200](250,50)(280,50)
479 % \cArc[200](250,40)(280,50)
480 % \cArc[200](250,30)(280,50)
481 % \put(-10,-10){\framebox(320,120){}}
482 % \end{picture}
483 % \end{center}
484 % \caption{Examples for \texttt{cCircle} and \texttt{cArc}}
485 % \end{figure}
486 % %
487 %
488 % \section{Fitting Arcs}
489 %
490 % The quality of representating arcs by cubic bezier curves is quite
491 % satisfactory. The differences between circles and beziers may be
492 % estimated in two ways.
493 %
494 % \begin{enumerate}
495 % \item If we test the overall fit the area enclosed by
496 % the curves is a good metric: The area of \texttt{Carc} for the quarter circle
497 % is $1/30 (-33+40\sqrt{2})r^2$ to be conferred with $\pi/4\:r^2$. This is an overshot
498 % by just 0.028\%!
499 % \item The pointwise fit is measured by the radial difference.
500 % The maximum is $\cong 0.00025\,r$ (at odd multiples of $\pi/8$),
501 % it is zero for all multiples of $\pi/4$.
502 % \end{enumerate}
503 %
504 % \section{Some \TeX{}nical Notes}
505 %
506 % For the macros therein a lot of counters and lengths have to
507 % be declared.\footnote{Although I reuse some internal lengths I had to
508 % declare some more to be used in function calls.}
509 % Counters represent integer numbers, lengths are
510 % ``real'' numbers (actually they are just integer multiples of
511 % $1/65536=2^{-16}$). \TeX\ has just a limited number of these
512 % stacks and therefore I use the same counters/lengths in all the macros.
513 %
514 % One cannot store a real number for further use in these internal stacks just a
515 % multiplication of a \textit{decimal constant} with a length is possible (counters
516 % may be multiplied also with real numbers but just the integer part of the decimal
517 % constant is used!)
518 %
519 % The package \Lpack{calc} introduced in the \LaTeX\ Companion\cite{T4} adds a
520 % new possiblity for multiplying lengths with the ratio of two lengths. This feature will be
521 % utilized furthermore.
522 %
523 % \section{Calculating Lengths}
524 %
525 % If I define lengths with respect to some \verb+\unitlength+ I can now define a
526 % product or fraction of two lengths:
527 %
528 % \verb+\lengthc = \lengtha*\ratio{\lengthb}{\unitlength}+
529 %
530 % and
531 %
532 % \verb+\lengthc = \unitlenght*\ratio{\lengtha}{\lengthb}+
533 %
534 % The dimension of \verb+\lengthc+ \textit{in terms of} \verb+\unitlength+ (!) is the
535 % product, or factor respectively, of the two other lengths.
536 %
537 % With these operations it is even possible to
538 % calculate square roots. Simply use the iteration scheme ($m$ integer)
539 % \[ \xi_{m+1}=\frac{1}{2}\left( \xi_m + \frac{a}{\xi_m} \right) \]
540 % which will converge fast (with accuracy \verb+\eps+=1\,sp) to $\sqrt a$ (starting with
541 % $\xi_0=a>0$).
542 %
543 %
544 % Lengths (in a \texttt{picture} environment) are easily calculated too, one just has to
545 % care for the upper limits (the maximum length for \TeX\ is roughly 16384\,pt!).
546 %
547 % \DescribeMacro{\LenMult}
548 % \DescribeMacro{\LenDiv}
549 % \DescribeMacro{\AbsLen}
550 % \DescribeMacro{\LenSqrt}
551 % \DescribeMacro{\Length}
552 % \DescribeMacro{\LenNorm}
553 % The macros are:
554 % \begin{itemize}
555 % \item \verb+\LenMult#1#2#3+ and \verb+\LenDiv#1#2#3+ with two input and one output length
556 % (\verb+#3+).
557 % \item \verb+\AbsLen#1+ which returns the input length as positive length
558 % (\TeX\ lengths can be negative!).
559 % \item \verb+\LenSqrt#1#2+ returns in the length \verb+#2+ the square root of length \verb+#1+
560 % (to say it again: measured in terms of \verb+\unitlength+).
561 % \item \verb+\Length(#1,#2)(#3,#4)#5+ stores in \verb+#5+ the length of the line
562 % segment between points \verb+(#1,#2)+ and \verb+(#3,#4)+ (coordinates may be decimal
563 % constants as in the \texttt{picture} commands).
564 % \item \verb+\LenNorm#1#2#3+ returns in \verb+#3+ the length of the hypothenuse of the
565 % rectangular triangle with catheti \verb+#1+ and \verb+#2+.
566 % \end{itemize}
567 %
568 % \DescribeMacro{\eps}
569 % \textbf{All calculations} can be only exact up to the smallest length in \TeX\ which is
570 % \verb+\eps+=1\,sp=$2^{-16}$\,pt=0.000015\,pt.
571 %
572 % Examples (\verb+\unitlength+=1\,pt):
573 % \begin{verbatim}
574 % Mult: \LenMult{3pt}{4.333333pt}{\PathLength}\the\PathLength
575 % Div: \LenDiv{3pt}{4.3333333pt}{\PathLength}\the\PathLength
576 % Abs: \setlength{\PathLength}{-10pt}\the\PathLength\
577 % \AbsLen{\PathLength}\the\PathLength
578 % Sqrt: \LenSqrt{16pt}{\PathLength}\the\PathLength\
579 % \LenSqrt{2pt}{\PathLength}\the\PathLength\
580 % \Length(1.5,4.3)(2.7,5){\PathLength}\the\PathLength\
581 % \LenNorm{3pt}{4pt}{\PathLength}\the\PathLength
582 % \end{verbatim}
583 %
584 % Mult: \LenMult{3pt}{4.333333pt}{\PathLength}\the\PathLength\ (exact: 13\,pt)
585 %
586 % Div: \LenDiv{3pt}{4.333333pt}{\PathLength}\the\PathLength\ (exact: 0.692308\,pt)
587 %
588 % Abs: \setlength{\PathLength}{-10pt}\the\PathLength\
589 % \AbsLen{\PathLength}\the\PathLength
590 %
591 % Sqrt: \LenSqrt{16pt}{\PathLength}\the\PathLength\ (exact: 4\,pt)\
592 % \LenSqrt{2pt}{\PathLength}\the\PathLength\ (exact: 1.414213\,pt)
593 %
594 % \hspace*{10mm} \Length(1.5,4.3)(2.7,5){\PathLength}\the\PathLength\ (exact: 1.389244\,pt)
595 % \LenNorm{3pt}{4pt}{\PathLength}\the\PathLength (exact: 5\,pt)
596 %
597 % \DescribeMacro{\PathLengthQ}
598 % \DescribeMacro{\PathLengthC}
599 % \DescribeMacro{\PathLength}
600 % \DescribeMacro{\pathmax}
601 % Furthermore you can use these macros to evaluate the length of linear interpolations
602 % of the curves displayed by \verb+\qbezier+ and \verb+\cbezier+. The syntax is
603 % \verb+\PathLengthQ[n](x1,y1)(x2,y2)(x3,y3)+ and\\
604 % \verb+\PathLengthC[n](x1,y1)(x2,y2)(x3,y3)(x4,y4)+ respectively. $n$ is the
605 % number of interpolation points which is bounded by \verb+\pathmax+=50. The length
606 % is stored in the%
607 % ---already defined and used---length \verb+\PathLength+. Note: $n$ is \emph{not} optional
608 % for these two macros.
609 %
610 % Example: For the cubic spline\\
611 % \verb+\cbezier[200](0,0)(50,100)(50,0)(100,100)+
612 % shown in Fig.~9 the results of the \verb+\PathLength+ \\
613 % for $n$=2,5,10,20,30,40,50
614 % are displayed below. You may increase the value of \verb+\pathmax+ as for
615 % \verb+\qbeziermax+ but the result will due to the internal calculation problems
616 % not become sigificant better.
617 %
618 % \begin{figure}[hbt]
619 % \begin{center}
620 % \begin{picture}(100,80)
621 % \put(0,0){\framebox(100,100){}}
622 % \cbezier[300](0,0)(50,100)(50,0)(100,100)
623 % \end{picture}
624 % \end{center}
625 % \caption{A nice cubic curve}
626 % \end{figure}
627 %
628 % The results are: \PathLengthC[2](0,0)(50,100)(50,0)(100,100)\the\PathLength,
629 % \PathLengthC[5](0,0)(50,100)(50,0)(100,100)\the\PathLength,
630 % \PathLengthC[10](0,0)(50,100)(50,0)(100,100)\the\PathLength,
631 % \PathLengthC[20](0,0)(50,100)(50,0)(100,100)\the\PathLength,
632 % \PathLengthC[30](0,0)(50,100)(50,0)(100,100)\the\PathLength,
633 % \PathLengthC[40](0,0)(50,100)(50,0)(100,100)\the\PathLength,
634 % \PathLengthC[50](0,0)(50,100)(50,0)(100,100)\the\PathLength.
635 % (An good numercial integration program will yield more accurate 149.999.)
636 %
637 % \section{More general arcs}
638 %
639 % \DescribeMacro{\cArcs}
640 % Finally you can plot an arc (i.e.\ a cubic approximation to the circle arc) between
641 % two points with given centre of the circle:\\
642 % \verb+\cArcs[n](xm,ym)(x1,y1)(x2,y2)+\\
643 % with $n+1$ number of points (limited by
644 % \verb+\qbeziermax+ again) and centre $(x_m,y_m)$.
645 %
646 % \begin{figure}[hbt]
647 % \begin{center}
648 % \begin{picture}(200,200)
649 % \put(0,0){\framebox(200,200){}}
650 % \put(100,100){\makebox(0,0){$\bullet$}}
651 % \cArcs[300](100,100)(120,130)(130,120)
652 % \cArcs[100](100,100)(150,110)(110,150)
653 % \cArcs[300](100,100)(130,180)(130,20)
654 % \cArcs[300](100,100)(120,170)(80,170)
655 % \cArcs[300](100,100)(60,150)(60,50)
656 % \cArcs[100](100,100)(90,90)(110,90)
657 % \cArcs[200](100,100)(60,70)(130,60)
658 % \end{picture}
659 % \end{center}
660 % \caption{Some examples for arcs; the centre is marked by $\bullet$}
661 % \end{figure}
662 %
663 % Limitations:
664 % \begin{itemize}
665 % \item The arc should be smaller than the half of a circle (The limit is
666 % handled by \verb+\cArc+ and is built-in again in \verb+\cArcs+.) Otherwise the shape
667 % will become ``elliptic'' and ly in the wrong half plane.
668 % \item There is no check for consistency if $r_1^2=(x_1-x_m)^2+(y_1-y_m)^2$ and
669 % $r_2^2=(x_2-x_m)^2+(y_2-y_m)^2$ are really equal. The graph will contain in any case
670 % both points as border points.
671 % \end{itemize}
672 % I will shortly derive the formulas used in the code. The code is even more tricky
673 % due to the fact that I had just a limited number of lengths and the code reuses
674 % some lengths explicitely and implicitely by calling routines.
675 %
676 % \begin{figure}[hbt]
677 % \begin{center}
678 % \begin{picture}(200,200)
679 % \put(0,0){\framebox(200,200){}}
680 % \put(80,20){\makebox(0,0){$\bullet$}}
681 % \put(50,120){\makebox(0,0){$\bullet$}}
682 % \put(171.65,70){\makebox(0,0){$\bullet$}}
683 % \put(100,135){\makebox(0,0){$\bullet$}}
684 % \put(146.65,115.825){\makebox(0,0){$\bullet$}}
685 % \put(120.3,115.6){\makebox(0,0){$\bullet$}}
686 % \lbezier[150](80,20)(50,120)
687 % \lbezier[150](80,20)(171.65,70)
688 % \cArcs[200](80,20)(50,120)(171.65,70)
689 % \lbezier[150](50,120)(150,150)
690 % \lbezier[150](171.65,70)(121.65,161.65)
691 % \lbezier[30](80,20)(141.65,170)
692 % \put(66,21){$M$}
693 % \put(41,115){4}
694 % \put(174,65){1}
695 % \put(90,135){3}
696 % \put(150,112){2}
697 % \put(116,120){5}
698 % \end{picture}
699 % \end{center}
700 % \caption{Sketch for the geometric situation}
701 % \end{figure}
702 %
703 % We know the coordinates for the points $M$, 1, and 4. The tangents $\overline{43}$ and
704 % $\overline{12}$ are normals to the radius in the corresponding points. The distances
705 % $\overline{43}$ and $\overline{12}$ should be equal. 5 lies on the symmetry axis (dotted
706 % line) with distance $r$ from $M$.
707 %
708 % \noindent Normal vectors: $\vec n_1=(y_m-y_1,x_1-x_m)$ and $\vec n_2=(y_4-y_m,x_m-x_4)$
709 %
710 % \noindent Coordinate vectors: $\vec 2 = \vec 1 + \lambda \vec n_1$ and
711 % $\vec 3 = \vec 4 + \lambda \vec n_2$ ($\lambda$ is the same because both normal
712 % vectors have length $r$)
713 %
714 % \noindent Furthermore $\vec 5={\cal B}_4 [1/2]$ (the cubic spline
715 % should also be symmetric and contain 5)
716 %
717 % Now we have:
718 % \begin{eqnarray}
719 % x[ t] & = & (1-t)^3 x_1 + 3 t (1-t)^2 x_2 + 3 t^2 (1-t) x_3 +t^3 x_4\\
720 % y[ t] & = & (1-t)^3 y_1 + 3 t (1-t)^2 y_2 + 3 t^2 (1-t) y_3 +t^3 y_4
721 % \end{eqnarray}
722 %
723 % Substituting for $x_2$, $y_2$, $x_3$, and $y_3$ and $t\to1/2$:
724 % \begin{eqnarray}
725 % x_5=x\left[ \frac{1}{2}\right] & = & \frac{1}{2}
726 % (x_1 +x_4) + \frac{3}{8} \lambda(y_4-y_1) \\
727 % y_5=y\left[ \frac{1}{2}\right] & = & \frac{1}{2}
728 % (y_1 +y_4) + \frac{3}{8} \lambda(x_1-x_4 )
729 % \end{eqnarray}
730 %
731 % We could now calculate the norm of this point and set it equal to the radius $r^2=
732 % (x_m-x_1)^2+(y_m-y_1)^2$. This gives a quadratic equation for
733 % $\lambda$. But the result is a rather complex term with respect to our input parameters.
734 %
735 % A nicer term can be found if we define
736 % \begin{equation}
737 % x_5=x_m+\kappa (x_1+x_4-2x_m) \quad y_5=y_m+\kappa (y_1+y_4-2y_m)
738 % \end{equation}
739 % with aid of the symmetry vector. $\kappa$ is simply $r$ divided by the norm of the
740 % symmetry vector.
741 %
742 % The resulting $\lambda$ is now (using just the $x$-equation)
743 % \begin{equation}
744 % \lambda=\frac{4}{3} (-1+2 \kappa)\frac{x_1+x_4-2x_m}{y_4-y_1}
745 % \end{equation}
746 %
747 % Special cases:
748 % \begin{itemize}
749 % \item The symmetry vector is the null vector if $\overline{14}$ is a diameter of the
750 % circle. But this case is already solved by \verb+\cArc+.
751 % \item For $y_4=y_1$ one needs the equation for the $y$-component, i.e.\ we have as factor
752 % $(y_1+y_4-2y_m)/(x_1-x_4)$ in $\lambda$.
753 % \end{itemize}
754 %
755 %
756 % \section{Varying the line thickness}
757 %
758 % There is another package, \Lpack{bez123}\cite{T5}, which introduces also linear and cubic
759 % bezier curves, even variants which plot exactly all kind of conic curves (ellipses,
760 % parabolas, and hyperbolas). There are two features in \Lpack{bez123}, which I added in the
761 % third version of \Lpack{ebezier}:
762 %
763 % \DescribeMacro{\thinlines}
764 % \DescribeMacro{\thicklines}
765 % \DescribeMacro{\linethickness}
766 % \DescribeMacro{\qbeziermax}
767 % \begin{enumerate}
768 % \item Changing the size of the plot squares by the \LaTeX\ commands\\
769 % \verb+\thinlines+, \verb+\thicklines+, and/or \verb+\linethickness+.
770 % \item Calulation of an optimal number of plot points if $n$=0 instead of using the
771 % maximum \verb+\qbeziermax+ (see next section).
772 % \end{enumerate}
773 %
774 % If you look close to lines you will note some peculiarity. For instance the original
775 % \LaTeX\ \verb+\line+ is in horizontal/vertical mode a simple \verb+\ruler+.
776 %
777 % \begin{figure}[htbp]
778 % \begin{center}
779 % \begin{picture}(100,100)
780 % \thinlines
781 % \put(-5,-5){\framebox(110,110){}}
782 % \setlength{\linethickness}{0.1pt}
783 % \put(0,10){\line(1,0){100}}
784 % \put(10,0){\line(0,1){100}}
785 % \setlength{\linethickness}{10pt}
786 % \put(10,10){\line(1,0){60}}
787 % \put(10,10){\line(0,1){60}}
788 % \end{picture}
789 % \end{center}
790 % \caption{Axes with standard lines}
791 % \end{figure}
792 %
793 % Remark: The \textit{line} is exactly as long as specified.
794 %
795 % \DescribeMacro{\@wholewidth}
796 % But the plot point used by \verb+\qbezier+, \Lpack{bez123} and \Lpack{ebezier}
797 % (until version 2!) is a small square which is not centered at the control points
798 % (dimension \verb+\@wholewidth+)
799 %
800 % \begin{figure}[htbp]
801 % \begin{center}
802 % \begin{picture}(50,50)
803 % \thinlines
804 % \put(-5,-5){\framebox(60,60){}}
805 % \setlength{\linethickness}{0.1pt}
806 % \put(0,25){\line(1,0){50}}
807 % \put(15,0){\line(0,1){50}}
808 % \DefOldPlotSymbol
809 % \setlength{\linethickness}{10pt}
810 % \lbezier[1](15,25)(15,25)
811 % \end{picture}
812 % \end{center}
813 % \caption{Old plot symbol}
814 % \end{figure}
815 %
816 % which results in a shifted $y$-axis and \textit{lines} which are actually longer
817 % by an amount of one square (i.e. \verb+\@wholewidth+)
818 %
819 % \begin{figure}[htbp]
820 % \begin{center}
821 % \begin{picture}(100,100)
822 % \thinlines
823 % \put(-5,-5){\framebox(110,110){}}
824 % \setlength{\linethickness}{0.1pt}
825 % \put(0,10){\line(1,0){100}}
826 % \put(10,0){\line(0,1){100}}
827 % \setlength{\linethickness}{10pt}
828 % \DefOldPlotSymbol
829 % \setlength{\linethickness}{10pt}
830 % \lbezier[10](10,10)(80,10)
831 % \lbezier[10](10,10)(10,80)
832 % \end{picture}
833 % \end{center}
834 % \caption{Axes with old plot symbol}
835 % \end{figure}
836 %
837 % or with hollow squares ($\bullet$ references to the end points).
838 %
839 % \begin{figure}[htbp]
840 % \begin{center}
841 % \begin{picture}(100,100)
842 % \thinlines
843 % \put(-5,-5){\framebox(110,110){}}
844 % \setlength{\linethickness}{0.1pt}
845 % \put(0,10){\line(1,0){100}}
846 % \put(10,0){\line(0,1){100}}
847 % \thinlines
848 % \put(10,5){\framebox(70,10){}}
849 % \put(10,5){\framebox(10,70){}}
850 % \put(10,5){\framebox(10,10){}}
851 % \put(70,5){\framebox(10,10){}}
852 % \put(10,65){\framebox(10,10){}}
853 % \put(10,10){\makebox(0,0){$\bullet$}}
854 % \put(70,10){\makebox(0,0){$\bullet$}}
855 % \put(10,70){\makebox(0,0){$\bullet$}}
856 % \end{picture}
857 % \end{center}
858 % \caption{Axes with old plot symbol (hollow)}
859 % \end{figure}
860 %
861 %
862 % This version uses centered plot symbols (standard is again a square)
863 %
864 % \begin{figure}[htbp]
865 % \begin{center}
866 % \begin{picture}(50,50)
867 % \put(-5,-5){\framebox(60,60){}}
868 % \setlength{\linethickness}{0.1pt}
869 % \put(0,25){\line(1,0){50}}
870 % \put(25,0){\line(0,1){50}}
871 % \DefStandardPlotSymbol
872 % \setlength{\linethickness}{10pt}
873 % \lbezier[1](25,25,)(25,25)
874 % \end{picture}
875 % \end{center}
876 % \caption{New standard plot symbol}
877 % \end{figure}
878 %
879 % which corrects the shift of the $y$-axis. The line is again longer but this
880 % time the excess is symmetrically on both ends
881 %
882 % \begin{figure}[htbp]
883 % \begin{center}
884 % \begin{picture}(100,100)
885 % \thinlines
886 % \put(-5,-5){\framebox(110,110){}}
887 % \setlength{\linethickness}{0.1pt}
888 % \put(0,10){\line(1,0){100}}
889 % \put(10,0){\line(0,1){100}}
890 % \setlength{\linethickness}{10pt}
891 % \lbezier[10](10,10)(80,10)
892 % \lbezier[10](10,10)(10,80)
893 % \end{picture}
894 % \end{center}
895 % \caption{Axes with new standard plot symbol}
896 % \end{figure}
897 %
898 % or again with hollow squares.
899 %
900 % \begin{figure}[htbp]
901 % \begin{center}
902 % \begin{picture}(100,100)
903 % \thinlines
904 % \put(-5,-5){\framebox(110,110){}}
905 % \setlength{\linethickness}{0.1pt}
906 % \put(0,10){\line(1,0){100}}
907 % \put(10,0){\line(0,1){100}}
908 % \thinlines
909 % \put(5,5){\framebox(70,10){}}
910 % \put(5,5){\framebox(10,70){}}
911 % \put(5,5){\framebox(10,10){}}
912 % \put(65,5){\framebox(10,10){}}
913 % \put(5,65){\framebox(10,10){}}
914 % \put(10,10){\makebox(0,0){$\bullet$}}
915 % \put(70,10){\makebox(0,0){$\bullet$}}
916 % \put(10,70){\makebox(0,0){$\bullet$}}
917 % \end{picture}
918 % \end{center}
919 % \caption{Axes with new standard plot symbol (hollow)}
920 % \end{figure}
921 %
922 % \DescribeMacro{\DefOldPlotSymbol}
923 % \DescribeMacro{\Qbezier}
924 % To be consistent with the old version the command \verb+\DefOldPlotSymbol+
925 % is supplied which uses the old form. Also a variant \verb+\Qbezier+ for
926 % \verb+\qbezier+ is
927 % defined which can use the new plot symbol.\footnote{This command is just for convenience.
928 % A quadratic bezier can be plotted as cubic bezier as follows. If you want to plot
929 % $\backslash$\texttt{qbezier[100](z1)(zm)(z4)} with $(z)=(x,y)$ you may calulate points
930 % $z_2=2/3[z_m,z_1]$ and $z_3=2/3[z_m,z_4]$. The cubic bezier $\backslash$%
931 % \texttt{cbezier[100](z1)(z2)(z3)(z4)} is exactly the same as the quadratic one!}%
932 % \footnote{It can also use the other new symbols defined later.}
933 %
934 % The next point of consideration is the handling of slanted lines.
935 % In the ordinary \LaTeX-\texttt{picture} environment
936 % \verb+\linethickness+ has no effect on slanted lines. Now the change applies
937 % but a new problem occurs. If you plot a slanted line (slope angle $\varphi$)
938 % with squares
939 %
940 % \begin{figure}[htb]
941 % \begin{center}
942 % \begin{picture}(100,80)
943 % \thinlines
944 % \put(-5,-5){\framebox(110,90){}}
945 % \put(5,5){\framebox(30,30){}}
946 % \put(25,15){\framebox(30,30){}}
947 % \put(45,25){\framebox(30,30){}}
948 % \put(65,35){\framebox(30,30){}}
949 % \put(35,5){\line(2,1){70}}
950 % \put(5,35){\line(2,1){70}}
951 % \put(60,5){\vector(-1,2){5}}
952 % \put(55,15){\line(-1,2){23}}
953 % \put(32.5,60){\vector(1,-2){5}}
954 % \put(61,22){$\scriptscriptstyle\varphi$}
955 % \put(32,47){$\scriptscriptstyle\varphi$}
956 % \put(65,10){$d$}
957 % \end{picture}
958 % \end{center}
959 % \caption{Effective thickness for slanted lines}
960 % \end{figure}
961 %
962 % your line gets effective thicker! The factor of enlargement is $\sin \varphi
963 % +\cos \varphi$ which has its maximum $\sqrt 2$ with slope $\varphi_0=45^0$.
964 %
965 %
966 % There are two possiblities to correct the thickness
967 % \begin{itemize}
968 % \item correct the line thickness of each line or
969 % \item use other plot symbols which behave better.
970 % \end{itemize}
971 %
972 % \DescribeMacro{\Lbezier}
973 % The first possibilitiy can be realized just for \verb+\lbezier+ and not
974 % \verb+\cbezier+ because the slope changes from point to point in the latter case.
975 % The solution is established by internally changing the \verb+\linethickness+
976 % by the factor $\ell/(\Delta x+\Delta y)$ where $\ell$ denotes the length of the
977 % line ($=\sqrt{\Delta^2 x +\Delta^2 y}$)
978 % and $\Delta x$ is the horizontal difference of the the points
979 % ($\Delta y$ respectivelly for the vertical difference).
980 %
981 % To use this line type call \verb+\Lbezier[n](x1,y1)(x2,y2)+.
982 %
983 % The second chance is to change the plot symbol to a disc. The smallest disk
984 % available is the character ``.'' at 5pt. Unfortunately this method will
985 % implicitely restrict the \verb+\linethickness+ to some definite values (see the
986 % following table for the numbers in question).
987 %
988 % \begin{table}[hbtp]
989 % \caption{Dimensions for various plot symbols}
990 % \begin{center}
991 % \begin{tabular}{|ll|rr|l|}
992 % \hline
993 % Font&Size for (10pt) & Width & Heigth & Rule \\
994 % \hline
995 % \verb+\vrm+ &tiny& \SB{\vrm}{.}\the\wd1 & \SB{\vrm}{.}\the\ht1 &
996 % \SB{\vrm}{.}\rule{1 cm}{\ht1} \copy1\\
997 % \verb+\virm+ &tiny for 11/12pt& \SB{\virm}{.}\the\wd1 & \SB{\virm}{.}\the\ht1 &
998 % \SB{\virm}{.}\rule{1 cm}{\ht1} \copy1\\
999 % \verb+\viirm+ & scriptsize &\SB{\viirm}{.}\the\wd1 & \SB{\viirm}{.}\the\ht1 &
1000 % \SB{\viirm}{.}\rule{1 cm}{\ht1} \copy1\\
1001 % \verb+\viiirm+ & footnotesize & \SB{\viiirm}{.}\the\wd1 & \SB{\viiirm}{.}\the\ht1 &
1002 % \SB{\viiirm}{.}\rule{1 cm}{\ht1} \copy1\\
1003 % \verb+\ixrm+ & small &\SB{\ixrm}{.}\the\wd1 & \SB{\ixrm}{.}\the\ht1 &
1004 % \SB{\ixrm}{.}\rule{1 cm}{\ht1} \copy1\\
1005 % \verb+\xrm+ & normalsize &\SB{\xrm}{.}\the\wd1 & \SB{\xrm}{.}\the\ht1 &
1006 % \SB{\xrm}{.}\rule{1 cm}{\ht1} \copy1\\
1007 % \verb+\xirm+ & normalsize 11pt& \SB{\xirm}{.}\the\wd1 & \SB{\xirm}{.}\the\ht1 &
1008 % \SB{\xirm}{.}\rule{1 cm}{\ht1} \copy1\\
1009 % \verb+\xiirm+ & large &\SB{\xiirm}{.}\the\wd1 & \SB{\xiirm}{.}\the\ht1 &
1010 % \SB{\xiirm}{.}\rule{1 cm}{\ht1} \copy1\\
1011 % \verb+\xivrm+ & Large & \SB{\xivrm}{.}\the\wd1 & \SB{\xivrm}{.}\the\ht1 &
1012 % \SB{\xivrm}{.}\rule{1 cm}{\ht1} \copy1\\
1013 % \verb+\xviirm+ & LARGE &\SB{\xviirm}{.}\the\wd1 & \SB{\xviirm}{.}\the\ht1 &
1014 % \SB{\xviirm}{.}\rule{1 cm}{\ht1} \copy1\\
1015 % \verb+\xxrm+ & huge &\SB{\xxrm}{.}\the\wd1 & \SB{\xxrm}{.}\the\ht1 &
1016 % \SB{\xxrm}{.}\rule{1 cm}{\ht1} \copy1\\
1017 % \verb+\xxvrm+ & Huge &\SB{\xxvrm}{.}\the\wd1 & \SB{\xxvrm}{.}\the\ht1 &
1018 % \SB{\xxvrm}{.}\rule{1 cm}{\ht1} \copy1\\
1019 % \verb+$\bullet$+ & &\SB{$\bullet$}{}\the\wd1 &\SB{$\bullet$}{}\the\ht1&
1020 % \SB{$\bullet$}{}\rule{1cm}{\ht1} \copy1\\
1021 % \hline
1022 % \end{tabular}
1023 % \end{center}
1024 % \end{table}
1025 %
1026 % \DescribeMacro{\DefPlotSymbol}
1027 % With the aim of the command \verb+\DefPlotSymbol{item}+ you may define any
1028 % \textit{item} as your plot symbol\footnote{A similar approach with centered
1029 % symbols can be found in the packages
1030 % \Lpack{epic}\cite{epic} and PiC\TeX\cite{pictex}.}.
1031 % It will be centered as the default plot square
1032 % (otherwise an even larger shift of the $y$-axis would occur). Use explicit font
1033 % selection with the names supplied in the table to ensure style independence
1034 % (otherwise e.g.\
1035 % \verb+\DefPlotSymbol{\tiny .}+ would be different in 10pt and 11pt context).
1036 %
1037 % \DescribeMacro{\DefShiftedPlotSymbol}
1038 % This works
1039 % for all \textit{items} which have a vertical symmetry axis with respect to their
1040 % defining bounding box (defined by \Metafont) and which ly on the baseline
1041 % (or beyond if they have some defined depth). It will not work otherwise. For example the
1042 % circles from the circle font have heigth and depth zero and their reference point is
1043 % already the centre (i.e. the symbol extends backward). Or consider the ``*''-sign.
1044 % It does not ly on the baseline. For these cases a generalized command is supplied:\\
1045 % \verb+\DefShiftedPlotSymbol{item}{x-shift}{y-shift}{height}+.
1046 %
1047 % The shifts are applied
1048 % to the left and downward. The supplied heigth will only have effect if you specify
1049 % $n=0$ for the number of plotting points.
1050 %
1051 % Examples:
1052 % \begin{verbatim}
1053 % \DefShiftedPlotSymbol{\tencirc n}{0pt}{0pt}{1pt}
1054 % \DefShiftedPlotSymbol{\tencirc \char'176}{0pt}{0pt}{15pt}
1055 % \DefShiftedPlotSymbol{\fbox{\Huge *}}{0pt}{0pt}{25pt}
1056 % %with bounding box
1057 % \setbox0=\hbox{*}
1058 % \DefShiftedPlotSymbol{*}{.5\wd0}{.7\ht0}{.6\ht0}
1059 % \lbezier[1](100,30)(100,30)
1060 % \lbezier[0](0,20)(125,20)
1061 % \DefShiftedPlotSymbol{*}{.5\wd0}{.7\ht0}{10\ht0}
1062 % \lbezier[0](0,10)(125,10)
1063 % \end{verbatim}
1064 %
1065 % \setlength{\fboxsep}{0pt}
1066 % \setlength{\fboxrule}{0.1pt}
1067 %
1068 % \begin{figure}[hbtp]
1069 % \begin{center}
1070 % \begin{picture}(125,50)
1071 % \put(-5,-5){\framebox(135,60){}}
1072 % \setlength{\linethickness}{0.1pt}
1073 % \put(0,30){\line(1,0){125}}
1074 % \multiput(25,20)(25,0){4}{\line(0,1){20}}
1075 % \DefShiftedPlotSymbol{\tencirc n}{0pt}{0pt}{1pt}
1076 % \lbezier[1](25,30)(25,30)
1077 % \DefShiftedPlotSymbol{\tencirc \char'176}{0pt}{0pt}{15pt}
1078 % \lbezier[1](50,30)(50,30)
1079 % \DefShiftedPlotSymbol{\fbox{\Huge *}}{0pt}{0pt}{25pt}
1080 % \lbezier[1](75,30)(75,30)
1081 % \setbox0=\hbox{*}
1082 % \DefShiftedPlotSymbol{*}{.5\wd0}{.7\ht0}{.6\ht0}
1083 % \lbezier[1](100,30)(100,30)
1084 % \lbezier[0](0,20)(125,20)
1085 % \DefShiftedPlotSymbol{*}{.5\wd0}{.7\ht0}{10\ht0}
1086 % \lbezier[0](0,10)(125,10)
1087 % \end{picture}
1088 % \end{center}
1089 % \caption{Examples for other plot symbols}
1090 % \end{figure}
1091 %
1092 % \emph{Caution:} The commands for changing the line thickness have
1093 % implicit effects for plot symbols
1094 % defined with \verb+\DefPlotSymbol{item}+ or \\
1095 % \verb+\DefShiftedPlotSymbol+. The implicit or
1096 % explicit defined height is redefined. But the effect is only visible in case $n=0$.
1097 %
1098 %
1099 % \DescribeMacro{\DefStandardPlotSymbol}
1100 % In any case you may restore \textbf{default values} by stating
1101 % \begin{verbatim}
1102 % \DefStandardPlotSymbol
1103 % \thinlines
1104 % \end{verbatim}
1105 %
1106 % \section{Estimation for the number of plotting points}
1107 %
1108 % As mentioned in the last section all plotting macros will calculate the number
1109 % of plotting points if the value $n=0$ is active. All calculations will
1110 % use the actual length of the object which can
1111 % be calculated with the aim of the calculation macros in Section \textit{Calculating Lengths}.
1112 % For all these calculations \verb+\eps+ is temporarily increased by a factor of 10 and
1113 % for higher bezier curves just 5 intermediate points will be used. If the calculated number
1114 % exceeds the specified maximum \verb+\qbeziermax+ an info in the log-file will be generated.
1115 %
1116 % All macros for circles and arcs will use a simpler estimate due to their construction
1117 % by an intrinsic call of the cubic bezier. It uses the length of the chord and
1118 % the maximal deviation factor $\pi/2$ from the arc length.
1119 %
1120 %
1121 % \section{Joining linear beziers}
1122 %
1123 % \DescribeMacro{\ljoin}
1124 % A further command has been supplied to ease the drawing of polygon paths. Instead of
1125 % writing a sequence of \verb+\lbezier+s with common vertices you can write compactly
1126 % \verb+\ljoin[n](x1,y1)(x2,y2)(x3,y3)...(xm,ym)+
1127 %
1128 % Caution: There should be no spaces in the command, so break lines with \% if
1129 % necessary. There should be at least 2 points. The parameter $n$ is optional, internally
1130 % \verb-\lbezier[n](xk,yk)(xk+1,yk+1)- will be executed.
1131 %
1132 % \DescribeMacro{\Ljoin}
1133 % There is also a variant \verb+\Ljoin+ which uses \verb+\Lbezier+.
1134 %
1135 % \renewcommand{\qbeziermax}{1200}
1136 % \begin{figure}
1137 % \begin{center}
1138 % \begin{picture}(200,100)
1139 % \put(-5,-5){\framebox(210,110){}}
1140 % \begin{picture}(100,100)
1141 % \ljoin(0,0)(20,100)(20,0)(40,50)(40,0)(60,25)(60,0)(80,12.5)(80,0)(100,6.25)(100,0)
1142 % \end{picture}
1143 % \begin{picture}(100,100)
1144 % \Ljoin(0,0)(20,100)(20,0)(40,50)(40,0)(60,25)(60,0)%
1145 % (80,12.5)(80,0)(100,6.25)(100,0)
1146 % \end{picture}
1147 % \end{picture}
1148 % \end{center}
1149 % \caption{$\backslash$\texttt{ljoin} versus $\backslash$\texttt{Ljoin}}
1150 % \end{figure}
1151 %
1152 % \changes{Version 1}{2000/07/28}{original version}
1153 % \changes{Version 2}{2001/12/04}{major bug fix for cCircle}
1154 % \changes{Version 3}{2002/10/23}{major changes}
1155 % \changes{Version 4}{2005/03/01}{minor changes}
1156 %
1157 % \section*{Versions}
1158 %
1159 % This is Version 4 from March 1, 2004.
1160 %
1161 % Changes with regard to version 3:
1162 % \begin{itemize}
1163 % \item Bug-address changed.
1164 % \item Error in defining (first) equation corrected (thanks to \[email protected]+).
1165 % \item Marginal corrections with regard to \Lpack{l2tabu} (v1.8).
1166 % \item Documentaion as pdf supplied.
1167 % \end{itemize}
1168 %
1169 % Changes with regard to version 2:
1170 % \begin{itemize}
1171 % \item Implementing line thickness (\verb+\thinlines+, \verb+\thicklines+, and\\
1172 % \verb+\setlength{\linethickness}{dimen}+.
1173 % \item Different plot symbols.
1174 % \item \verb+\Lbezier+ for equally thick lines in all directions.
1175 % \item \verb+\Qbezier+ implementation to be used with new plot symbols.
1176 % \item Calculation of an optimal number of plot symbols (as default number for case $n$=0).
1177 % \item Parameter $n$ is for all \emph{plot} commands optional.
1178 % \item New macro for polygon paths.
1179 % \item Style supplied in dtx-format.
1180 % \item Minor style changes regarding numbers and lengths.
1181 % \end{itemize}
1182 %
1183 % Changes with regard to Version 1:
1184 % \begin{itemize}
1185 % \item \verb+\@tempa+ replaced by \verb+\@TempDim+. \verb+\@tempa+ was also
1186 % used by other packages.
1187 % \item Additionaly supplied \verb+\RequirePackage{calc}+.
1188 % \item Bug fixed for circles. The original macros did actually not support changes in
1189 % \verb+\unitlength+.
1190 % \end{itemize}
1191 %
1192 % \begin{thebibliography}{9}
1193 % \bibitem{T2} D.\ E.\ Knuth: \textit{The} \TeX\ \textit{Book}, Addison-Wesley,
1194 % Reading MA, 1986.
1195 % \bibitem{T3} D.\ E.\ Knuth: \textit{The} \Metafont\ \textit{Book}, Addison-Wesley,
1196 % Reading MA, 1986.
1197 % \bibitem{T4} M.\ Goossens, F.\ Mittelbach, A.\ Samarin: \textit{The} \LaTeX\ \textit{Companion},
1198 % Addison-Wesley, Reading MA, 1994.
1199 % \bibitem{T1} M.\ Goossens, S.\ Rahtz, F.\ Mittelbach: \textit{The} \LaTeX\
1200 % \textit{Graphics Companion}, Addison-Wesley, Reading MA, 1997.
1201 % \bibitem{T5} P.\ Wilson: \textit{The} \Lpack{bez123} \textit{and} \Lpack{multiply}
1202 % \textit{packages}, 1998;\\ packages at CTAN/macros/latex/contrib/supported/bez123.
1203 % \bibitem{epic} S.\ Podar: \textit{Enhancements to the Picture Environment
1204 % in }\LaTeX, 1986;\\ package at CTAN/macros/latex/other/epic.
1205 % \bibitem{pictex} M.\ J.\ Wichura: \textit{The PiC}\TeX\ \textit{Manual}, 1992;\\
1206 % package at CTAN/graphics/pictex.
1207 % \bibitem{pict2e} R.\ Niepraschk, H.\ Gaesslein: The \Lpack{pict2e} Package, 2003;\\
1208 % package at CTAN/macros/latex/contrib/pict2e.
1209 % \bibitem{PiX} N.\ J.\ H.\ M.\ van Beurden: A \LaTeX\ picture editor for Windows, 2003;\\
1210 % package at CTAN/systems/win32/latexpix.
1211 % \end{thebibliography}
1212 %
1213 % \OnlyDescription
1214 %
1215 % \section{Implementation}
1216 %
1217 % The macros \verb+\lbezier+ and \verb+\cbezier+ are rather old, they existed since
1218 % I realized the existence of \Lpack{bezier.sty} more then ten years ago. Therefore
1219 % the macros are written rather in pure \TeX\ than in \LaTeX. Only the calculation
1220 % macros demand for \LaTeX\ notation to use the package \Lpack{calc}. But with this
1221 % version the macros interact more and some \LaTeX\ part occurrs also in the plot macros.
1222 %
1223 % \begin{macrocode}
1224 %<*package>
1225 \NeedsTeXFormat{LaTeX2e}
1226 \RequirePackage{calc}
1227 %%
1228 % \end{macrocode}
1229 % I define new font names because \texttt{cmr} may not be the standard font. They
1230 % may be needed for plotting symbols.
1231 % \begin{macrocode}
1232 \newfont{\vrm}{cmr5}
1233 \newfont{\virm}{cmr6}
1234 \newfont{\viirm}{cmr7}
1235 \newfont{\viiirm}{cmr8}
1236 \newfont{\ixrm}{cmr9}
1237 \newfont{\xrm}{cmr10}
1238 \newfont{\xiirm}{cmr12}
1239 \newfont{\xviirm}{cmr17}
1240 \newfont{\xirm}{cmr10 scaled \magstephalf}
1241 \newfont{\xivrm}{cmr10 scaled \magstep2}
1242 \newfont{\xxrm}{cmr10 scaled \magstep4}
1243 \newfont{\xxvrm}{cmr10 scaled \magstep5}
1244 %%
1245 % \end{macrocode}
1246 %
1247 % I need only three new counters,
1248 % \begin{macrocode}
1249 \newcounter{@cnta}\newcounter{@cntb}\newcounter{@cntc}\newcounter{@cntd}
1250 %%
1251 % \end{macrocode}
1252 % but a lot of lengths. Packages like PiC\TeX\ have problems by defining too many
1253 % lengths, so I try to use as many already defined lengths (defined for usage
1254 % in a plotting context).
1255 % \begin{macrocode}
1256 %% \@TempDim#1#2#3{"count"|"dimen"|"box"|"skip"}{\myname}{\realname}
1257 %% allocate new one or alias is defined, so use it
1258 %%
1259 \def\@TempDim#1#2#3{%
1260 \ifx\@und@fined#3\csname new#1\endcsname#2%
1261 \else\let#2#3\fi}
1262 %%
1263 \@TempDim{dimen}\@X\@ovxx
1264 \@TempDim{dimen}\@Xa\@ovdx
1265 \@TempDim{dimen}\@Xb\@ovyy
1266 \@TempDim{dimen}\@Xc\@ovdy
1267 \@TempDim{dimen}\@Y\@ovro
1268 \@TempDim{dimen}\@Ya\@ovri
1269 \@TempDim{dimen}\@Yb\@xdim
1270 \@TempDim{dimen}\@Yc\@ydim
1271 \@TempDim{dimen}\@Z\@clnht
1272 \@TempDim{dimen}\@Za\@clnwd
1273 \@TempDim{dimen}\@Zb\@dashdim
1274 \@TempDim{dimen}\@Zc\@tempdima
1275 \@TempDim{dimen}\@Zd\@tempdimb
1276 \@TempDim{dimen}\@Ze\@tempdimc
1277 %%
1278 \newlength{\@Zf}\newlength{\@Zg}\newlength{\@Zh}
1279 \newlength{\@Zi}\newlength{\@Zj}
1280 % \end{macrocode}
1281 %
1282 % This special length will be used for the circle macros. The magic number is
1283 % $0.55228474983=4/3 (\sqrt{2}-1)$.
1284 %
1285 % \begin{macrocode}
1286 \newlength{\magicnum}
1287 \newcommand\set@magic{%
1288 \setlength{\magicnum}{0.55228474983\unitlength}}
1289 %%
1290 % \end{macrocode}
1291 %
1292 % Another special one is \verb+\eps+. It could be initialized by \verb+\eps\@ne+
1293 % but due to its context to the calculation part 1sp=1/65536pt is used.
1294 %
1295 % \begin{macrocode}
1296 \newlength{\eps}
1297 \setlength{\eps}{1sp}
1298 %%
1299 % \end{macrocode}
1300 %
1301 % The last one is \verb+\PathLength+. It stores lengths which the user may need for
1302 % further use.
1303 %
1304 % \begin{macrocode}
1305 \newlength{\PathLength}
1306 %%
1307 % \end{macrocode}
1308 %
1309 % This two constants are needed in calculations, but I did not want to waste
1310 % any additional counter. \verb+\pathmax+ may be redefined to exceed 256, so it
1311 % is not defined by \verb+\chardef+.
1312 %
1313 % \begin{macrocode}
1314 \chardef\x@=10
1315 \newcommand{\pathmax}{50}
1316 %%
1317 % \end{macrocode}
1318 %
1319 % This fundamental box will keep the plotting symbol.
1320 %
1321 % \begin{macrocode}
1322 \newsavebox{\@pt}
1323 %%
1324 % \end{macrocode}
1325 %
1326 % I have to distinguish three cases: standard plot symbol, old standard plot symbol,
1327 % or any new one. For this purpose I need two logicals.
1328 %
1329 % \begin{macrocode}
1330 \newif\if@other@symbol
1331 \newif\if@standard@symbol
1332 % \end{macrocode}
1333 %
1334 % All plot symbols may be defined by the most general one,\\
1335 % \verb+\DefShiftedPlotSymbol+, but this way may be faster. The
1336 % other important macro is \verb+\set@width+ which redefines the plot
1337 % box due to changes which may have occurred (line thickness).
1338 %
1339 % \begin{macrocode}
1340 \newcommand{\DefStandardPlotSymbol}{%
1341 \@other@symbolfalse\@standard@symboltrue
1342 \setbox\@pt\hbox{\hskip -.5\wd0\vrule height\@halfwidth
1343 depth\@halfwidth width\@wholewidth}}
1344 \newcommand{\DefOldPlotSymbol}{%
1345 \@other@symbolfalse\@standard@symbolfalse
1346 \setbox\@pt\hbox{\vrule height\@halfwidth
1347 depth\@halfwidth width\@wholewidth}}
1348 \newcommand{\DefPlotSymbol}[1]{\setbox0=\hbox{#1}\@X\ht0\advance\@X-\dp0
1349 \@halfwidth.5\ht0\@wholewidth\ht0
1350 \@other@symboltrue\@standard@symbolfalse
1351 \setbox\@pt\hbox{\hskip -.5\wd0\lower.5\@X\copy0}}
1352 \newcommand{\DefShiftedPlotSymbol}[4]{\setbox0=\hbox{#1}\@X #2\@Y #3
1353 \@wholewidth #4\@halfwidth.5\@wholewidth
1354 \@other@symboltrue\@standard@symbolfalse
1355 \setbox\@pt\hbox{\hskip-\@X\lower\@Y\copy0}}
1356 \newcommand{\set@width}{%
1357 \if@other@symbol
1358 \relax
1359 \else
1360 \if@standard@symbol
1361 \@X-.5\@wholewidth
1362 \else
1363 \@X\z@
1364 \fi
1365 \setbox\@pt\hbox{\hskip\@X\vrule height\@halfwidth
1366 depth\@halfwidth width\@wholewidth}%
1367 \fi}
1368 %%
1369 % \end{macrocode}
1370 %
1371 % The initialization is done here. Note that \verb+\thinlines+
1372 % is already default and needs not be specified here.
1373 %
1374 % \begin{macrocode}
1375 \DefStandardPlotSymbol
1376 %%
1377 % \end{macrocode}
1378 %
1379 % All plot macros have an optional number. Therefore an additional internal macro
1380 % is needed (it will have the same name with an extra @ in front of it.
1381 %
1382 % Here is the simpliest one, the linear case.
1383 %
1384 % \begin{macrocode}
1385 \def\lbezier{\@ifnextchar [{\@lbezier}{\@lbezier[0]}}
1386 \def\@lbezier[#1](#2,#3)(#4,#5){%
1387 \c@@cntc#1\relax
1388 \ifnum \c@@cntc<\@ne
1389 % \end{macrocode}
1390 %
1391 % I decrease the precision locally to speed up calculations. We need just
1392 % an estimate.
1393 %
1394 % \begin{macrocode}
1395 \multiply\eps\x@
1396 \Length(#2,#3)(#4,#5){\PathLength}%
1397 \divide\eps\x@
1398 \c@@cntc\PathLength
1399 \@X.5\@halfwidth \divide\c@@cntc\@X
1400 \ifnum \c@@cntc>\qbeziermax%
1401 \PackageInfo{ebezier}{\the\c@@cntc\space points needed exceeding %
1402 qbeziermax=\qbeziermax!}\fi
1403 \fi
1404 \ifnum \c@@cntc>\qbeziermax
1405 \c@@cntc\qbeziermax\relax
1406 \PackageWarning{ebezier}{Counter reset to qbeziermax=\qbeziermax!}\fi
1407 \c@@cnta\c@@cntc\relax\advance\c@@cnta\@ne
1408 \@Xa #4\unitlength \advance\@Xa-#2\unitlength \divide\@Xa\c@@cntc
1409 \@Ya #5\unitlength \advance\@Ya-#3\unitlength \divide\@Ya\c@@cntc
1410 \c@@cntb\z@\relax
1411 \set@width
1412 \put(#2,#3){\@whilenum{\c@@cntb<\c@@cnta}\do
1413 {\@X\c@@cntb \@Xa\@Y \c@@cntb\@Ya
1414 \raise\@Y\hbox to\z@{\hskip\@X\unhcopy\@pt\hss}%
1415 \advance\c@@cntb\@ne}}}
1416 %%
1417 % \end{macrocode}
1418 %
1419 % \verb+\Lbezier+ changes the line thickness. It is stored in \verb+\@Xb+.
1420 %
1421 % \begin{macrocode}
1422 \def\Lbezier{\@ifnextchar [{\@Lbezier}{\@Lbezier[0]}}
1423 \def\@Lbezier[#1](#2,#3)(#4,#5){\c@@cntc#1\relax
1424 \@Xb\@wholewidth
1425 \@X #4\unitlength \advance\@X-#2\unitlength \AbsLen{\@X}%
1426 \@Y #5\unitlength \advance\@Y-#3\unitlength \AbsLen{\@Y}%
1427 \LenNorm{\@X}{\@Y}{\@Xc}\LenMult{\@Xc}{\@wholewidth}{\@Yb}%
1428 \LenDiv{\@Yb}{\@X+\@Y}{\@wholewidth}\@halfwidth .5\@wholewidth
1429 \ifnum \c@@cntc<\@ne
1430 \multiply\eps\x@
1431 \Length(#2,#3)(#4,#5){\PathLength}%
1432 \divide\eps\x@
1433 \c@@cntc\PathLength
1434 \@X.5\@halfwidth \divide\c@@cntc\@X
1435 \ifnum \c@@cntc>\qbeziermax%
1436 \PackageInfo{ebezier}{\the\c@@cntc\space points needed exceeding %
1437 qbeziermax=\qbeziermax!}\fi
1438 \fi
1439 \ifnum \c@@cntc>\qbeziermax
1440 \c@@cntc\qbeziermax\relax
1441 \PackageWarning{ebezier}{Counter reset to qbeziermax=\qbeziermax!}\fi
1442 \c@@cnta\c@@cntc\relax \advance\c@@cnta\@ne
1443 \@Xa #4\unitlength \advance\@Xa-#2\unitlength \divide\@Xa\c@@cntc
1444 \@Ya #5\unitlength \advance\@Ya-#3\unitlength \divide\@Ya\c@@cntc
1445 \c@@cntb\z@\relax
1446 \set@width
1447 \put(#2,#3){\@whilenum{\c@@cntb<\c@@cnta}\do
1448 {\@X\c@@cntb \@Xa\@Y \c@@cntb\@Ya
1449 \raise\@Y\hbox to\z@{\hskip\@X\unhcopy\@pt\hss}%
1450 \advance\c@@cntb\@ne}}
1451 \@wholewidth\@Xb \@halfwidth .5\@Xb}
1452 %%
1453 % \end{macrocode}
1454 %
1455 % The two joining macros need two internal steps to process an implicit list.
1456 %
1457 % \begin{macrocode}
1458 \def\ljoin{\@ifnextchar [{\@ljoin}{\@ljoin[0]}}
1459 \def\@ljoin[#1](#2,#3){\@ifnextchar ({\l@join[#1](#2,#3)}{\relax}}
1460 \def\l@join[#1](#2,#3)(#4,#5){%
1461 \lbezier[#1](#2,#3)(#4,#5)%
1462 \ljoin[#1](#4,#5)}
1463 %%
1464 \def\Ljoin{\@ifnextchar [{\@Ljoin}{\@Ljoin[0]}}
1465 \def\@Ljoin[#1](#2,#3){\@ifnextchar ({\L@join[#1](#2,#3)}{\relax}}
1466 \def\L@join[#1](#2,#3)(#4,#5){%
1467 \Lbezier[#1](#2,#3)(#4,#5)%
1468 \Ljoin[#1](#4,#5)}
1469 %%
1470 % \end{macrocode}
1471 %
1472 % \verb+\Qbezier+ is defined, because \verb+\qbezier+ uses an other plot box.
1473 % The original macro is a little bit more complicated to handle extra spaces
1474 % but I hope this will suffice.
1475 %
1476 % \begin{macrocode}
1477 \def\Qbezier{\@ifnextchar [{\@Qbezier}{\@Qbezier[0]}}
1478 \def\@Qbezier[#1](#2,#3)(#4,#5)(#6,#7){\c@@cntc#1\relax
1479 \ifnum \c@@cntc<\@ne
1480 \multiply\eps\x@
1481 \PathLengthQ[5](#2,#3)(#4,#5)(#6,#7)%
1482 \divide\eps\x@
1483 \c@@cntc\PathLength
1484 \@X.5\@halfwidth \divide\c@@cntc\@X
1485 \ifnum \c@@cntc>\qbeziermax%
1486 \PackageInfo{ebezier}{\the\c@@cntc\space points needed exceeding %
1487 qbeziermax=\qbeziermax!}\fi
1488 \fi
1489 \ifnum \c@@cntc>\qbeziermax
1490 \c@@cntc\qbeziermax\relax
1491 \PackageWarning{ebezier}{Counter reset to qbeziermax=\qbeziermax!}\fi
1492 \c@@cnta\c@@cntc\relax \advance\c@@cnta\@ne
1493 \@Xa #4\unitlength \advance\@Xa-#2\unitlength \multiply\@Xa\tw@
1494 \@Xb #6\unitlength \advance\@Xb-#2\unitlength
1495 \advance\@Xb-\@Xa \divide\@Xb\c@@cntc
1496 \@Ya #5\unitlength \advance\@Ya-#3\unitlength \multiply\@Ya\tw@
1497 \@Yb #7\unitlength \advance\@Yb-#3\unitlength
1498 \advance\@Yb-\@Ya \divide\@Yb\c@@cntc
1499 \c@@cntb\z@\relax
1500 \set@width
1501 \put(#2,#3){\@whilenum{\c@@cntb<\c@@cnta}\do
1502 {\@X\c@@cntb \@Xb\@Y \c@@cntb\@Yb
1503 \advance\@X\@Xa \advance\@Y\@Ya
1504 \divide\@X\c@@cntc \divide\@Y\c@@cntc
1505 \multiply\@X\c@@cntb \multiply\@Y\c@@cntb
1506 \raise \@Y \hb@xt@\z@{\kern\@X\unhcopy\@pt\hss}%
1507 \advance\c@@cntb\@ne}}}
1508 %%
1509 % \end{macrocode}
1510 %
1511 % \verb+\cbezier+ is the most complex command. All calculations have to be
1512 % done in the correct order to minimize overflow conditions.
1513 %
1514 % \begin{macrocode}
1515 \def\cbezier{\@ifnextchar [{\@cbezier}{\@cbezier[0]}}
1516 \def\@cbezier[#1](#2,#3)(#4,#5)(#6,#7)(#8,#9){%
1517 \c@@cntc#1\relax
1518 \ifnum \c@@cntc<\@ne
1519 \multiply\eps\x@
1520 \PathLengthC[5](#2,#3)(#4,#5)(#6,#7)(#8,#9)%
1521 \divide\eps\x@
1522 \c@@cntc\PathLength
1523 \@X = 0.5\@halfwidth
1524 \divide\c@@cntc\@X
1525 \ifnum \c@@cntc>\qbeziermax%
1526 \PackageInfo{ebezier}{\the\c@@cntc\space points needed exceeding %
1527 qbeziermax=\qbeziermax!}\fi
1528 \fi
1529 \ifnum \c@@cntc>\qbeziermax
1530 \c@@cntc\qbeziermax\relax
1531 \PackageWarning{ebezier}{Counter reset to qbeziermax=\qbeziermax!}\fi
1532 \c@@cnta\c@@cntc\relax \advance\c@@cnta\@ne
1533 \@Xa #4\unitlength \advance\@Xa-#2\unitlength \multiply\@Xa\thr@@
1534 \@Xb #6\unitlength \advance\@Xb-#2\unitlength \multiply\@Xb\thr@@
1535 \advance\@Xb -2\@Xa
1536 \@Xc #8\unitlength \advance\@Xc-#2\unitlength
1537 \advance\@Xc-\@Xa \advance\@Xc-\@Xb
1538 \@Ya #5\unitlength \advance\@Ya-#3\unitlength \multiply\@Ya\thr@@
1539 \@Yb #7\unitlength \advance\@Yb-#3\unitlength \multiply\@Yb\thr@@
1540 \advance\@Yb-2\@Ya
1541 \@Yc #9\unitlength \advance\@Yc-#3\unitlength
1542 \advance\@Yc-\@Ya \advance\@Yc-\@Yb
1543 \divide\@Xc\c@@cntc \divide\@Yc\c@@cntc
1544 \c@@cntb\z@\relax
1545 \set@width
1546 \put(#2,#3){\@whilenum{\c@@cntb<\c@@cnta}\do
1547 {\@X\c@@cntb \@Xc\@Y \c@@cntb\@Yc
1548 \advance\@X\@Xb \advance\@Y\@Yb
1549 \divide\@X\c@@cntc \divide\@Y\c@@cntc
1550 \multiply\@X\c@@cntb \multiply\@Y\c@@cntb
1551 \advance\@X\@Xa \advance\@Y\@Ya
1552 \divide\@X\c@@cntc \divide\@Y\c@@cntc
1553 \multiply\@X\c@@cntb \multiply\@Y\c@@cntb
1554 \raise \@Y \hbox to \z@{\hskip \@X\unhcopy\@pt\hss}%
1555 \advance\c@@cntb\@ne}}}
1556 %%
1557 % \end{macrocode}
1558 %
1559 % \verb+\Cbezier+ changes the plot symbol so a restore is needed. But it will
1560 % not keep the original one!
1561 %
1562 % \begin{macrocode}
1563 \def\Cbezier{\@ifnextchar [{\@Cbezier}{\@Cbezier[0]}}
1564 \def\@Cbezier[#1](#2,#3)(#4,#5)(#6,#7)(#8,#9){%
1565 \cbezier[#1](#2,#3)(#4,#5)(#6,#7)(#8,#9)%
1566 \c@@cntc#1\relax\divide\c@@cntc\thr@@
1567 \lbezier[\c@@cntc](#2,#3)(#4,#5)%
1568 \lbezier[\c@@cntc](#4,#5)(#6,#7)%
1569 \lbezier[\c@@cntc](#6,#7)(#8,#9)%
1570 \DefPlotSymbol{$\bullet$}
1571 \lbezier[1](#2,#3)(#2,#3)
1572 \lbezier[1](#4,#5)(#4,#5)
1573 \lbezier[1](#6,#7)(#6,#7)
1574 \lbezier[1](#8,#9)(#8,#9)
1575 \DefStandardPlotSymbol
1576 \thinlines}
1577 %%
1578 % \end{macrocode}
1579 %
1580 % \verb+\l@put+ is like \verb+\put+ but its arguments are lengths and not
1581 % decimal constants. It will be used in \verb+\l@cbezier+ which also has
1582 % lengths as arguments. All complex plotting commands use this form.
1583 % Just for the calculation of plotting points four more lengths are needed.
1584 % I use the ``scratch'' dimens from \TeX.
1585 %
1586 % \begin{macrocode}
1587 \long\gdef\l@put(#1,#2)#3{%
1588 \@killglue\raise#2\hb@xt@\z@{\kern#1#3\hss}\ignorespaces}
1589 %%
1590 \long\gdef\l@cbezier[#1](#2,#3)(#4,#5)(#6,#7)(#8,#9){%
1591 \c@@cntc#1\relax
1592 \dimen1#2\dimen3#3
1593 %%
1594 \@Xa #4 \advance\@Xa-#2 \multiply\@Xa\thr@@
1595 \@Xb #6 \advance\@Xb-#2 \multiply\@Xb\thr@@
1596 \advance\@Xb-2\@Xa
1597 \@Xc #8 \advance\@Xc-#2
1598 \advance\@Xc-\@Xa \advance\@Xc-\@Xb
1599 \@Ya #5 \advance\@Ya-#3 \multiply\@Ya\thr@@
1600 \@Yb #7 \advance\@Yb-#3 \multiply\@Yb\thr@@
1601 \advance\@Yb-2\@Ya
1602 \@Yc #9 \advance\@Yc-#3
1603 \advance\@Yc-\@Ya \advance\@Yc-\@Yb
1604 %%
1605 %% assume half arc
1606 %%
1607 \ifnum \c@@cntc <\@ne
1608 \multiply\eps\x@
1609 \dimen5#2 \advance\dimen5-#8 \AbsLen{\dimen5}%
1610 \dimen7#3 \advance\dimen7-#9 \AbsLen{\dimen7}%
1611 \LenNorm{\dimen5}{\dimen7}{\PathLength}%
1612 \divide\eps\x@
1613 \c@@cntc\PathLength
1614 \dimen5.5\@halfwidth
1615 \divide\c@@cntc\dimen5
1616 %%
1617 %% 11/7 \approx \pi/2
1618 %%
1619 \divide\c@@cntc 7 \multiply\c@@cntc 11
1620 \ifnum \c@@cntc>\qbeziermax
1621 \PackageInfo{ebezier}{\the\c@@cntc\space points needed exceeding %
1622 qbeziermax=\qbeziermax!}\fi
1623 \fi
1624 \ifnum\c@@cntc>\qbeziermax
1625 \c@@cntc\qbeziermax\relax
1626 \PackageWarning{ebezier}{Counter reset to qbeziermax=\qbeziermax!}\fi
1627 \c@@cnta\c@@cntc\relax\advance\c@@cnta\@ne%
1628 \divide\@Xc\c@@cntc \divide\@Yc\c@@cntc
1629 \c@@cntb\z@\relax
1630 \set@width
1631 \l@put(\dimen1,\dimen3){\@whilenum{\c@@cntb<\c@@cnta}\do
1632 {\@X\c@@cntb \@Xc\@Y \c@@cntb\@Yc
1633 \advance\@X\@Xb \advance\@Y\@Yb
1634 \divide\@X\c@@cntc \divide\@Y\c@@cntc
1635 \multiply\@X\c@@cntb \multiply\@Y\c@@cntb
1636 \advance\@X\@Xa \advance\@Y\@Ya
1637 \divide\@X\c@@cntc \divide\@Y\c@@cntc
1638 \multiply\@X\c@@cntb \multiply\@Y\c@@cntb
1639 \raise\@Y\hbox to\z@{\hskip\@X\unhcopy\@pt\hss}%
1640 \advance\c@@cntb\@ne}}}
1641 %%
1642 % \end{macrocode}
1643 %
1644 % The building blocks for the circles are the four quarters. Each is defined
1645 % separately and will be combined by the \verb+\cCircle+ macro.
1646 %
1647 % \begin{macrocode}
1648 \def\@circle@rt[#1](#2,#3)#4{%
1649 \set@magic
1650 \@Z #4\magicnum\@Za #2\unitlength\@Zb #3\unitlength
1651 \@Zc #2\unitlength \advance\@Zc\@Z
1652 \@Zd #3\unitlength \advance\@Zd\@Z
1653 \@Ze #4\unitlength \advance\@Ze\@Za
1654 \@Zf #4\unitlength \advance\@Zf\@Zb
1655 \l@cbezier[#1](\@Ze,\@Zb)(\@Ze,\@Zd)(\@Zc,\@Zf)(\@Za,\@Zf)}
1656 %%
1657 \def\@circle@lt[#1](#2,#3)#4{%
1658 \set@magic
1659 \@Z #4\magicnum\@Za #2\unitlength\@Zb #3\unitlength
1660 \@Zc #2\unitlength \advance\@Zc-\@Z
1661 \@Zd #3\unitlength \advance\@Zd\@Z
1662 \@Ze -#4\unitlength \advance\@Ze\@Za
1663 \@Zf #4\unitlength \advance\@Zf\@Zb
1664 \l@cbezier[#1](\@Za,\@Zf)(\@Zc,\@Zf)(\@Ze,\@Zd)(\@Ze,\@Zb)}
1665 %%
1666 \def\@circle@rb[#1](#2,#3)#4{%
1667 \set@magic
1668 \@Z #4\magicnum\@Za #2\unitlength\@Zb #3\unitlength
1669 \@Zc #2\unitlength \advance\@Zc\@Z
1670 \@Zd #3\unitlength \advance\@Zd-\@Z
1671 \@Ze #4\unitlength \advance\@Ze\@Za
1672 \@Zf -#4\unitlength \advance\@Zf\@Zb
1673 \l@cbezier[#1](\@Za,\@Zf)(\@Zc,\@Zf)(\@Ze,\@Zd)(\@Ze,\@Zb)}
1674 %%
1675 \def\@circle@lb[#1](#2,#3)#4{%
1676 \set@magic
1677 \@Z #4\magicnum\@Za #2\unitlength\@Zb #3\unitlength
1678 \@Zc #2\unitlength \advance\@Zc-\@Z
1679 \@Zd #3\unitlength \advance\@Zd-\@Z
1680 \@Ze -#4\unitlength \advance\@Ze\@Za
1681 \@Zf -#4\unitlength \advance\@Zf\@Zb
1682 \l@cbezier[#1](\@Ze,\@Zb)(\@Ze,\@Zd)(\@Zc,\@Zf)(\@Za,\@Zf)}
1683 %%
1684 % \end{macrocode}
1685 %
1686 % I use the logicals from the \verb+\oval+ defined in \LaTeX. So I need just
1687 % one more logical \verb+\if@ovf+.
1688 %
1689 % \begin{macrocode}
1690 \newif\if@ovf
1691 \def\cCircle{\@ifnextchar [{\@cCircle}{\@cCircle[0]}}
1692 \def\@cCircle[#1](#2,#3)#4[#5]{%
1693 \@ovtfalse\@ovbfalse\@ovlfalse\@ovrfalse\@ovffalse
1694 \c@@cnta#1\relax
1695 \@tfor\reserved@a:=#5\do{\csname @ov\reserved@a true\endcsname}%
1696 \if@ovf\@ovttrue \divide\c@@cnta\tw@\fi
1697 \if@ovt
1698 \if@ovr
1699 \@circle@rt[\c@@cnta](#2,#3){#4}
1700 \else\if@ovl
1701 \@circle@lt[\c@@cnta](#2,#3){#4}
1702 \else\divide\c@@cnta\tw@
1703 \@circle@rt[\c@@cnta](#2,#3){#4}
1704 \@circle@lt[\c@@cnta](#2,#3){#4}
1705 \fi\fi
1706 \if@ovf
1707 \@circle@rb[\c@@cnta](#2,#3){#4}
1708 \@circle@lb[\c@@cnta](#2,#3){#4}
1709 \fi
1710 \else\if@ovb
1711 \if@ovr
1712 \@circle@rb[\c@@cnta](#2,#3){#4}
1713 \else\if@ovl
1714 \@circle@lb[\c@@cnta](#2,#3){#4}
1715 \else\divide\c@@cnta\tw@
1716 \@circle@rb[\c@@cnta](#2,#3){#4}
1717 \@circle@lb[\c@@cnta](#2,#3){#4}
1718 \fi\fi
1719 \else
1720 \divide\c@@cnta\tw@
1721 \if@ovr
1722 \@circle@rb[\c@@cnta](#2,#3){#4}
1723 \@circle@rt[\c@@cnta](#2,#3){#4}
1724 \else
1725 \if@ovl
1726 \@circle@lb[\c@@cnta](#2,#3){#4}
1727 \@circle@lt[\c@@cnta](#2,#3){#4}
1728 \else
1729 \PackageError{Ebezier}{Missing or illegal position specifier in cCircle}
1730 \fi\fi\fi\fi}
1731 %%
1732 \def\cArc{\@ifnextchar [{\@cArc}{\@cArc[0]}}
1733 \def\@cArc[#1](#2,#3)(#4,#5){%
1734 \c@@cntc#1\relax
1735 \@X #2\unitlength \@Y #3\unitlength
1736 \@Za #4\unitlength \@Zb #5\unitlength
1737 \@Zc 2\@X \advance\@Zc-\@Za \@Zd 2\@Y \advance\@Zd-\@Zb
1738 \@Xa\@Y \advance\@Xa-\@Zb \@Ya\@Za \advance\@Ya-\@X
1739 \multiply\@Xa 4 \divide\@Xa\thr@@ \multiply\@Ya 4 \divide\@Ya\thr@@
1740 \@Ze\@Za \advance\@Ze\@Xa \@Zf\@Zb \advance\@Zf\@Ya
1741 \@Zg\@Zc \advance\@Zg\@Xa \@Zh\@Zd \advance\@Zh\@Ya
1742 \l@cbezier[#1](\@Za,\@Zb)(\@Ze,\@Zf)(\@Zg,\@Zh)(\@Zc,\@Zd)}
1743 %%
1744 % \end{macrocode}
1745 %
1746 % Historically from this point starts the calculation part. The notation
1747 % will be more \LaTeX\ convenient.
1748 %
1749 % All square roots are calculated by the same iteration. To keep numbers
1750 % small enough some scaling has to be done (factor \verb+\c@@cntd+).
1751 %
1752 % \begin{macrocode}
1753 \def\LenMult#1#2#3{\setlength{#3}{#1*\ratio{#2}{\unitlength}}}
1754 %%
1755 \def\LenDiv#1#2#3{\setlength{#3}{\unitlength*\ratio{#1}{#2}}}
1756 %%
1757 \def\AbsLen#1{\ifdim#1<\z@\setlength{#1}{-#1}\fi}
1758 %%
1759 \def\LenSqrt#1#2{%
1760 \setlength{\@Za}{#1}%
1761 \ifdim\@Za>\eps\loop\setlength{\@Zb}{(\@Za+\unitlength*\ratio{#1}{\@Za})/2}%
1762 \setlength{\@Zc}{\@Za-\@Zb}\AbsLen{\@Zc}%
1763 \ifdim\@Zc>\eps\setlength{\@Za}{\@Zb}\repeat\fi%
1764 \setlength{#2}{\@Za}}
1765 %%
1766 \def\Length(#1,#2)(#3,#4)#5{%
1767 \setlength{\@Zd}{#3\unitlength-#1\unitlength}%
1768 \setlength{\@Ze}{#4\unitlength-#2\unitlength}%
1769 \setcounter{@cntd}{1}%
1770 \setlength{\@Zf}{\@Zd}\ifdim\@Ze>\@Zd\setlength{\@Zf}{\@Ze}\fi
1771 \loop\setlength{\@Zd}{\@Zd/2}\setlength{\@Ze}{\@Ze/2}\setlength{\@Zf}{\@Zf/2}%
1772 \multiply\c@@cntd\tw@\ifdim\@Zf>\x@ pt\repeat
1773 \LenMult{\@Zd}{\@Zd}{\@Zg}\LenMult{\@Ze}{\@Ze}{\@Zh}\setlength{\@Zf}{\@Zg+\@Zh}%
1774 \LenSqrt{\@Zf}{\@Zg}\setlength{#5}{\@Zg*\value{@cntd}}}
1775 %%
1776 \def\LenNorm#1#2#3{%
1777 \setlength{\@Zd}{#1}\setlength{\@Ze}{#2}\setcounter{@cntd}{1}%
1778 \setlength{\@Zf}{\@Zd}\ifdim\@Ze>\@Zd\setlength{\@Zf}{\@Ze}\fi
1779 \loop\setlength{\@Zd}{\@Zd/2}\setlength{\@Ze}{\@Ze/2}\setlength{\@Zf}{\@Zf/2}%
1780 \multiply\c@@cntd\tw@\ifdim\@Zf>\x@ pt\repeat
1781 \LenMult{\@Zd}{\@Zd}{\@Zg}\LenMult{\@Ze}{\@Ze}{\@Zh}\setlength{\@Zf}{\@Zg+\@Zh}%
1782 \LenSqrt{\@Zf}{\@Zg}\setlength{#3}{\@Zg*\value{@cntd}}}
1783 %%
1784 \def\PathLengthQ[#1](#2,#3)(#4,#5)(#6,#7){%
1785 \PathLength\z@\c@@cntc#1\relax
1786 \ifnum \c@@cntc<\@ne \c@@cntc\pathmax\relax\fi
1787 \ifnum \c@@cntc>\pathmax \c@@cntc\pathmax\relax
1788 \PackageWarning{ebezier}{Counter reset to pathmax=\pathmax!}\fi
1789 \@Za\z@ \@Zb\z@ \c@@cntb\c@@cntc\relax \advance\c@@cntb\@ne
1790 \@Xb #4\unitlength \advance\@Xb-#2\unitlength \multiply\@Xb\tw@
1791 \@Yb #5\unitlength \advance\@Yb-#3\unitlength \multiply\@Yb\tw@
1792 \@Xa #6\unitlength \advance\@Xa-#2\unitlength
1793 \advance\@Xa-\@Xb \divide\@Xa\c@@cntc
1794 \@Ya #7\unitlength \advance\@Ya-#3\unitlength
1795 \advance\@Ya-\@Yb \divide\@Ya\c@@cntc \c@@cnta\@ne\relax
1796 \@whilenum{\c@@cnta<\c@@cntb}\do
1797 {\@X\c@@cnta\@Xa \advance\@X\@Xb \divide\@X\c@@cntc \multiply\@X\c@@cnta
1798 \@Y\c@@cnta\@Ya \advance\@Y\@Yb \divide\@Y\c@@cntc \multiply\@Y\c@@cnta
1799 \@Zi\@X\@Zj\@Y
1800 \advance\@X-\@Za \advance\@Y-\@Zb \LenNorm{\@X}{\@Y}{\@Z}%
1801 \advance\PathLength\@Z
1802 \@Za\@Zi\@Zb\@Zj \advance\c@@cnta\@ne}}
1803 %%
1804 \def\PathLengthC[#1](#2,#3)(#4,#5)(#6,#7)(#8,#9){%
1805 \PathLength\z@ \c@@cntc#1\relax
1806 \ifnum \c@@cntc<\@ne \c@@cntc\pathmax\relax\fi
1807 \ifnum \c@@cntc>\pathmax \c@@cntc\pathmax\relax
1808 \PackageWarning{ebezier}{Counter reset to pathmax=\pathmax!}\fi
1809 \@Za\z@ \@Zb\z@ \c@@cnta\c@@cntc\relax \advance\c@@cnta\@ne
1810 \@Xa #4\unitlength \advance\@Xa-#2\unitlength \multiply\@Xa\thr@@
1811 \@Xb #6\unitlength \advance\@Xb-#2\unitlength \multiply\@Xb\thr@@
1812 \advance\@Xb-2\@Xa
1813 \@Xc #8\unitlength \advance\@Xc-#2\unitlength
1814 \advance\@Xc-\@Xa \advance\@Xc-\@Xb
1815 \@Ya #5\unitlength \advance\@Ya-#3\unitlength \multiply\@Ya\thr@@
1816 \@Yb #7\unitlength \advance\@Yb-#3\unitlength \multiply\@Yb\thr@@
1817 \advance\@Yb-2\@Ya
1818 \@Yc #9\unitlength \advance\@Yc-#3\unitlength
1819 \advance\@Yc-\@Ya \advance\@Yc-\@Yb
1820 \divide\@Xc\c@@cntc \divide\@Yc\c@@cntc
1821 \c@@cntb\@ne\relax
1822 \@whilenum{\c@@cntb<\c@@cnta}\do
1823 {\@X\c@@cntb\@Xc \@Y\c@@cntb\@Yc \advance\@X\@Xb \advance\@Y\@Yb
1824 \divide\@X\c@@cntc \divide\@Y\c@@cntc
1825 \multiply\@X\c@@cntb \multiply\@Y\c@@cntb
1826 \advance\@X\@Xa \advance\@Y\@Ya
1827 \divide\@X\c@@cntc \divide\@Y\c@@cntc
1828 \multiply\@X\c@@cntb \multiply\@Y\c@@cntb
1829 \@Zi\@X\@Zj\@Y
1830 \advance\@X-\@Za \advance\@Y-\@Zb \LenNorm{\@X}{\@Y}{\@Z}%
1831 \advance\PathLength\@Z
1832 \@Za\@Zi\@Zb\@Zj\advance\c@@cntb\@ne}}
1833 %%
1834 % \end{macrocode}
1835 %
1836 % The most complex macro is explained in the text. The exception is
1837 % handled by the logical \verb+\if@ovf+.
1838 %
1839 % \begin{macrocode}
1840 \def\cArcs{\@ifnextchar [{\@cArcs}{\@cArcs[0]}}
1841 \def\@cArcs[#1](#2,#3)(#4,#5)(#6,#7){%
1842 \c@@cntc#1\relax
1843 \@ovffalse
1844 \@X#2\unitlength\@Y#3\unitlength
1845 \@Zi#6\unitlength\@Zj#7\unitlength
1846 \setlength{\@Xa}{\@X-\@Zi}\setlength{\@Ya}{\@Y-\@Zj}%
1847 \LenNorm{\@Xa}{\@Ya}{\@Xb}%
1848 \@Xa#4\unitlength \advance\@Xa\@Zi \advance\@Xa-2\@X
1849 \@Ya#5\unitlength \advance\@Ya\@Zj \advance\@Ya-2\@Y
1850 \@Xc\@Xa\AbsLen{\@Xc}\@Yc\@Ya\AbsLen{\@Yc}%
1851 \ifdim\@Xc<\eps\ifdim\@Yc<\eps\@ovftrue\fi\fi
1852 \if@ovf
1853 \cArc[#1](#2,#3)(#4,#5)%
1854 \else
1855 \LenNorm{\@Xa}{\@Ya}{\@Yb}%
1856 \setlength{\@Xc}{\unitlength*\ratio{\@Xb}{\@Yb}}%
1857 \setlength{\@Yc}{(-\unitlength+\@Xc*2)*4/3}%
1858 \@Xb-#5\unitlength \advance\@Xb\@Zj
1859 \@Z\@Xb\AbsLen{\@Z}%
1860 \ifdim\@Z<100\eps \@Xb#4\unitlength \advance\@Xb-\@Zi \@Xa\@Ya\fi
1861 \setlength{\@Z}{\@Yc*\ratio{\@Xa}{\@Xb}}%
1862 \@Xa#4\unitlength\@Ya#5\unitlength
1863 \setlength{\@Za}{\@Y-\@Ya}\setlength{\@Zb}{\@Xa-\@X}%
1864 \setlength{\@Zc}{\@Zj-\@Y}\setlength{\@Zd}{\@X-\@Zi}%
1865 \@Xb\@Xa \LenMult{\@Z}{\@Za}{\@Zh}\advance\@Xb\@Zh
1866 \@Yb\@Ya\LenMult{\@Z}{\@Zb}{\@Zh}\advance\@Yb\@Zh
1867 \@Xc\@Zi\LenMult{\@Z}{\@Zc}{\@Zh}\advance\@Xc\@Zh
1868 \@Yc\@Zj\LenMult{\@Z}{\@Zd}{\@Zh}\advance\@Yc\@Zh
1869 \@Z\@Xa\@Za\@Ya\@Zb\@Xb\@Zc\@Yb\@Zd\@Xc\@Ze\@Yc
1870 \l@cbezier[#1](\@Z,\@Za)(\@Zb,\@Zc)(\@Zd,\@Ze)(\@Zi,\@Zj)%
1871 \fi}
1872 %</package>
1873 % \end{macrocode}
1874 % \Finale \PrintIndex \PrintChanges
1875 \endinput