summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lapdf/qcircle.tex
blob: feea113e0a26f3b800866d13d575cb13ca1af20d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
\input preamble.tex

\Defdim(\r,0)
\newdimen\rr \newdimen\rx \newdimen\ry \newdimen\rz
\newdimen\ax \newdimen\ay \newdimen\bx \newdimen\by
\newdimen\cx \newdimen\cy \newdimen\dx \newdimen\dy
\newdimen\ex \newdimen\ey \newdimen\fx \newdimen\fy

\def\Qcircle(#1)(#2,#3,#4){%
 \Dset(\rr,#4)
 \Dset(\rx,#4) \Mul(\rx,2)
 \Dset(\ry,#4) \Mul(\ry,3)
 \Dset(\rz,#4) \Mul(\rz,4)
 \Dset(\ax,#2) \Dset(\ay,#3) \Add(\ay,\rr)
 \Dset(\bx,#2) \Dset(\by,#3) \Add(\bx,\rz) \Add(\by,\rr)
 \Dset(\cx,#2) \Dset(\cy,#3) \Add(\cx,\rx) \Sub(\cy,\ry)
 \Dset(\dx,#2) \Dset(\dy,#3) \Sub(\dx,\rx) \Sub(\dy,\ry)
 \Dset(\ex,#2) \Dset(\ey,#3) \Sub(\ex,\rz) \Add(\ey,\rr)
 \Dset(\fx,#2) \Dset(\fy,#3) \Add(\fy,\rr)
 \Rcurve(#1)(\Np\ax,\Np\ay,5)(\Np\bx,\Np\by,1)(\Np\cx,\Np\cy,1)
            (\Np\dx,\Np\dy,1)(\Np\ex,\Np\ey,1)(\Np\fx,\Np\fy,5)}

\def\ba{\left(\begin{array}{c}} \def\ea{\end{array}\right)}

% ---------------------------------------------------------------------------
\begin{document}
\begin{center}
{\Huge\bf{Quintic Circles}}
\bigskip

\begin{lapdf}(16,16)(-8,-8)
 \Whiledim{\r<8}{\Dadd(\r,0.5) \Nextcol(0,23) \Qcircle(128)(0,0,\Np\r)
  \Stroke}
\end{lapdf}
\end{center}

You can draw a full circle with one rational quintic Bezier curve. This is
the lowest possible Bezier degree to do this. These are the control points
for a circle at $(x,y)$ with radius $r$ (the third components are the
weights):
\parskip0.1cm
\begin{center}
$P_0=\ba x   \\y+r \\5 \ea$,
$P_1=\ba x+4r\\y+r \\1 \ea$,
$P_2=\ba x+2r\\y-3r\\1 \ea$,
$P_3=\ba x-2r\\y-3r\\1 \ea$,
$P_4=\ba x-4r\\y+r \\1 \ea$,
$P_5=\ba x   \\y+r \\5 \ea$.
\end{center}
\end{document}