summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lapdf/trochoid.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/lapdf/trochoid.tex')
-rw-r--r--macros/latex/contrib/lapdf/trochoid.tex78
1 files changed, 78 insertions, 0 deletions
diff --git a/macros/latex/contrib/lapdf/trochoid.tex b/macros/latex/contrib/lapdf/trochoid.tex
new file mode 100644
index 0000000000..2a2ed6d710
--- /dev/null
+++ b/macros/latex/contrib/lapdf/trochoid.tex
@@ -0,0 +1,78 @@
+\input preamble.tex
+
+\Defnum(\n,0)
+\Defdim(\m,-2.5)
+\newdimen\x
+\newdimen\y
+
+% ---------------------------------------------------------------------------
+% 1. Trochoids: In case of a=b the graph is a cycloid.
+% x(t)=a*t-b*sint
+% y(t)=a-b*cost
+% ---------------------------------------------------------------------------
+\def\Trochoid(#1,#2){
+\def\Tx(##1,##2){\Dset(##2,##1) ##2=#1##2 \Sin(##1,\y) \y=#2\y \Sub(##2,\y)}
+\def\Ty(##1,##2){\Dset(##2,#1) \Cos(##1,\y) \y=#2\y \Sub(##2,\y)}
+\Tplot(200)(-6.2832,6.2832)}
+
+% ---------------------------------------------------------------------------
+% 2. Epitrochoid:
+% x(t)=a*cos(t)-b*cos(a/2*t)
+% y(t)=a*sin(t)-b*sin(a/2*t)
+% ---------------------------------------------------------------------------
+\def\Epitrochoid(#1,#2){\Dset(\x,#1) \x=0.5\x
+ \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}
+ \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}
+ \Tplot(360)(0,12.5664)}
+
+% ---------------------------------------------------------------------------
+% 3. Hypotrochoid:
+% x(t)=a*cos(t)+b*cos(a/2*t)
+% y(t)=a*sin(t)-b*sin(a/2*t)
+% ---------------------------------------------------------------------------
+\def\Hypotrochoid(#1,#2){\Dset(\x,#1) \x=0.5\x
+ \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}
+ \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}
+ \Tplot(360)(0,12.5664)}
+
+% ---------------------------------------------------------------------------
+\begin{document}
+\unitlength1.25cm
+
+\begin{center}
+{\Huge \bf{I. Trochoids}}
+\bigskip
+
+\begin{lapdf}(14,7)(-7,-2)
+ \Lingrid(10)(0,2)(-7,7)(-2,4)
+ \Whiledim{\m<3}{\Stepcol(0,23,4) \Trochoid(1,\Np\m) \Stroke \Dadd(\m,0.5)}
+\end{lapdf}
+
+$x(t)=a \cdot t - b\sin(t)$ \qquad$y(t)=a-b\cos(t)$
+
+\newpage
+
+{\Huge\bf{II. Epitrochoids}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Polgrid(0,2)(7)
+ \Whilenum{\n<6}{\Stepcol(0,23,4) \Epitrochoid(8,\n) \Stroke \Add(\n,1)}
+\end{lapdf}
+
+$x(t)=a\cos(t)-b\cos(a/2 \cdot t)$ \qquad $y(t)=a\sin(t)-b\sin(a/2 \cdot t)$
+
+\newpage
+
+{\Huge\bf{III. Hypotrochoids}}
+\bigskip
+
+\begin{lapdf}(14,14)(-7,-7)
+ \Resetcol
+ \Polgrid(0,2)(7)
+ \Whilenum{\n<6}{\Stepcol(0,23,4) \Hypotrochoid(8,\n) \Stroke \Add(\n,1)}
+\end{lapdf}
+
+$x(t)=a\cos(t)+b\cos(a/2 \cdot t)$ \qquad $y(t)=a\sin(t)-b\sin(a/2 \cdot t)$
+\end{center}
+\end{document}