Retour

sinus.tex

Télécharger le fichier Fichier PDF
Image PNG
\documentclass{article}
\usepackage{pst-anamorphosis-add,pst-plot}
\usepackage[a4paper]{geometry}
\makeatletter
\def\psparametricplotA{\pst@object{parametricplotA}}% 	hv 2008-11-22
\def\parametricplotA{\pst@object{parametricplotA}}
\def\parametricplotA@i#1#2{\@ifnextchar[{\parametricplotA@x{#1}{#2}}{\parametricplotA@x{#1}{#2}[]}}
\def\parametricplotA@x#1#2[#3]{\@ifnextchar[{\parametricplotA@xi{#1}{#2}[#3]}{\parametricplotA@xi{#1}{#2}[#3][]}}
\def\parametricplotA@xi#1#2[#3][#4]#5{%
  \pst@killglue%
  \begingroup%
    \use@par%
    \@nameuse{beginplot@\psplotstyle}%
    \addto@pscode{%
    \tx@optionsanamorphosis
    \tx@optionsanamorphosisAdd
      #3 %prefix PS code
      \psplot@init
      /t #1 def
      /t1 #2 def
      /dt t1 t sub \psk@plotpoints div def
      /F@pstplot \ifPst@algebraic (#5)
                    \ifx\psk@PlotDerivative\@none\else
                      \psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat
                    \fi\space
                    tx@AlgToPs begin AlgToPs end cvx
                 \else { #5 } \fi  def
      \ifPst@VarStep
         /StillZero 0 def /LastNonZeroStep dt def
         /F2@pstplot tx@Derive begin (#5) (t) Derive (t) Derive end
                     \ifx\psk@PlotDerivative\@none\else
                       \psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat
                     \fi\space
                    tx@AlgToPs begin AlgToPs end cvx def
         %% computation of the tolerance defined by plotpoints
         /epsilon12 \ifx\psk@VarStepEpsilon\@default
                       tx@Derive begin F2@pstplot end Pyth
                       dt 3 exp abs mul
                    \else\psk@VarStepEpsilon\space 12 mul \fi def
         /ComputeStep {
           dup 1e-4 lt
           { pop StillZero 2 ge { LastNonZeroStep 2 mul } { LastNonZeroStep } ifelse /StillZero StillZero 1 add def }
           { epsilon12 exch div 1 3 div exp /StillZero 0 def }
           ifelse } bind def
      \fi
      /xy {
        \ifPst@algebraic F@pstplot \else #5 \fi
        \pst@number\psyunit mul exch
        \pst@number\psxunit mul exch
        tx@anamorphosisPathDict begin Anamorphose end
      } def
      }%
    \gdef\psplot@init{}%
    \@pstfalse
    \@nameuse{testqp@\psplotstyle}%
    \if@pst\parametricplotA@ii{#4}\else\parametricplotA@iii{#4}\fi
  \endgroup%
  \ignorespaces}
%
\def\parametricplotA@ii#1{% para is the post code
  \ifPst@VarStep%
    \addto@pscode{%
      mark xy \@nameuse{beginqp@\psplotstyle}
      { F2@pstplot Pyth ComputeStep
        t 2 copy add dup t1 gt {pop t1} if /t exch def F2@pstplot Pyth ComputeStep
        /t 3 -1 roll def 2 copy gt { exch } if pop
        /t t 3 -1 roll add dup t1 gt {pop t1} if def
        xy \@nameuse{doqp@\psplotstyle}
        t t1 eq { exit } if } loop}%
  \else\pst@killglue%
    \addto@pscode{%
      /ps@Exit false def
      xy \@nameuse{beginqp@\psplotstyle}
      \psk@plotpoints 1 sub {
        /t t dt add def
        xy \@nameuse{doqp@\psplotstyle}
        ps@Exit { exit } if
      } repeat
      ps@Exit not {
        /t t1 def
        xy \@nameuse{doqp@\psplotstyle}
      } if
    }%
  \fi%
  \addto@pscode{ #1 }%
  \@nameuse{endqp@\psplotstyle}}
%
\def\parametricplotA@iii#1{%
  \ifPst@VarStep%
    \addto@pscode{%
      /n 2 def
      mark
      { xy n 2 roll F2@pstplot Pyth
        ComputeStep t 2 copy add dup t1 gt {pop t1} if
        /t exch def F2@pstplot Pyth ComputeStep
        /t 3 -1 roll def 2 copy gt { exch } if pop
        /t t 3 -1 roll dup /LastNonZeroStep exch def add dup t1 gt {pop t1} if def /n n 2 add def
        t t1 eq { exit } if } loop
      xy n 2 roll}%
  \else\pst@killglue%
    \addto@pscode{
      mark
      /n 2 def
      \psk@plotpoints {
        xy
        n 2 roll
        /n n 2 add def
        /t t dt add def
      } repeat
      /t t1 def
      xy
      n 2 roll}%
  \fi%
  \addto@pscode{ #1 }%
  \@nameuse{endplot@\psplotstyle}}
%
\makeatother
\pagestyle{empty}
\begin{document}
 
\begin{center}
\begin{pspicture}(-6,-6)(6,6)
\pscircle[doubleline=true]{3}
\psset{type=conical}
\pscircle[linecolor=blue](0,0){1}
\pscircleA[linecolor=blue](0,0){1}
\pscircle[linecolor=blue](0,0){2}
\pscircleA[linecolor=blue](0,0){2}
\parametricplotA[plotpoints=3600,linecolor=red,linewidth=1mm]{0}{360}{%
  /Radius 1.5 0.5 t 8 mul sin mul add def
  Radius t cos mul
  Radius t sin mul
    }
\parametricplot[plotpoints=3600,linecolor=red,linewidth=1mm]{0}{360}{%
  /Radius 1.5 0.5 t 8 mul sin mul add def
  Radius t cos mul
  Radius t sin mul
    }
\multido{\n=0.5+0.5,\N=0.5+0.5}{4}{%
    \pnode(! \n\space -2){A}
    \pnode(! \n\space 2){B}
    \psline(A)(B)
    \pslineA(A)(B)
    \pnode(!-2 \N){A}
    \pnode(!2 \N){B}
    \pslineA(A)(B)
    \psline(A)(B)
    }
\multido{\n=-2.0+0.5,\N=-2.0+0.5}{4}{%
    \pnode(! \n\space -2){A}
    \pnode(! \n\space 2){B}
    \psline(A)(B)
    \pslineA(A)(B)
    \pnode(!-2 \N){A}
    \pnode(!2 \N){B}
    \pslineA(A)(B)
    \psline(A)(B)
    }
\psline(-2,0)(2,0)
\psline(0,-2)(0,2)
\pslineA(0,-2)(0,-0.5)
\pslineA(0,2)(0,0.5)
\pslineA(-2,0)(-0.5,0)
\pslineA(2,0)(0.5,0)
\psdot[dotstyle=x,dotsize=.2](0,0)
\end{pspicture}
\end{center}
 
\end{document}