samedi 12 mars 2016

Dessiner des guillochis entre 2 cercles non concentriques avec PSTricks : version colorée 2

Le listing, à compiler avec la séquence : LaTeX->dvips->ps2pdf

\documentclass{article}
\usepackage[paperwidth=8cm,paperheight=8cm,hmargin={0cm,0cm},vmargin={0cm,0cm},dvips]{geometry}
\usepackage{pst-plot}
\psset{dimen=middle}
\pagestyle{empty}
\author{Manuel Luque}
\date{10 mars 2016}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Essai de Manuel Luque 19 février 2003
% transformé par Denis Girou le 25 février 2003
% révision le 14 septembre 2011
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\pst@addfams{pst-plothsb}

\define@key[psset]{pst-plothsb}{HueBegin}{% Between 0 and 1
\edef\PstParametricplotHSB@HueBegin{#1}}

\define@key[psset]{pst-plothsb}{HueEnd}{% Between 0 and 1
\edef\PstParametricplotHSB@HueEnd{#1}}

\newif\ifPst@HSB
\define@key[psset]{pst-plothsb}{HSB}[true]{\@nameuse{Pst@HSB#1}}

% Default values
\psset{HueBegin=0,HueEnd=1,HSB=true}

\def\parametricplotHSB{\pst@object{parametricplotHSB}}
\def\parametricplotHSB@i{\@ifnextchar[{\parametricplotHSB@do}{\parametricplotHSB@do[]}}
\def\parametricplotHSB@do[#1]#2#3#4{{%
\psset{#1}%
\begin@ClosedObj
\addto@pscode{%
/t  #2 def
/dt #3 t sub \psk@plotpoints\space div def
/t t dt sub def
/Counter 0 def
\psk@plotpoints {
  /t t dt add def
  /Counter Counter 1 add def
/F@pstplot \ifPst@algebraic (#4)
                    tx@AlgToPs begin AlgToPs end cvx
                 \else { #4 }
          \fi
   def
\ifPst@algebraic
   F@pstplot
    \else  #4
\fi
  \pst@number\psyunit mul exch
  \pst@number\psxunit mul exch
  1 Counter eq
    {moveto}                    % First point
    {\ifPst@HSB                 % Other points than the first one
       /PointY exch def
       /PointX exch def
       Counter \psk@plotpoints\space div
           \PstParametricplotHSB@HueEnd\space
             \PstParametricplotHSB@HueBegin\space sub mul
           \PstParametricplotHSB@HueBegin\space add
         1 1 sethsbcolor
       PointX PointY lineto
       stroke
       PointX PointY moveto
     \else
       lineto
     \fi} ifelse
    } repeat}% fin du code ps
\end@ClosedObj}} % fin de la commande PSTricks

\makeatother
\begin{document}
\begin{center}
\multido{\i=0+2}{180}{%
\begin{pspicture}(-4,-4)(4,4)
\pstVerb{/R1 3 def /R2 1 def /p1 17 def /q1 5 def /2pi 6.283185 def /theta \i\space def
         /ry theta sin 1.5 mul def /rx theta cos 1.5 mul def
         }%
%\pscircle{!R1}
\psframe*(-4,-4)(4,4)
\parametricplot[plotpoints=1040,linecolor=yellow!10,linewidth=0.25,algebraic]{0}{2pi q1 mul 0.1 add}{(R1*cos(t)+(R2*cos(t)+rx))/2+(R1*cos(t)-(R2*cos(t)+rx))/2*cos(p1*t/q1)| % x
                                                                          (R1*sin(t)+(R2*sin(t)+ry))/2+(R1*sin(t)-(R2*sin(t)+ry))/2*cos(p1*t/q1) % y
                          }
\parametricplotHSB[plotpoints=3600,algebraic,linewidth=2\pslinewidth,plotstyle=curve]{0}{2pi q1 mul 0.1 add}{(R1*cos(t)+(R2*cos(t)+rx))/2+(R1*cos(t)-(R2*cos(t)+rx))/2*cos(p1*t/q1)| % x
                                                                          (R1*sin(t)+(R2*sin(t)+ry))/2+(R1*sin(t)-(R2*sin(t)+ry))/2*cos(p1*t/q1) % y
                          }
%\pscircle(\r,0){!R2}
\end{pspicture}\newpage}
\end{center}
\end{document} 


Aucun commentaire:

Enregistrer un commentaire