diff options
author | Karl Berry <karl@freefriends.org> | 2020-03-12 20:25:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-03-12 20:25:17 +0000 |
commit | 6b1bdd702a6038b08d5165743cd556cccba34777 (patch) | |
tree | 2e247aa68e5299641e6528085c9a1520da0fe30b /Master/texmf-dist/tex/generic | |
parent | e80aa3da60a566208de46fe70a6c8800ab0af7fc (diff) |
pst-spirograph (12mar20)
git-svn-id: svn://tug.org/texlive/trunk@54257 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-spirograph/pst-spirograph.tex | 133 |
1 files changed, 117 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-spirograph/pst-spirograph.tex b/Master/texmf-dist/tex/generic/pst-spirograph/pst-spirograph.tex index c015ca5bca2..02cfbcd4cfc 100644 --- a/Master/texmf-dist/tex/generic/pst-spirograph/pst-spirograph.tex +++ b/Master/texmf-dist/tex/generic/pst-spirograph/pst-spirograph.tex @@ -6,7 +6,7 @@ %% %% Package `pst-spirograph.tex' %% -%% COPYRIGHT 2015 by +%% COPYRIGHT 2020- by %% Manuel Luque <manuel.luque27@gmail.com> %% Herbert Voss <hvoss@tug.org> %% @@ -23,8 +23,8 @@ % Requires some packages \ifx\PSTricksLoaded\endinput\else \input pstricks \fi \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi -\def\fileversion{0.41} -\def\filedate{2014/08/23} +\def\fileversion{0.50} +\def\filedate{2020/03/11} \message{`PSTSPIROGRAPH' v\fileversion, \filedate\ (ml,hv)} \edef\PstAtCode{\the\catcode`\@} @@ -64,11 +64,23 @@ %% === pour dessiner cercle de base et cercle primitif \define@boolkey[psset]{pst-spirograph}[Pst@spirograph@]{circles}[true]{} \psset[pst-spirograph]{circles=false} -% + + +%% hole position +\define@key[psset]{pst-spirograph}{HolePos}{\def\psk@HolePos{#1 }} +\psset[pst-spirograph]{HolePos=1.5} % 1<HolePos<2 + +\define@boolkey[psset]{pst-spirograph}[Pst@spirograph@]{gearwheels}[true]{} +\psset[pst-spirograph]{gearwheels} + +\define@boolkey[psset]{pst-spirograph}[Pst@spirograph@]{TypeA}[true]{} +\psset[pst-spirograph]{TypeA} + + \def\psSpirograph{\def\pst@par{}\pst@object{psSpirograph}} \def\psSpirograph@i{\@ifnextchar({\psSpirograph@ii}{\psSpirograph@ii(0,0)}} \def\psSpirograph@ii(#1){% - \begin@SpecialObj + \begin@ClosedObj \pst@@getcoor{#1}% \addto@pscode{ tx@spirographDict begin @@ -82,18 +94,24 @@ /ap \psk@ap def /polarAngle \psk@polarangle def /setlinedash { [ \psk@dash\space ] 0 setdash } def - /ni \psk@holenumber def % numero du trou - ni 8 gt {/ni 8 def} if + /ni \psk@holenumber def ni 8 gt { /ni 8 def } if /thetamax \psk@thetamax def % /ifinner \ifPst@spirograph@inner true \else false \fi def /ifcircles \ifPst@spirograph@circles true \else false \fi def - /iffill \ifx\psk@fillstyle\relax false \else true \fi def - /Fill { \tx@setTransparency fill } def -% - /ki 1 ni 9 div sub def - /r2 m1 Z2 mul 2 div def - /qi Z1 Z2 div 1 sub def + /iffill \ifx\psk@fillstyle\psfs@none false \else true \fi def + /Fill { \tx@setTransparency fill stroke } def + % on teste si le nombre de dents est pair + Z1 2 mod 1 eq { /Z1 Z1 1 sub def } if + Z2 2 mod 1 eq { /Z2 Z2 1 sub def } if + /HolePos \psk@HolePos def + HolePos 0 lt HolePos 2 ge or { /HolePos 1.5 def } if + /Fill { \psk@opacityalpha .setopacityalpha fill } def + /R1 Z1 m1 mul 2 div def + /R2 Z2 m1 mul 2 div def + /ki 1 ni 9 div sub def + /r2 m1 Z2 mul 2 div def + /qi Z1 Z2 div 1 sub def /qi2 Z1 Z2 div 1 add def thetamax 0 le {/pas -1 def}{/pas 1 def} ifelse % tableau des points de l'hypocycloide @@ -108,13 +126,96 @@ /curvecolor {\pst@usecolor\pscolord } def /linecolor {\pst@usecolor\pslinecolor} def /fillopacity \psk@opacityalpha def + /GetCurveWidth { \pst@number\pscurvewidth } def /SetCurveWidth { \pst@number\pscurvewidth SLW } def % - Roue1 - Roue2 + \ifPst@spirograph@TypeA + Roue1 + Roue2 + \else + %%%% definition de la roue dentee %%%%%% + thetamax 0 le { /pas -1 def }{ /pas 1 def } ifelse + /tabSpirograph [ 0 pas thetamax {/i_ exch def [ i_ coorPen3 ] } for ] def + %%% Les dessins de l'engrenage %%%%%% + %%%%%%%%%% Roue N°2 %%%%%%%%%%% + %%%%%%%%%% roue fixe %%%%%%%%%% + \ifPst@spirograph@gearwheels + /wheel 2 def + gsave + m2 Z2 Datas1 + Calculs + Beta_ rotate + Roue3 + closepath +% \ifx\psk@fillstyle\empty\else color2 Fill \fi + iffill { color2 Fill } if + Roue3 + closepath + linecolor + stroke + grestore + gsave + %% la vis de fixation de la roue sur la feuille + 0 0 0.5 cm 0 360 arc + 0.8 0.8 0 setrgbcolor + fill + 0 setgray + 0 0 0.5 cm 0 360 arc + stroke + 1 setlinewidth + -0.5 cm 0 moveto 0.5 cm 0 lineto + 0 -0.5 cm moveto 0 0.5 cm lineto + stroke + grestore + \ifPst@spirograph@circles Circles \fi + \fi + gsave + tabSpirograph 0 get aload pop moveto + 1 1 tabSpirograph length 1 sub {/nP exch def tabSpirograph nP get aload pop lineto } for + curvecolor + \pst@number\pscurvewidth SLW + stroke + grestore + %%%%%%%%%% Roue N°1 %%%%%%%%%%%%%%%%% + %%%%%%%%%% roue tournante %%%%%%%%%% + \ifPst@spirograph@gearwheels + /wheel 1 def + gsave + m2 Z2 Datas1 + Calculs + /a@ex m2 Z1 Z2 add mul 2 div cm def % entraxe engrenage exterieur + /a@in m2 Z1 Z2 sub mul 2 div cm def % entraxe engrenage interieur + a@in polarAngle cos mul a@in polarAngle sin mul translate + polarAngle Z1 Z2 sub Z1 div mul rotate + m1 Z1 + Datas2 + Calculs + Beta_ rotate + Roue3 + COURONNE + closepath + iffill { color1 Fill } if +% \ifx\psk@fillstyle\@empty\else color1 Fill \fi + Roue3 + closepath + linecolor + stroke + COURONNE + closepath + linecolor + stroke + Roue3 + closepath + linecolor + stroke + plaquette + \ifPst@spirograph@circles Circles \fi + grestore + \fi + \fi end }% - \end@SpecialObj + \end@ClosedObj \ignorespaces} % \catcode`\@=\PstAtCode\relax |