\ifx\PSTPlotLoaded\endinput\else\input pst-plot.tex\fi
\ifx\PSTNodeLoaded\endinput\else\input pst-node.tex\fi
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey.tex\fi
%
\def\fileversion{0.2}
\def\filedate{07/08/20}
%
%% COPYRIGHT 2007 by Manuel Luque
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt.
%
\message{`PST-thick' v\fileversion, \filedate\space (ML)}
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax

\definecolor{darkgreen}{cmyk}{1,0,1,0.5}
\newpsstyle{thickline}{fillstyle=solid,fillcolor=red!25,linecolor=red,plotpoints=360}
\newpsstyle{onlythecurvered}{linecolor=red,plotpoints=360}
\newpsstyle{onlythecurveblue}{linecolor=blue,plotpoints=360}
\newpsstyle{thicklineblue}{fillstyle=solid,fillcolor=blue!25,linecolor=blue,plotpoints=360}
\newpsstyle{rainbow}{fillstyle=ccslopes,linecolor=red,plotpoints=360}
\newpsstyle{solide}{fillstyle=solid,fillcolor=black,plotpoints=360}
\newpsstyle{serpent}{fillstyle=gradient,gradbegin=darkgreen,gradend=yellow,gradmidpoint=0,linecolor=green,gradangle=90,plotpoints=360}
\newpsstyle{default}{}% lignes noires, rien à l'intérieur

\pst@addfams{pst-thick}
\define@key[psset]{pst-thick}{E}{% épaisseur du trait
\edef\psk@thick@E{#1}}
\define@key[psset]{pst-thick}{K}{% K=0 => angle de rotation/normale à la courbe
\edef\psk@thick@K{#1}}
\define@key[psset]{pst-thick}{stylethick}{% style
\edef\psk@thick@stylethick{#1}}
\define@key[psset]{pst-thick}{stylecurve1}{% style
\edef\psk@thick@stylecurveA{#1}}
\define@key[psset]{pst-thick}{stylecurve2}{% style
\edef\psk@thick@stylecurveB{#1}}
\psset[pst-thick]{E=1,K=0,stylethick=thickline,stylecurve1=onlythecurvered,stylecurve2=onlythecurvered}

\newif\ifPst@ONLY
\define@key[psset]{pst-thick}{curveonly}[true]{\@nameuse{Pst@ONLY#1}}
\psset[pst-thick]{curveonly=false}

\SpecialCoor

\def\CalculsCurves{%
    /ds dx dup mul dy dup mul add sqrt def
    /dx dx ds div def
    /dy dy ds div def
    /dx' K cos dx mul K sin dy mul sub def
    /dy' K sin dx mul K cos dy mul add def
    /nx E 2 div dy' mul neg def % normale x
    /ny E 2 div dx' mul def % normale y
    /x1 x0 nx add def
    /y1 y0 ny add def
      x1 y1 }

%% Commande \psthick
\def\psthick{\@ifnextchar[{\pst@psthick}{\pst@psthick[]}}%
\def\pst@psthick[#1]#2#3#4{{%
\psset{#1}%
\ifPst@ONLY
  \parametricplot[style=\psk@thick@stylecurveA]{#2}{#3}{%
    /E \psk@thick@E\space def
    /K \psk@thick@K\space def
    #4
   \CalculsCurves
    }%
    \parametricplot[style=\psk@thick@stylecurveB]{#3}{#2}{%
    /E \psk@thick@E\space def
    /K \psk@thick@K\space def
    #4
    /ds dx dup mul dy dup mul add sqrt def
    /dx dx ds div def
    /dy dy ds div def
    /dx' K cos dx mul K sin dy mul sub def
    /dy' K sin dx mul K cos dy mul add def
    /nx E 2 div dy' mul neg def % normale x
    /ny E 2 div dx' mul def % normale y
    /x1 x0 nx add def
    /y1 y0 ny add def
      x1 y1
    }%
  \else
\pscustom[style=\psk@thick@stylethick]{%
  \parametricplot{#2}{#3}{%
    /E \psk@thick@E\space def
    /K \psk@thick@K\space def
    #4
    \CalculsCurves
    }%
    \parametricplot{#3}{#2}{%
    #4
    \CalculsCurves
    }%
\closepath
   }%
 \fi}\ignorespaces}

\def\fonctionSinus#1#2{%
    /P #1 def % période (10 unités)
    /A #2 def % amplitude
    /O 360 P div def % pulsation 2*pi/P
    /x0 t def
    /y0 t O mul sin A mul def % A*sin(O*t)
    /dx dt def
    /dy t dt add O mul sin
        t O mul sin
        sub
        A mul def }

\catcode`\@=\PstAtCode\relax
\endinput
