Debian Codegraph @

texmf-dist/doc/latex/lapdf/qcircle.tex

raw
1 \input preamble.tex
2
3 \Defdim(\r,0)
4 \newdimen\rr \newdimen\rx \newdimen\ry \newdimen\rz
5 \newdimen\ax \newdimen\ay \newdimen\bx \newdimen\by
6 \newdimen\cx \newdimen\cy \newdimen\dx \newdimen\dy
7 \newdimen\ex \newdimen\ey \newdimen\fx \newdimen\fy
8
9 \def\Qcircle(#1)(#2,#3,#4){%
10 \Dset(\rr,#4)
11 \Dset(\rx,#4) \Mul(\rx,2)
12 \Dset(\ry,#4) \Mul(\ry,3)
13 \Dset(\rz,#4) \Mul(\rz,4)
14 \Dset(\ax,#2) \Dset(\ay,#3) \Add(\ay,\rr)
15 \Dset(\bx,#2) \Dset(\by,#3) \Add(\bx,\rz) \Add(\by,\rr)
16 \Dset(\cx,#2) \Dset(\cy,#3) \Add(\cx,\rx) \Sub(\cy,\ry)
17 \Dset(\dx,#2) \Dset(\dy,#3) \Sub(\dx,\rx) \Sub(\dy,\ry)
18 \Dset(\ex,#2) \Dset(\ey,#3) \Sub(\ex,\rz) \Add(\ey,\rr)
19 \Dset(\fx,#2) \Dset(\fy,#3) \Add(\fy,\rr)
20 \Rcurve(#1)(\Np\ax,\Np\ay,5)(\Np\bx,\Np\by,1)(\Np\cx,\Np\cy,1)
21 (\Np\dx,\Np\dy,1)(\Np\ex,\Np\ey,1)(\Np\fx,\Np\fy,5)}
22
23 \def\ba{\left(\begin{array}{c}} \def\ea{\end{array}\right)}
24
25 % ---------------------------------------------------------------------------
26 \begin{document}
27 \begin{center}
28 {\Huge\bf{Quintic Circles}}
29 \bigskip
30
31 \begin{lapdf}(16,16)(-8,-8)
32 \Whiledim{\r<8}{\Dadd(\r,0.5) \Nextcol(0,23) \Qcircle(128)(0,0,\Np\r)
33 \Stroke}
34 \end{lapdf}
35 \end{center}
36
37 You can draw a full circle with one rational quintic Bezier curve. This is
38 the lowest possible Bezier degree to do this. These are the control points
39 for a circle at $(x,y)$ with radius $r$ (the third components are the
40 weights):
41 \parskip0.1cm
42 \begin{center}
43 $P_0=\ba x \\y+r \\5 \ea$,
44 $P_1=\ba x+4r\\y+r \\1 \ea$,
45 $P_2=\ba x+2r\\y-3r\\1 \ea$,
46 $P_3=\ba x-2r\\y-3r\\1 \ea$,
47 $P_4=\ba x-4r\\y+r \\1 \ea$,
48 $P_5=\ba x \\y+r \\5 \ea$.
49 \end{center}
50 \end{document}