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
|
%%
%% Ein Beispiel der DANTE-Edition
%%
%% 7. Auflage
%%
%% Beispiel 05-05-2 auf Seite 81.
%%
%% Copyright (C) 2016 Herbert Voss
%%
%% It may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%%
%% See http://www.latex-project.org/lppl.txt for details.
%%
%%
%% ====
% Show page(s) 1
%%
%%
\documentclass[]{exaarticle}
\pagestyle{empty}
\setlength\textwidth{352.81416pt}
\setlength\parindent{0pt}
%StartShownPreambleCommands
\usepackage{pst-plot,pst-xkey,multido}
\makeatletter
\pst@addfams{demo}% add family demo to the list
\define@boolkey[psset]{demo}[Pst@]{showcircles}[true]{}% prefix is \Pst@
\define@boolkey[psset]{demo}[Pst@]{hypocycloid}[true]{}% " " "
\define@key[psset]{demo}{nAngle}{\pst@getint{#1}\psk@nAngle}
\define@key[psset]{demo}{dAngle}{\pst@getangle{#1}\psk@dAngle}
%
\psset[demo]{showcircles=false,nAngle=6,dAngle=60,hypocycloid=false}
\newpsstyle{cycloid}{linecolor=black,linewidth=0.2\pslinewidth}
%
\def\psCycloid{\pst@object{psCycloid}}
% A pstricks object reads a star and the optional arguments
% and then cintinues with <name>@i
% we use (#1), but will test, if we have another (#2,#3),
% otherwise we use the default (0,720)
\def\psCycloid@i(#1){%
\@ifnextchar({\psCycloid@ii(#1)}{\psCycloid@ii(#1)(0,360)}}
% (#1) : origin
% (#2,#3): start and end angle for the parametrix plot
% #4 : radius R of the big circle
% #5 : radius r of the small circle
% #6 : radius A of the rotatetd point
\def\psCycloid@ii(#1)(#2,#3)#4#5#6{%
\pst@killglue % no whitespace
\begingroup% % hold all local
\addbefore@par{plotpoints=500}% can be overwritten by a following user set
\use@par% % set the optional arguments
\pst@getlength{#4}\pst@tempB% get the radius in pt (screen coors)
\pst@getlength{#5}\pst@tempC% get the 2nd radius in pt
\pst@getlength{#6}\pst@tempD% get the distance for a in pt
\pstVerb{ % define it only once (in user coors!!!)
/R \pst@tempB \pst@number\psunit div def
/r \pst@tempC \pst@number\psunit div def
/A \pst@tempD \pst@number\psunit div def
/Rr R r \ifPst@hypocycloid sub \else add \fi def % R +- r
/RDivr R r div def % R/r
/RrDivr RDivr 1 \ifPst@hypocycloid sub \else add \fi def % (R+-r)/r
}%
\if@star\psset{fillstyle=eofill,fillcolor=\pslinecolor}\fi%
\parametricplot{#2}{#3}{%
Rr t cos mul t RrDivr mul cos A mul sub % x(t)
Rr t sin mul t RrDivr mul sin A mul
\ifPst@hypocycloid add \else sub \fi }% y(t)
\ifPst@showcircles%
\psset{style=cycloid}%
\pscircle(#1){#4}%
\multido{\rA=0.0+\psk@dAngle}{\psk@nAngle}{%
\rput(!#4 #5 \ifPst@hypocycloid sub \else add \fi dup
\rA\space cos mul exch \rA\space sin mul){% user coors!!
\pscircle{#5}\psline[linecolor=blue]{*-o}(!%
\rA\space RrDivr mul dup % the angle
cos A mul neg
exch sin A mul \ifPst@hypocycloid\else neg \fi)%
}}%
\psarc[arrowscale=2]{->}(#1){0.5cm}{0}{270}
\fi%
\endgroup% end of local macro
\ignorespacesafterend% no whitespace at the end
}
\makeatother
\def\oneShot#1{%
\begin{pspicture}(-3,-3)(3,3)
\psCycloid[linecolor=red,linewidth=1.5pt,showcircles,
dAngle=10,nAngle=1][#1](0,0){2}{0.5}{0.6}
\end{pspicture}}
%StopShownPreambleCommands
\begin{document}
\begin{pspicture}(-3,-3)(3,3)
\psCycloid[hypocycloid,linecolor=red,linewidth=1.5pt](0,0){2}{0.25}{0.6}
\end{pspicture}
%
\begin{pspicture}(-4,-3)(4,3)
\psCycloid[hypocycloid,linecolor=red,linewidth=1.5pt,showcircles,
dAngle=20,nAngle=18](0,0){2}{0.25}{0.6}
\end{pspicture}
\end{document}
|