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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
%% $Id: pst-spirograph-doc.tex 75 2014-08-19 18:38:05Z herbert $
\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings
headexclude,footexclude,oneside]{pst-doc}
\usepackage[utf8]{inputenc}
\usepackage{pst-spirograph}
\let\pstFV\fileversion
\usepackage{animate}
\def\UrlFont{\small\ttfamily}
\makeatletter
\def\verbatim@font{\small\normalfont\ttfamily}
\makeatother
\hypersetup{pdfauthor={Manuel Luque, Herbert Voss},pdftitle={Spirograoh}}
%
\def\bgImage{\begin{pspicture}(-4,-4)(4,4)
\psSpirograph[thetamax=720,Z1=36,Z2=24,m=0.15,linewidth=0.025,ap=20,inner,
fillstyle=solid,polarangle=150,linecolor=blue,holenumber=0,opacity=0.4]
\end{pspicture}%
}
\lstset{basicstyle=\ttfamily\footnotesize}
\begin{document}
\author{Manuel Luque\\Herbert Vo\ss}
\docauthor{}
\date{\today}
\title{pst-spirograph \\\small v.\pstFV}
\subtitle{A PSTricks package for drawing spirograph curves}
\maketitle%
\tableofcontents
\begin{abstract}
\vfill\noindent
Thanks for feedback and contributions to:\\
Uwe Ziegenhagen;
\end{abstract}
\clearpage
\section{Introduction}
\LPack{pst-spirograph} is a package to simulate the operation of a spirograph. A spirograph
is a geometric drawing toy that produces mathematical roulette curves that are technically
known as hypotrochoids and epitrochoids.
The mathematician Bruno Abakanowicz invented the spirograph between 1881 and 1900.%
\footnote{\url{http://en.wikipedia.org/wiki/Spirograph}}
It was used to calculate an area delimited by curves.
A hypotrochoid is generated by a fixed point on a circle rolling inside a fixed circle.%
\footnote{\url{http://mathworld.wolfram.com/Spirograph.html}}
It consists of a small toothed wheel rotating inside or outside a ring gear.
The weighing tile wheel has nine drilled holes numbered from 0--8, through these small holes the tip of a
pen or pencil can be put. % weighing tile???
This causes the small wheel to rotate one or more laps around the crown and draws a hypocycloid.
The wheel can also turn off a first fixed gear, it is thus possible to draw epicycloids . The command is written as %% turn of???
\begin{BDef}
\Lcs{psSpirograph}\OptArgs\Largr{\CAny}
\end{BDef}
and can optionally be followed by the coordinates of the point where you wish to place the
Spirograph: \Lcs{psSpirograph}\OptArgs\Largr{x,y} which by default is centered at the origin.
The optional parameters, including default values are indicated as following:
\begin{compactenum}
\item \LKeyset{Z1=20}: number of teeth of the wheel 1, the crown;
\item \LKeyset{Z2=10}: number of teeth of the wheel 2;
\item \LKeyset{m=0.5}: module of the gear;
\item \LKeyset{ap=20}: pressure angle in degrees, it must be reduced if the number of teeth
crown is large (if the path of the teeth will be incorrect), e.g. take \verb|Z1=120|;
\item \LKeyset{holenumber=0} : active hole number;
\item \LKeyset{polarangle=<value>}: polar angle in degrees to position the center
of the small wheel, a useful parameter for animation.
\end{compactenum}
There are two Boolean values for the organisation of the two circles:
\begin{compactitem}
\item \Lkeyword{circles}: to draw circles of contact (default is \texttt{false}.
\item \Lkeyword{inner}: the gear rotates inside of the crown (\texttt{true} --- default) or outside (\texttt{false}).
\end{compactitem}
In the drawing, the color selection wheel and the line of the curve is made with
the following setting:
\begin{compactenum}
\item \LKeyset{color1=\{[rgb]\{0.625 0.75 1\}\}};
\item \LKeyset{color2=\{[rgb]\{0.75 1 0.75\}\}};
\item \Lkeyset{curvecolor=red};
\item \LKeyset{curvewidth=1pt}: linewidth of the hypocycloid;
\item \Lkeyset{circlescolor=red}.
\end{compactenum}
The origin of the spirograph can be set by the coordinates $(x,y)$. If the they are missing, $(0,0)$ is assumed.
By default, the wheels are not filled with color. The color inside the wheels must be
set by the option \Lkeyset{fillStyle=solid}.
The choice of color and line thickness contour of the wheels is made with
usual PSTricks options: \Lkeyword{linecolor} and \Lkeyword{linewidth}.
The transparency of the small wheel is adjusted with the \Lkeyword{opacity} option of PSTricks.
The last parameter is the angle \LKeyset{thetamax=360}, which represents the rotation in degrees
the center of the small wheel around the ring, so it is a parameter to adjust,
depending on the planned route of the hypocycloid.
%\clearpage
\section{Examples}
\begin{LTXexample}[pos=t]
\begin{pspicture}[showgrid=top](-7,-7)(7,7)
\psframe*[linecolor=yellow!30](-7,-7)(7,7)
\psSpirograph[thetamax=720,Z1=120,Z2=48,m=0.1,ap=10,linewidth=0.025,
fillstyle=solid,polarangle=200,holenumber=0,opacity=0.3]
\psSpirograph[thetamax=720,Z1=120,Z2=48,m=0.1,ap=10,linewidth=0.025,
fillstyle=solid,polarangle=340,holenumber=3,opacity=0.3,curvecolor=blue]
\psSpirograph[thetamax=720,Z1=120,Z2=48,m=0.1,ap=10,linewidth=0.025,
fillstyle=solid,polarangle=90,holenumber=6,opacity=0.3,curvecolor=green]
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[pos=t]
\begin{pspicture}[showgrid=top](-7,-7)(7,7)
\psframe*[linecolor=yellow!30](-7,-7)(7,7)
\psSpirograph[thetamax=720,Z1=120,Z2=48,m=0.1,ap=10,linewidth=0.025,
fillstyle=solid,polarangle=200,holenumber=3,opacity=0.75]
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[pos=t]
\begin{pspicture}[showgrid=top](-7,-7)(7,7)
\psframe*[linecolor=gray!20](-7,-7)(7,7)
\psSpirograph[thetamax=720,Z1=36,Z2=24,m=0.15,linewidth=0.025,ap=20,inner=false,
fillstyle=solid,polarangle=150,linecolor=blue,holenumber=0,opacity=0.8]
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[pos=t]
\begin{pspicture}[showgrid=top](-7,-7)(7,7)
\psframe*[linecolor=yellow!30](-7,-7)(7,7)
\psSpirograph[thetamax=1440,Z1=27,Z2=12,m=0.4,linewidth=0.025,
curvecolor={[rgb]{0 0.25 0.5}},circles,fillstyle=solid,polarangle=30,
linecolor=blue,holenumber=0,opacity=0.75]
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[pos=t]
\begin{pspicture}[showgrid=top](-7,-7)(7,7)
\psframe*[linecolor=yellow!30](-7,-7)(7,7)
\psset{unit=0.5}
\psSpirograph[thetamax=-1800,Z1=108,Z2=15,m=0.2,linewidth=0.025,ap=10,
fillstyle=solid,polarangle=54,linecolor=blue,holenumber=0,opacity=0.75]
\end{pspicture}
\end{LTXexample}
\begin{LTXexample}[pos=t]
\begin{pspicture}[showgrid=top](-7,-7)(7,7)
\psframe*[linecolor=gray!20](-7,-7)(7,7)
\psSpirograph[thetamax=1800,Z1=36,Z2=30,m=0.15,linewidth=0.025,ap=20,inner=false,
fillstyle=solid,polarangle=150,linecolor=blue,holenumber=4,opacity=0.8]
\end{pspicture}
\end{LTXexample}
\clearpage
\section{Animations}
With package \LPack{animate} one can easily create animations:
\begin{LTXexample}[pos=t]
\begin{animateinline}[
width=0.9\linewidth,
begin={\begin{pspicture}(-3.5,-3.5)(3.5,3.5)},
end={\end{pspicture}},
palindrome,controls,
% autoplay
]{5}
\multiframe{100}{rA=0.001+30.000}{%
\psSpirograph[thetamax=\rA,Z1=59,Z2=24,m=0.1,ap=10,curvewidth=1.5pt,
linewidth=0.025,fillstyle=solid,polarangle=\rA,holenumber=5,opacity=0.5](0,0)}
\end{animateinline}
\end{LTXexample}
There are some more examples in the documention directory of the package.
\clearpage
\section{List of all optional arguments for \texttt{pst-spirograph}}
\xkvview{family=pst-spirograph,columns={key,type,default}}
\bgroup
\nocite{*}
\raggedright
\bibliographystyle{plain}
\bibliography{\jobname}
\egroup
\printindex
\end{document}
|