Debian Codegraph @

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

raw
1 \input preamble.tex
2
3 \Defnum(\n,0)
4 \Defdim(\m,-2.5)
5 \newdimen\x
6 \newdimen\y
7
8 % ---------------------------------------------------------------------------
9 % 1. Trochoids: In case of a=b the graph is a cycloid.
10 % x(t)=a*t-b*sint
11 % y(t)=a-b*cost
12 % ---------------------------------------------------------------------------
13 \def\Trochoid(#1,#2){
14 \def\Tx(##1,##2){\Dset(##2,##1) ##2=#1##2 \Sin(##1,\y) \y=#2\y \Sub(##2,\y)}
15 \def\Ty(##1,##2){\Dset(##2,#1) \Cos(##1,\y) \y=#2\y \Sub(##2,\y)}
16 \Tplot(200)(-6.2832,6.2832)}
17
18 % ---------------------------------------------------------------------------
19 % 2. Epitrochoid:
20 % x(t)=a*cos(t)-b*cos(a/2*t)
21 % y(t)=a*sin(t)-b*sin(a/2*t)
22 % ---------------------------------------------------------------------------
23 \def\Epitrochoid(#1,#2){\Dset(\x,#1) \x=0.5\x
24 \def\Tx(##1,##2){\Cos(##1,##2) ##2=#1##2 \y=##1\x \Cos(\Np\y,\y) \y=#2\y \Sub(##2,\y) ##2=0.5##2}
25 \def\Ty(##1,##2){\Sin(##1,##2) ##2=#1##2 \y=##1\x \Sin(\Np\y,\y) \y=#2\y \Sub(##2,\y) ##2=0.5##2}
26 \Tplot(360)(0,12.5664)}
27
28 % ---------------------------------------------------------------------------
29 % 3. Hypotrochoid:
30 % x(t)=a*cos(t)+b*cos(a/2*t)
31 % y(t)=a*sin(t)-b*sin(a/2*t)
32 % ---------------------------------------------------------------------------
33 \def\Hypotrochoid(#1,#2){\Dset(\x,#1) \x=0.5\x
34 \def\Tx(##1,##2){\Cos(##1,##2) ##2=#1##2 \y=##1\x \Cos(\Np\y,\y) \y=#2\y \Add(##2,\y) ##2=0.5##2}
35 \def\Ty(##1,##2){\Sin(##1,##2) ##2=#1##2 \y=##1\x \Sin(\Np\y,\y) \y=#2\y \Sub(##2,\y) ##2=0.5##2}
36 \Tplot(360)(0,12.5664)}
37
38 % ---------------------------------------------------------------------------
39 \begin{document}
40 \unitlength1.25cm
41
42 \begin{center}
43 {\Huge \bf{I. Trochoids}}
44 \bigskip
45
46 \begin{lapdf}(14,7)(-7,-2)
47 \Lingrid(10)(0,2)(-7,7)(-2,4)
48 \Whiledim{\m<3}{\Stepcol(0,23,4) \Trochoid(1,\Np\m) \Stroke \Dadd(\m,0.5)}
49 \end{lapdf}
50
51 $x(t)=a \cdot t - b\sin(t)$ \qquad$y(t)=a-b\cos(t)$
52
53 \newpage
54
55 {\Huge\bf{II. Epitrochoids}}
56 \bigskip
57
58 \begin{lapdf}(14,14)(-7,-7)
59 \Polgrid(0,2)(7)
60 \Whilenum{\n<6}{\Stepcol(0,23,4) \Epitrochoid(8,\n) \Stroke \Add(\n,1)}
61 \end{lapdf}
62
63 $x(t)=a\cos(t)-b\cos(a/2 \cdot t)$ \qquad $y(t)=a\sin(t)-b\sin(a/2 \cdot t)$
64
65 \newpage
66
67 {\Huge\bf{III. Hypotrochoids}}
68 \bigskip
69
70 \begin{lapdf}(14,14)(-7,-7)
71 \Resetcol
72 \Polgrid(0,2)(7)
73 \Whilenum{\n<6}{\Stepcol(0,23,4) \Hypotrochoid(8,\n) \Stroke \Add(\n,1)}
74 \end{lapdf}
75
76 $x(t)=a\cos(t)+b\cos(a/2 \cdot t)$ \qquad $y(t)=a\sin(t)-b\sin(a/2 \cdot t)$
77 \end{center}
78 \end{document}