| 1 |
%% $Id: pst-thick-doc.tex 170 2009-12-08 21:30:53Z herbert $ |
| 2 |
\documentclass[11pt,english,french,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings |
| 3 |
headexclude,footexclude,oneside]{pst-doc} |
| 4 |
\usepackage[utf8]{inputenc} |
| 5 |
\usepackage{pst-thick} |
| 6 |
\let\pstFV\fileversion |
| 7 |
\usepackage{pst-slpe,pst-grad,pst-text} |
| 8 |
% |
| 9 |
\def\bgImage{{%\psset{unit=0.5} |
| 10 |
\begin{pspicture}(0,-0.5)(20,1.5) |
| 11 |
\psthick[E=1.2,stylethick=rainbow]{1}{19}{\fonctionSinus{10}{1}}% |
| 12 |
\rput(0,0){\pstextpath[c]{\parametricplot[linestyle=none]{1}{19}{% |
| 13 |
/P 10 def % periode (10 unites) |
| 14 |
/A 1 def % amplitude |
| 15 |
/O 360 P div def |
| 16 |
t O t mul sin A mul |
| 17 |
}}{\Huge\texttt{\textbf{ PStricks}}: a long long winding road :-)}} |
| 18 |
\end{pspicture}}} |
| 19 |
|
| 20 |
\lstset{explpreset={pos=t,width=-99pt,overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe={}},style=code} |
| 21 |
\begin{document} |
| 22 |
|
| 23 |
\title{\texttt{pst-thick}} |
| 24 |
\subtitle{A PSTricks package for drawing very thick lines and curves; v.\pstFV} |
| 25 |
\author{Manuel Luque \\Herbert Vo\ss} |
| 26 |
%\docauthor{Herbert Vo\ss} |
| 27 |
\date{\today} |
| 28 |
\maketitle |
| 29 |
|
| 30 |
\clearpage |
| 31 |
|
| 32 |
\begin{abstract} |
| 33 |
Le tracé d'une ligne avec \texttt{PStricks} comporte de très nombreuses options qui doivent satisfaire la majorité des |
| 34 |
utilisateurs. Vous ne trouverez donc pas ici un catalogue de toutes les options possibles, telles que : |
| 35 |
\begin{compactitem} |
| 36 |
\item \Lkeyword{doublecolor}\texttt{=red!25} |
| 37 |
\item \Lkeyword{doublesep}=2 |
| 38 |
\item \Lkeyword{linecolor}\texttt{=red} |
| 39 |
\item \Lkeyword{linewidth}\texttt{=0.1} |
| 40 |
\item etc. |
| 41 |
\end{compactitem} |
| 42 |
Les documentations sur ces options sont très nombreuses, par exemple en français : |
| 43 |
\begin{compactitem} |
| 44 |
\item \url{http://www-igm.univ-mlv.fr/~daaboul/PSTricks/Cours7_PSTricks.ps} |
| 45 |
\item \url{http://www-igm.univ-mlv.fr/~daaboul/PSTricks/Cours8_PSTricks.ps} |
| 46 |
\item \url{http://www.gutenberg.eu.org/pub/GUTenberg/publicationsPDF/16-girou.pdf} |
| 47 |
\item \url{http://documents.epfl.ch/users/d/da/danalet/www/MiniProjet/PSTricks.pdf} |
| 48 |
\end{compactitem} |
| 49 |
Il s'agit plutôt, ici, de regarder ce qui se passe à l'intérieur et aux bords d'une ligne, en créant une commande permettant d'obtenir |
| 50 |
le \textit{chemin} d'une ligne, pour diverses applications qui n'ont peut-être aucune utilité pratique\ldots |
| 51 |
\end{abstract} |
| 52 |
|
| 53 |
\tableofcontents |
| 54 |
|
| 55 |
\clearpage |
| 56 |
|
| 57 |
\section{La commande et les options} |
| 58 |
|
| 59 |
\begin{BDef} |
| 60 |
\Lcs{psthick}\OptArgs\Largb{t1}\Largb{t2}\Largb{function} |
| 61 |
\end{BDef} |
| 62 |
|
| 63 |
Cette commande s'écrit et comporte de grandes analogies avec \Lcs{parametricplot}. |
| 64 |
|
| 65 |
\bigskip\noindent |
| 66 |
\begin{tabularx}{\linewidth}{@{} l>{\ttfamily}cc X @{}} \toprule |
| 67 |
\emph{name} & \emph{type} & \emph{default} & \emph{description}\\\toprule |
| 68 |
\Lkeyword{E} & nombre & 1 & épaisseur du trait cm \\ |
| 69 |
\Lkeyword{K} & nombre & 0 & modifie l'inclinaison par rapport à la normale de l'angle \Lkeyword{K}\\\midrule |
| 70 |
\Lkeyword{stylethick} & texte & \Lkeyval{thicklineblue}& style du tracé\\ \midrule |
| 71 |
\Lkeyword{curveonly} & boolean & false & Ne trace que les bords de la ligne\\ |
| 72 |
\Lkeyword{stylecurve1} & texte & \Lkeyval{onlythecurvered}& style du tracé de la courbe 1 \\ |
| 73 |
\Lkeyword{stylecurve2} & texte & \Lkeyval{onlythecurveblue}& style du tracé de la courbe 2 \\\bottomrule |
| 74 |
\end{tabularx} |
| 75 |
|
| 76 |
\bigskip |
| 77 |
Les styles prédéfinis sont les suivants : |
| 78 |
|
| 79 |
\bigskip |
| 80 |
\begin{lstlisting} |
| 81 |
\newpsstyle{thickline}{fillstyle=solid,fillcolor=red!25,linecolor=red,plotpoints=360} |
| 82 |
\newpsstyle{onlythecurvered}{linecolor=red,plotpoints=360} |
| 83 |
\newpsstyle{onlythecurveblue}{linecolor=blue,plotpoints=360} |
| 84 |
\newpsstyle{thicklineblue}{fillstyle=solid,fillcolor=blue!25,linecolor=blue,plotpoints=360} |
| 85 |
\newpsstyle{rainbow}{fillstyle=ccslopes,linecolor=red,plotpoints=360} |
| 86 |
\newpsstyle{solide}{fillstyle=solid,fillcolor=black,plotpoints=360} |
| 87 |
\newpsstyle{default}{}% lignes noires, rien a l'interieur |
| 88 |
\end{lstlisting} |
| 89 |
|
| 90 |
Dans la commande \verb+\psthick[options]{t1}{t2}{function}+, \textcolor{red}{\texttt{t1}} est la valeur initiale et |
| 91 |
\textcolor{red}{\texttt{t2}} la valeur finale, comme dans \verb+\parametricplot+. |
| 92 |
|
| 93 |
La fonction sera définie, en \texttt{PostScript}, par $\mathsf{x(t)}$ et $\mathsf{y(t)}$. |
| 94 |
L'exemple le plus simple, pré-défini, est la fonction \texttt{sinus}~:~ |
| 95 |
\Lcs{fonctionSinus}\Largb{periode}\Largb{amplitude} |
| 96 |
|
| 97 |
\begin{lstlisting} |
| 98 |
\def\fonctionSinus#1#2{% |
| 99 |
/P #1 def % periode (10 unites) |
| 100 |
/A #2 def % amplitude |
| 101 |
/O 360 P div def % pulsation 2*pi/P |
| 102 |
/x0 t def |
| 103 |
/y0 t O mul sin A mul def % A*sin(O*t) |
| 104 |
/dx dt def |
| 105 |
/dy t dt add O mul sin |
| 106 |
t O mul sin |
| 107 |
sub |
| 108 |
A mul def } |
| 109 |
\end{lstlisting} |
| 110 |
|
| 111 |
Le nom des variables ne doit pas être modifié. Pour définir une fonction particulière, |
| 112 |
il faut donc écrire 4 définitions : |
| 113 |
|
| 114 |
\begin{compactitem} |
| 115 |
\item \texttt{x0=x(t)} |
| 116 |
\item \texttt{y0=y(t)} |
| 117 |
\item \texttt{dx=x(t+dt)-x(t)} |
| 118 |
\item \texttt{dy=y(t+dt)-y(t)} |
| 119 |
\end{compactitem} |
| 120 |
en respectant la notation \texttt{PostScript} et passer, éventuellement, en options, |
| 121 |
d'autres paramètres, comme dans cet exemple, la période et l'amplitude. D'autres exemple seront donnés plus loin. |
| 122 |
|
| 123 |
\section{Tracer une courbe avec une épaisseur donnée, principe :} |
| 124 |
Prenons, par exemple, le tracé d'une sinusoïde avec une épaisseur constante de 2~cm. |
| 125 |
Le principe est simple et se décompose en 4 points : |
| 126 |
\begin{compactitem} |
| 127 |
\item tracer la sinusoïde en question(en traits discontinus); |
| 128 |
\item tracer la normale en chacun des points(en un nombre de points donnés) et de part et d'autre marquer |
| 129 |
à une distance égale à la demi-épaisseur les points correspondants aux deux bords de la courbe ; |
| 130 |
\item tracer, en reliant les points correspondants, les deux bords de la courbe, qui, |
| 131 |
remarquons-le, ne sont plus des sinusoïdes ; |
| 132 |
\item remplir l'intervalle avec la couleur ou le motif voulu. |
| 133 |
\end{compactitem} |
| 134 |
|
| 135 |
\begin{center} |
| 136 |
\psset{unit=0.75cm} |
| 137 |
\begin{pspicture}(-1,-3)(10,3) |
| 138 |
\psthick[curveonly,E=2]{0}{10}{\fonctionSinus{10}{2}} |
| 139 |
\multido{\i=0+1}{11}{% |
| 140 |
\pnode(!/t \i\space def |
| 141 |
/E 2 def |
| 142 |
/dt 10 360 div def |
| 143 |
\fonctionSinus{10}{2} |
| 144 |
/ds dx dup mul dy dup mul add sqrt def |
| 145 |
/dx dx ds div def |
| 146 |
/dy dy ds div def |
| 147 |
/nx E 2 div dy mul neg def % normale x |
| 148 |
/ny E 2 div dx mul def % normale y |
| 149 |
/x1 x0 nx add def |
| 150 |
/y1 y0 ny add def |
| 151 |
x1 y1){A} |
| 152 |
\psdot[linecolor=red](A) |
| 153 |
\pnode(! /x2 x0 nx sub def /y2 y0 ny sub def x2 y2){B} |
| 154 |
\psdot[linecolor=red](B) \psdot(!t O t mul sin A mul) \psline(A)(B)} |
| 155 |
\parametricplot[linestyle=dashed]{0}{10}{ t O t mul sin A mul } |
| 156 |
\psaxes(0,0)(-1,-3)(10,3) |
| 157 |
\end{pspicture} |
| 158 |
\end{center} |
| 159 |
|
| 160 |
\begin{lstlisting} |
| 161 |
\begin{pspicture}(-1,-3)(10,3) |
| 162 |
\psthick[curveonly,E=2]{0}{10}{\fonctionSinus{10}{2}} |
| 163 |
\multido{\i=0+1}{11}{% |
| 164 |
\pnode(!/t \i\space def |
| 165 |
/E 2 def |
| 166 |
/dt 10 360 div def |
| 167 |
\fonctionSinus{10}{2} |
| 168 |
/ds dx dup mul dy dup mul add sqrt def |
| 169 |
/dx dx ds div def |
| 170 |
/dy dy ds div def |
| 171 |
/nx E 2 div dy mul neg def % normale x |
| 172 |
/ny E 2 div dx mul def % normale y |
| 173 |
/x1 x0 nx add def |
| 174 |
/y1 y0 ny add def |
| 175 |
x1 y1){A} |
| 176 |
\psdot[linecolor=red](A) |
| 177 |
\pnode(! /x2 x0 nx sub def /y2 y0 ny sub def x2 y2){B} |
| 178 |
\psdot[linecolor=red](B) \psdot(!t O t mul sin A mul) \psline(A)(B)} |
| 179 |
\parametricplot[linestyle=dashed]{0}{10}{ t O t mul sin A mul } |
| 180 |
\psaxes(0,0)(-1,-3)(10,3) |
| 181 |
\end{pspicture} |
| 182 |
\end{lstlisting} |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
\begin{center} |
| 187 |
\psset{unit=0.75cm} |
| 188 |
\begin{pspicture}(-1,-3)(10,3) |
| 189 |
\psthick[E=2]{0}{10}{\fonctionSinus{10}{2}}% |
| 190 |
\psaxes(0,0)(-1,-3)(10,3)%\psgrid(0,-3)(10,3) |
| 191 |
\end{pspicture} |
| 192 |
\end{center} |
| 193 |
|
| 194 |
\begin{lstlisting} |
| 195 |
\begin{pspicture}(-1,-3)(10,3) |
| 196 |
\psset{plotpoints=360} |
| 197 |
\psthick[E=2]{0}{10}{\fonctionSinus{10}{2}} |
| 198 |
\psaxes(0,0)(-1,-3)(10,3) |
| 199 |
\end{pspicture} |
| 200 |
\end{lstlisting} |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
\section{Le même(?) résultat avec les commandes de base de \mbox{PStricks}} |
| 206 |
L'option \Lkeyset{doubleline=true} et ses paramètres associés \Lkeyword{doublecolor} et |
| 207 |
\Lkeyword{doublesep} permettent d'obtenir un |
| 208 |
tracé analogue(preuve que les commandes internes à \texttt{PostScript} utilisent |
| 209 |
la même méthode que celle employée dans la première partie). |
| 210 |
|
| 211 |
Les valeurs passées en options sont les suivantes : |
| 212 |
\begin{compactitem} |
| 213 |
\item \Lkeyword{doublecolor}\texttt{=red!25} |
| 214 |
\item \Lkeyword{doublesep}=2 : épaisseur de 2~cm |
| 215 |
\item \Lkeyset{linecolor=red} |
| 216 |
% \item \verb+linewidth=\pslinewidth+ : épaisseur standard d'une ligne. |
| 217 |
\end{compactitem} |
| 218 |
|
| 219 |
\begin{center} |
| 220 |
\begin{pspicture}[showgrid=true](-1,-3)(10,3.5) |
| 221 |
\pnode(!/P 10 def % période (10 unites) |
| 222 |
/A 2 def % amplitude |
| 223 |
/O 360 P div def 0 0){bluf} |
| 224 |
\parametricplot[plotpoints=360,doublecolor=red!25,doubleline=true, |
| 225 |
linecolor=red,doublesep=2]{0}{10}{ t O t mul sin A mul } |
| 226 |
\end{pspicture} |
| 227 |
\end{center} |
| 228 |
|
| 229 |
\begin{lstlisting}[style=code] |
| 230 |
\begin{pspicture}[showgrid=true](-1,-3)(10,3.5) |
| 231 |
\pnode(!/P 10 def % periode (10 unites) |
| 232 |
/A 2 def % amplitude |
| 233 |
/O 360 P div def 0 0){bluf} |
| 234 |
\parametricplot[plotpoints=360,doublecolor=red!25,doubleline=true, |
| 235 |
linecolor=red,doublesep=2]{0}{10}{ t O t mul sin A mul } |
| 236 |
\end{pspicture} |
| 237 |
\end{lstlisting} |
| 238 |
|
| 239 |
|
| 240 |
Il y a quand même une différence dans la méthode employée par \texttt{PStricks}, |
| 241 |
on peut l'observer sur le tracé suivant: |
| 242 |
\begin{center} |
| 243 |
\begin{pspicture}[showgrid=true](-1,-3)(10,3.5) |
| 244 |
\pnode(!/P 10 def % periode (10 unites) |
| 245 |
/A 2 def % amplitude |
| 246 |
/O 360 P div def 0 0){bluf} |
| 247 |
\parametricplot[plotpoints=360,doublecolor=red!25,doubleline=true,linecolor=red, |
| 248 |
doublesep=2]{0}{10}{ t O t mul sin A mul } |
| 249 |
\parametricplot[plotpoints=360,linecolor=red,linewidth=2]{7}{10}{ t O t mul sin A mul } |
| 250 |
\end{pspicture} |
| 251 |
\end{center} |
| 252 |
|
| 253 |
|
| 254 |
\begin{lstlisting} |
| 255 |
\begin{pspicture}[showgrid=true](-1,-3)(10,3.5) |
| 256 |
\pnode(!/P 10 def % periode (10 unites) |
| 257 |
/A 2 def % amplitude |
| 258 |
/O 360 P div def 0 0){bluf} |
| 259 |
\parametricplot[plotpoints=360,doublecolor=red!25,doubleline=true,linecolor=red, |
| 260 |
doublesep=2]{0}{10}{ t O t mul sin A mul } |
| 261 |
\parametricplot[plotpoints=360,linecolor=red,linewidth=2]{7}{10}{ t O t mul sin A mul } |
| 262 |
\end{pspicture} |
| 263 |
\end{lstlisting} |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
\texttt{PStricks} trace d'abord une courbe d'épaisseur 2~cm plus l'épaisseur d'un trait |
| 268 |
de couleur rouge, puis avec le pinceau de la couleur |
| 269 |
de \Lkeyword{doublecolor} une ligne d'épaisseur 2~cm, qui remplace la couleur rouge |
| 270 |
entre les deux bords. On peut apercevoir, très fugitivement, ce phénomène, |
| 271 |
lors de l'affichage avec un visualiseur \texttt{PostScript}. |
| 272 |
|
| 273 |
\section{Réalisation d'une frise par les deux méthodes} |
| 274 |
On peut donc se demander, à juste titre, s'il y a un quelconque intérêt à fabriquer une commande spéciale |
| 275 |
pour tracer des courbes épaisses dès lors que les commandes de base de \texttt{PStricks} |
| 276 |
permettent aisément d'obtenir le résultat souhaité ? |
| 277 |
|
| 278 |
Afin de comparer les deux méthodes, réalisons l'ébauche d'une frise où deux sinusoïdes s'entrelacent, l'une passant alternativement dessus puis dessous la deuxième. |
| 279 |
\subsection{Méthode 1 : simple superposition} |
| 280 |
La démarche utilisée est ultra simple : on trace d'abord la sinusoïde rouge puis la sinusoïde bleue, ensuite on re-dessine par-dessus une portion de |
| 281 |
sinusoïde rouge correspondant à la deuxième intersection |
| 282 |
\begin{center} |
| 283 |
\psset{unit=0.5cm} |
| 284 |
\begin{pspicture}(-1,-4)(12,4) |
| 285 |
\psset{E=2} |
| 286 |
\psthick{-2.5}{12.5}{\fonctionSinus{10}{2}} |
| 287 |
\psthick[stylethick=thicklineblue]{-2.5}{12.5}{\fonctionSinus{10}{-2}} |
| 288 |
\psthick[linestyle=none]{2.5}{7.5}{\fonctionSinus{10}{2}} |
| 289 |
\psthick[curveonly]{2.5}{7.5}{\fonctionSinus{10}{2}} |
| 290 |
\rput(5.5,-3.5){Commande spéciale} |
| 291 |
\end{pspicture} |
| 292 |
\hfill |
| 293 |
\begin{pspicture}(-1,-4)(12,4) |
| 294 |
\pnode(!/P 10 def % période (10 unités) |
| 295 |
/A 2 def % amplitude |
| 296 |
/O 360 P div def |
| 297 |
0 0){bluf} |
| 298 |
\psset{plotpoints=360} |
| 299 |
\parametricplot[linewidth=\pslinewidth,doublecolor=red!25,doubleline=true,linecolor=red,doublesep=2]{-2.5}{12.5}{% |
| 300 |
t O t mul sin A mul |
| 301 |
}% |
| 302 |
\parametricplot[linewidth=\pslinewidth,doublecolor=blue!25,doubleline=true,linecolor=blue,doublesep=2]{-2.5}{12.5}{% |
| 303 |
t O t mul sin A mul neg |
| 304 |
}% |
| 305 |
\parametricplot[linewidth=\pslinewidth,doublecolor=red!25,doubleline=true,linecolor=red,doublesep=2]{2.5}{7.5}{% |
| 306 |
t O t mul sin A mul |
| 307 |
}% |
| 308 |
\rput(5.5,-3.5){Commandes de base \texttt{PStricks}} |
| 309 |
\end{pspicture} |
| 310 |
\end{center} |
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
Votre \oe{}il exercé a certainement remarqué que les raccordements ne sont |
| 317 |
pas parfaits avec les commandes de base \texttt{PStricks}, une fine trace verticale |
| 318 |
rouge marque les deux extrémités de la portion rajoutée ! |
| 319 |
\subsection{Méthode 2 : commande \texttt{clip}} |
| 320 |
Une méthode plus élaborée consiste à ne dessiner pour la deuxième intersection |
| 321 |
que la partie correspondante à la courbe rouge qui coïncide avec la courbe bleue |
| 322 |
lors de l'intersection, cela est possible avec la commande \Lcs{psclip} de \texttt{PostScript} |
| 323 |
adaptée à \texttt{PStricks}. |
| 324 |
|
| 325 |
Dans les deux cas nous allons faire un \textit{clipping} de la courbe bleue et le remplacer à |
| 326 |
la deuxième intersection par la courbe rouge. |
| 327 |
|
| 328 |
\begin{center} |
| 329 |
\psset{unit=0.5cm} |
| 330 |
\begin{pspicture}(-1,-4)(12,4) |
| 331 |
\psthick[E=2]{-2.5}{12.5}{\fonctionSinus{10}{2}}% |
| 332 |
\psthick[E=2,stylethick=thicklineblue]{-2.5}{12.5}{\fonctionSinus{10}{-2}}% |
| 333 |
% on élargit la courbe bleue pour ne pas laisser de traces de bord lors du clipping |
| 334 |
\psclip{\psthick[E=2.5,stylethick=vide]{0}{10}{\fonctionSinus{10}{-2}}}% |
| 335 |
% l'épaisseur initiale est rétablie |
| 336 |
\psthick[E=2]{2.5}{7.5}{\fonctionSinus{10}{2}}% |
| 337 |
\endpsclip% |
| 338 |
\rput(5.5,-3.5){Commande spéciale} |
| 339 |
\end{pspicture} |
| 340 |
\hfill |
| 341 |
\begin{pspicture}(-1,-4)(12,4) |
| 342 |
\pnode(!/P 10 def % période (10 unités) |
| 343 |
/A 2 def % amplitude |
| 344 |
/O 360 P div def |
| 345 |
0 0){bluf} |
| 346 |
\psset{plotpoints=360} |
| 347 |
\parametricplot[linewidth=\pslinewidth,doublecolor=red!25,doubleline=true,linecolor=red,doublesep=2]{-2.5}{12.5}{% |
| 348 |
t O t mul sin A mul |
| 349 |
}% |
| 350 |
\parametricplot[linewidth=\pslinewidth,doublecolor=blue!25,doubleline=true,linecolor=blue,doublesep=2]{-2.5}{12.5}{% |
| 351 |
t O t mul sin A mul neg |
| 352 |
}% |
| 353 |
\psclip{\parametricplot[doubleline=true,doublecolor=blue!25,linecolor=blue,doublesep=2]{2.5}{7.5}{% |
| 354 |
t O t mul sin A mul neg}} |
| 355 |
\parametricplot[linewidth=\pslinewidth,doublecolor=red!25,doubleline=true,linecolor=red,doublesep=2]{2.5}{7.5}{% |
| 356 |
t O t mul sin A mul} |
| 357 |
\endpsclip% |
| 358 |
\rput(5.5,-3.5){Commandes de base \texttt{PStricks}} |
| 359 |
\end{pspicture} |
| 360 |
\end{center} |
| 361 |
|
| 362 |
\begin{lstlisting}[style=code] |
| 363 |
\begin{pspicture}(-1,-4)(12,4) |
| 364 |
\psthick[E=2]{-2.5}{12.5}{\fonctionSinus{10}{2}} |
| 365 |
\psthick[E=2,stylethick=thicklineblue]{-2.5}{12.5}{\fonctionSinus{10}{-2}}% |
| 366 |
\psclip{\psthick[E=2.5,stylethick=vide]{0}{10}{\fonctionSinus{10}{-2}}}% |
| 367 |
\psthick[E=2]{2.5}{7.5}{\fonctionSinus{10}{2}}% |
| 368 |
\endpsclip% |
| 369 |
\rput(5.5,-3.5){Commande speciale} |
| 370 |
\end{pspicture} |
| 371 |
\end{lstlisting} |
| 372 |
|
| 373 |
\textbf{Conclusion : avantage à la commande spéciale.} Les commandes de base |
| 374 |
\texttt{PStricks} ne permettent pas de faire un \textit{clipping}, car le chemin qui délimite le contour de la ligne |
| 375 |
n'est pas défini, ou plutôt n'est pas accessible par ce procédé. |
| 376 |
|
| 377 |
\section{Remplir l'intérieur avec une couleur ou un motif particulier} |
| 378 |
\subsection{Les couleurs de l'arc-en-ciel} |
| 379 |
Cela est facile, grâce au package \LPack{pst-slpe}, en définissant le style adapté : |
| 380 |
|
| 381 |
\begin{lstlisting}[style=code] |
| 382 |
\newpsstyle{rainbow}{fillstyle=ccslopes,linecolor=red} |
| 383 |
\end{lstlisting} |
| 384 |
|
| 385 |
\begin{center} |
| 386 |
\begin{pspicture}(-1,-2)(10,3) |
| 387 |
\psthick[stylethick=rainbow,E=0.5]{0}{10}{\fonctionSinus{5}{2}} |
| 388 |
\psaxes(0,0)(-1,-2)(10,3) |
| 389 |
\end{pspicture} |
| 390 |
\end{center} |
| 391 |
|
| 392 |
\begin{lstlisting}[style=code] |
| 393 |
\begin{pspicture}(-1,-2)(10,3) |
| 394 |
\psthick[stylethick=rainbow,E=0.5]{0}{10}{\fonctionSinus{5}{2}} |
| 395 |
\psaxes(0,0)(-1,-2)(10,3) |
| 396 |
\end{pspicture} |
| 397 |
\end{lstlisting} |
| 398 |
|
| 399 |
\subsection{Des hachures} |
| 400 |
\newpsstyle{hachures}{fillstyle=crosshatch,plotpoints=360} |
| 401 |
\begin{center} |
| 402 |
\begin{pspicture}(-1,-2)(10,3) |
| 403 |
\psthick[stylethick=hachures,E=0.5]{0}{10}{\fonctionSinus{5}{2}} |
| 404 |
\psaxes(0,0)(-1,-2)(10,3) |
| 405 |
\end{pspicture} |
| 406 |
\end{center} |
| 407 |
|
| 408 |
\begin{lstlisting}[style=code] |
| 409 |
\newpsstyle{hachures}{fillstyle=crosshatch,plotpoints=360} |
| 410 |
\begin{pspicture}(-1,-2)(10,3) |
| 411 |
\psthick[stylethick=hachures,E=0.5]{0}{10}{\fonctionSinus{5}{2}} |
| 412 |
\psaxes(0,0)(-1,-2)(10,3) |
| 413 |
\end{pspicture} |
| 414 |
\end{lstlisting} |
| 415 |
|
| 416 |
|
| 417 |
\section{Simulation(?) de la reptation d'un ver ou d'un serpent} |
| 418 |
|
| 419 |
\begin{center} |
| 420 |
\psset{unit=0.5cm} |
| 421 |
\begin{pspicture}(-1,-2)(20,3) |
| 422 |
\psthick[stylethick=serpent,E=1.5]{0}{20}{\fonctionSinus{10}{2}} |
| 423 |
\multido{\i=0+1}{21}{% |
| 424 |
\pnode(!/t \i\space def |
| 425 |
/dt 10 360 div def /E 1.5 def |
| 426 |
\fonctionSinus{10}{2} |
| 427 |
/ds dx dup mul dy dup mul add sqrt def |
| 428 |
/dx dx ds div def /dy dy ds div def |
| 429 |
/nx E 2 div dy mul neg def % normale x |
| 430 |
/ny E 2 div dx mul def % normale y |
| 431 |
/x1 x0 nx add def /y1 y0 ny add def |
| 432 |
x1 y1){A} |
| 433 |
\psdot(A) |
| 434 |
\pnode(! /x2 x0 nx sub def /y2 y0 ny sub def x2 y2){B} |
| 435 |
\psdot(B) \psline(A)(B)} |
| 436 |
\parametricplot[linestyle=dashed]{0}{20}{ t O t mul sin 2 mul } |
| 437 |
\end{pspicture} |
| 438 |
\end{center} |
| 439 |
|
| 440 |
\begin{lstlisting} |
| 441 |
\psset{unit=0.5cm} |
| 442 |
\begin{pspicture}(-1,-2)(20,3) |
| 443 |
\psthick[stylethick=serpent,E=1.5]{0}{20}{\fonctionSinus{10}{2}} |
| 444 |
\multido{\i=0+1}{21}{% |
| 445 |
\pnode(!/t \i\space def |
| 446 |
/dt 10 360 div def /E 1.5 def |
| 447 |
\fonctionSinus{10}{2} |
| 448 |
/ds dx dup mul dy dup mul add sqrt def |
| 449 |
/dx dx ds div def /dy dy ds div def |
| 450 |
/nx E 2 div dy mul neg def % normale x |
| 451 |
/ny E 2 div dx mul def % normale y |
| 452 |
/x1 x0 nx add def /y1 y0 ny add def |
| 453 |
x1 y1){A} |
| 454 |
\psdot(A) |
| 455 |
\pnode(! /x2 x0 nx sub def /y2 y0 ny sub def x2 y2){B} |
| 456 |
\psdot(B) \psline(A)(B)} |
| 457 |
\parametricplot[linestyle=dashed]{0}{20}{ t O t mul sin 2 mul } |
| 458 |
\end{pspicture} |
| 459 |
\end{lstlisting} |
| 460 |
|
| 461 |
|
| 462 |
\begin{center} |
| 463 |
\psset{unit=0.5cm} |
| 464 |
\begin{pspicture}(-1,-2)(20,3) |
| 465 |
\psthick[stylethick=serpent,E=1.5]{0}{20}{\fonctionSinus{10}{0.5}} |
| 466 |
\multido{\i=0+1}{21}{% |
| 467 |
\pnode(! /t \i\space def /dt 10 360 div def |
| 468 |
\fonctionSinus{10}{0.5} |
| 469 |
/E 1.5 def |
| 470 |
/ds dx dup mul dy dup mul add sqrt def |
| 471 |
/dx dx ds div def /dy dy ds div def |
| 472 |
/nx E 2 div dy mul neg def % normale x |
| 473 |
/ny E 2 div dx mul def % normale y |
| 474 |
/x1 x0 nx add def /y1 y0 ny add def |
| 475 |
x1 y1){A} |
| 476 |
\psdot(A) \pnode(! /x2 x0 nx sub def /y2 y0 ny sub def x2 y2){B} |
| 477 |
\psdot(B) \psline(A)(B)} |
| 478 |
\parametricplot[linestyle=dashed]{0}{20}{ t O t mul sin 0.5 mul } |
| 479 |
\end{pspicture} |
| 480 |
\end{center} |
| 481 |
|
| 482 |
\begin{lstlisting} |
| 483 |
\psset{unit=0.5cm} |
| 484 |
\begin{pspicture}(-1,-2)(20,3) |
| 485 |
\psthick[stylethick=serpent,E=1.5]{0}{20}{\fonctionSinus{10}{0.5}} |
| 486 |
\multido{\i=0+1}{21}{% |
| 487 |
\pnode(! /t \i\space def /dt 10 360 div def |
| 488 |
\fonctionSinus{10}{0.5} |
| 489 |
/E 1.5 def |
| 490 |
/ds dx dup mul dy dup mul add sqrt def |
| 491 |
/dx dx ds div def /dy dy ds div def |
| 492 |
/nx E 2 div dy mul neg def % normale x |
| 493 |
/ny E 2 div dx mul def % normale y |
| 494 |
/x1 x0 nx add def /y1 y0 ny add def |
| 495 |
x1 y1){A} |
| 496 |
\psdot(A) \pnode(! /x2 x0 nx sub def /y2 y0 ny sub def x2 y2){B} |
| 497 |
\psdot(B) \psline(A)(B)} |
| 498 |
\parametricplot[linestyle=dashed]{0}{20}{ t O t mul sin 0.5 mul } |
| 499 |
\end{pspicture} |
| 500 |
\end{lstlisting} |
| 501 |
|
| 502 |
\begin{center} |
| 503 |
\psset{unit=0.5cm} |
| 504 |
\begin{pspicture}(-1,-2)(20,3) |
| 505 |
\psthick[stylethick=serpent,E=1.5]{0}{20}{\fonctionSinus{10}{-1}} |
| 506 |
\multido{\i=0+1}{21}{% |
| 507 |
\pnode(! /t \i\space def |
| 508 |
/dt 10 360 div def /E 1.5 def |
| 509 |
\fonctionSinus{10}{-1} |
| 510 |
/ds dx dup mul dy dup mul add sqrt def |
| 511 |
/dx dx ds div def /dy dy ds div def |
| 512 |
/nx E 2 div dy mul neg def % normale x |
| 513 |
/ny E 2 div dx mul def % normale y |
| 514 |
/x1 x0 nx add def /y1 y0 ny add def |
| 515 |
x1 y1){A} |
| 516 |
\psdot(A)\pnode(! /x2 x0 nx sub def /y2 y0 ny sub def x2 y2){B} |
| 517 |
\psdot(B) \psline(A)(B)} |
| 518 |
\parametricplot[linestyle=dashed]{0}{20}{ t O t mul sin -1 mul } |
| 519 |
\end{pspicture} |
| 520 |
\end{center} |
| 521 |
|
| 522 |
\begin{lstlisting} |
| 523 |
\psset{unit=0.5cm} |
| 524 |
\begin{pspicture}(-1,-2)(20,3) |
| 525 |
\psthick[stylethick=serpent,E=1.5]{0}{20}{\fonctionSinus{10}{-1}} |
| 526 |
\multido{\i=0+1}{21}{% |
| 527 |
\pnode(! /t \i\space def |
| 528 |
/dt 10 360 div def /E 1.5 def |
| 529 |
\fonctionSinus{10}{-1} |
| 530 |
/ds dx dup mul dy dup mul add sqrt def |
| 531 |
/dx dx ds div def /dy dy ds div def |
| 532 |
/nx E 2 div dy mul neg def % normale x |
| 533 |
/ny E 2 div dx mul def % normale y |
| 534 |
/x1 x0 nx add def /y1 y0 ny add def |
| 535 |
x1 y1){A} |
| 536 |
\psdot(A)\pnode(! /x2 x0 nx sub def /y2 y0 ny sub def x2 y2){B} |
| 537 |
\psdot(B) \psline(A)(B)} |
| 538 |
\parametricplot[linestyle=dashed]{0}{20}{ t O t mul sin -1 mul } |
| 539 |
\end{pspicture} |
| 540 |
\end{lstlisting} |
| 541 |
|
| 542 |
\begin{center} |
| 543 |
\psset{unit=0.5cm} |
| 544 |
\begin{pspicture}(-1,-2)(20,3) |
| 545 |
\psthick[stylethick=serpent,E=1.5]{0}{20}{\fonctionSinus{10}{-2.5}} |
| 546 |
\multido{\i=0+1}{21}{% |
| 547 |
\pnode(!/t \i\space def |
| 548 |
/dt 10 360 div def |
| 549 |
\fonctionSinus{10}{-2.5} |
| 550 |
/E 1.5 def |
| 551 |
/ds dx dup mul dy dup mul add sqrt def |
| 552 |
/dx dx ds div def |
| 553 |
/dy dy ds div def |
| 554 |
/nx E 2 div dy mul neg def % normale x |
| 555 |
/ny E 2 div dx mul def % normale y |
| 556 |
x0 nx add y0 ny add ){A} |
| 557 |
\psdot(A)\pnode(! x0 nx sub y0 ny sub ){B} |
| 558 |
\psdot(B) \psline(A)(B)} |
| 559 |
\parametricplot[linestyle=dashed]{0}{20}{ t O t mul sin -2.5 mul } |
| 560 |
\end{pspicture} |
| 561 |
\end{center} |
| 562 |
|
| 563 |
\begin{lstlisting} |
| 564 |
\psset{unit=0.5cm} |
| 565 |
\begin{pspicture}(-1,-2)(20,3) |
| 566 |
\psthick[stylethick=serpent,E=1.5]{0}{20}{\fonctionSinus{10}{-2.5}} |
| 567 |
\multido{\i=0+1}{21}{% |
| 568 |
\pnode(!/t \i\space def |
| 569 |
/dt 10 360 div def |
| 570 |
\fonctionSinus{10}{-2.5} |
| 571 |
/E 1.5 def |
| 572 |
/ds dx dup mul dy dup mul add sqrt def |
| 573 |
/dx dx ds div def |
| 574 |
/dy dy ds div def |
| 575 |
/nx E 2 div dy mul neg def % normale x |
| 576 |
/ny E 2 div dx mul def % normale y |
| 577 |
x0 nx add y0 ny add ){A} |
| 578 |
\psdot(A)\pnode(! x0 nx sub y0 ny sub ){B} |
| 579 |
\psdot(B) \psline(A)(B)} |
| 580 |
\parametricplot[linestyle=dashed]{0}{20}{ t O t mul sin -2.5 mul } |
| 581 |
\end{pspicture} |
| 582 |
\end{lstlisting} |
| 583 |
|
| 584 |
\section{Autres exemples : parabole et cercle} |
| 585 |
\def\fonctionParabole#1#2#3{% ax^2+bx+c |
| 586 |
/A #1 def % |
| 587 |
/B #2 def % |
| 588 |
/C #3 def |
| 589 |
/x0 t def |
| 590 |
/y0 A t dup mul mul t B mul add C add def % ax^2+bx+c |
| 591 |
/dx dt def |
| 592 |
/dy A t dt add dup mul mul t dt add B mul add C add |
| 593 |
A t dup mul mul t B mul add C add |
| 594 |
sub |
| 595 |
def |
| 596 |
} |
| 597 |
\begin{center} |
| 598 |
\psset{unit=0.75} |
| 599 |
\begin{pspicture}(-6,-5)(3,5) |
| 600 |
\psthick[stylethick=thicklineblue,linewidth=0.1]{-6}{2}{\fonctionParabole{0.5}{2}{-2}} |
| 601 |
\psaxes(0,0)(-6,-5)(3,5) |
| 602 |
\end{pspicture} |
| 603 |
\hfill |
| 604 |
\begin{pspicture}(-6,-5)(3,5) |
| 605 |
\psthick[curveonly,stylecurve2=onlythecurveblue,linewidth=0.1]{-6}{2}{\fonctionParabole{0.5}{2}{-2}} |
| 606 |
\multido{\n=-6+0.5}{17}{% |
| 607 |
\pnode(!/t \n\space def |
| 608 |
/dt 0.01 def |
| 609 |
\fonctionParabole{0.5}{2}{-2} |
| 610 |
/E 1 def |
| 611 |
/ds dx dup mul dy dup mul add sqrt def |
| 612 |
/dx dx ds div def |
| 613 |
/dy dy ds div def |
| 614 |
/nx E 2 div dy mul neg def % normale x |
| 615 |
/ny E 2 div dx mul def % normale y |
| 616 |
/x1 x0 nx add def |
| 617 |
/y1 y0 ny add def |
| 618 |
x1 y1){A} |
| 619 |
\psdot(A) |
| 620 |
\pnode(! |
| 621 |
/x2 x0 nx sub def |
| 622 |
/y2 y0 ny sub def |
| 623 |
x2 y2){B} |
| 624 |
\psdot(B) |
| 625 |
\psline(A)(B)} |
| 626 |
\psaxes(0,0)(-6,-5)(3,5) |
| 627 |
\end{pspicture} |
| 628 |
\end{center} |
| 629 |
|
| 630 |
\begin{lstlisting} |
| 631 |
\begin{pspicture}(-6,-5)(3,5) |
| 632 |
\psthick[stylethick=thicklineblue,linewidth=0.1]{-6}{2}{\fonctionParabole{0.5}{2}{-2}} |
| 633 |
\psaxes(0,0)(-6,-5)(3,5) |
| 634 |
\end{pspicture} |
| 635 |
\end{lstlisting} |
| 636 |
\begin{lstlisting} |
| 637 |
\def\fonctionParabole#1#2#3{% ax^2+bx+c |
| 638 |
/A #1 def % |
| 639 |
/B #2 def % |
| 640 |
/C #3 def |
| 641 |
/x0 t def |
| 642 |
/y0 A t dup mul mul t B mul add C add def % ax^2+bx+c |
| 643 |
/dx dt def |
| 644 |
/dy A t dt add dup mul mul t dt add B mul add C add |
| 645 |
A t dup mul mul t B mul add C add |
| 646 |
sub |
| 647 |
def |
| 648 |
} |
| 649 |
\end{lstlisting} |
| 650 |
\def\fonctionCercle#1#2#3{% {x_centre}{y_centre}{rayon} |
| 651 |
/xC #1 def % |
| 652 |
/yC #2 def % |
| 653 |
/radius #3 def |
| 654 |
/x0 t cos radius mul xC add def |
| 655 |
/y0 t sin radius mul yC add def |
| 656 |
/dx t dt add cos radius mul xC add |
| 657 |
x0 sub def |
| 658 |
/dy t dt add sin radius mul yC add |
| 659 |
y0 sub def} |
| 660 |
\begin{center} |
| 661 |
\begin{pspicture}(-4,-5)(3,5) |
| 662 |
\psthick[E=1,linewidth=0.1]{45}{315}{\fonctionCercle{-1}{-1}{3}}% |
| 663 |
\psthick[curveonly]{-45}{45}{\fonctionCercle{-1}{-1}{3}}% |
| 664 |
\psdot(-1,-1) |
| 665 |
\pscircle[linestyle=dashed](-1,-1){3} |
| 666 |
\multido{\i=-45+10}{10}{% |
| 667 |
\pnode(!/t \i\space def |
| 668 |
/dt 1 def |
| 669 |
\fonctionCercle{-1}{-1}{3} |
| 670 |
/E 1 def |
| 671 |
/ds dx dup mul dy dup mul add sqrt def |
| 672 |
/dx dx ds div def |
| 673 |
/dy dy ds div def |
| 674 |
/nx E 2 div dy mul neg def % normale x |
| 675 |
/ny E 2 div dx mul def % normale y |
| 676 |
/x1 x0 nx add def |
| 677 |
/y1 y0 ny add def |
| 678 |
x1 y1){A} |
| 679 |
\psdot(A) |
| 680 |
\pnode(! |
| 681 |
/x2 x0 nx sub def |
| 682 |
/y2 y0 ny sub def |
| 683 |
x2 y2){B} |
| 684 |
\psdot(B) |
| 685 |
\psline(A)(B)} |
| 686 |
\psaxes(0,0)(-4,-4)(3,4) |
| 687 |
\end{pspicture} |
| 688 |
\hfill |
| 689 |
\begin{pspicture}(-3,-5)(3,3) |
| 690 |
\psclip{\psthick[E=0.5,stylethick=vide]{0}{360}{\fonctionCercle{0}{0}{2}}} |
| 691 |
\psframe*[linecolor=blue](-3.5,-4)(1.17,4) |
| 692 |
\psframe*[linecolor=white](-1.17,-4)(1.17,4) |
| 693 |
\psframe*[linecolor=red](1.17,-4)(3.5,4) |
| 694 |
\endpsclip% |
| 695 |
\psthick[curveonly,E=0.5,stylecurve2=onlythecurveblue]{0}{360}{\fonctionCercle{0}{0}{2}}% |
| 696 |
\psaxes(0,0)(-4,-4)(4,4) |
| 697 |
\end{pspicture} |
| 698 |
\end{center} |
| 699 |
|
| 700 |
\begin{lstlisting} |
| 701 |
\psthick[E=1,linewidth=0.1]{45}{315}{\fonctionCercle{-1}{-1}{3}}% |
| 702 |
\psthick[curveonly]{-45}{45}{\fonctionCercle{-1}{-1}{3}}% |
| 703 |
\psdot(-1,-1) |
| 704 |
\pscircle[linestyle=dashed](-1,-1){3} |
| 705 |
\multido{\i=-45+10}{10}{% |
| 706 |
\pnode(! /t \i\space def /dt 1 def |
| 707 |
\fonctionCercle{-1}{-1}{3} |
| 708 |
/E 1 def |
| 709 |
/ds dx dup mul dy dup mul add sqrt def |
| 710 |
/dx dx ds div def |
| 711 |
/dy dy ds div def |
| 712 |
/nx E 2 div dy mul neg def % normale x |
| 713 |
/ny E 2 div dx mul def % normale y |
| 714 |
x0 nx add y0 ny add ){A} |
| 715 |
\psdot(A) |
| 716 |
\pnode(! x0 nx sub y0 ny sub ){B} |
| 717 |
\psdot(B) |
| 718 |
\psline(A)(B) |
| 719 |
\end{lstlisting} |
| 720 |
|
| 721 |
\begin{lstlisting} |
| 722 |
\def\fonctionCercle#1#2#3{% {x_centre}{y_centre}{rayon} |
| 723 |
/xC #1 def /yC #2 def % |
| 724 |
/radius #3 def |
| 725 |
/x0 t cos radius mul xC add def |
| 726 |
/y0 t sin radius mul yC add def |
| 727 |
/dx t dt add cos radius mul xC add x0 sub def |
| 728 |
/dy t dt add sin radius mul yC add y0 sub def} |
| 729 |
\end{lstlisting} |
| 730 |
|
| 731 |
\section{Influence de l'inclinaison : paramètre \texttt{K}} |
| 732 |
|
| 733 |
\subsection{Sur la sinusoïde avec K=45°} |
| 734 |
\Lkeyword{K} est l'inclinaison en degrés, par rapport à la normale à la courbe d'origine. |
| 735 |
|
| 736 |
\begin{center} |
| 737 |
\psset{unit=0.75cm} |
| 738 |
\begin{pspicture}(-1,-3)(10,3) |
| 739 |
\psthick[curveonly,E=2,K=45]{0}{10}{\fonctionSinus{10}{2}} |
| 740 |
\multido{\i=0+1}{11}{% |
| 741 |
\pnode(! /t \i\space def |
| 742 |
/E 2 def /K 45 def |
| 743 |
/dt 10 360 div def |
| 744 |
\fonctionSinus{10}{2} |
| 745 |
/ds dx dup mul dy dup mul add sqrt def |
| 746 |
/dx dx ds div def /dy dy ds div def |
| 747 |
/dx' K cos dx mul K sin dy mul sub def |
| 748 |
/dy' K sin dx mul K cos dy mul add def |
| 749 |
/nx E 2 div dy' mul neg def % normale x |
| 750 |
/ny E 2 div dx' mul def % normale y |
| 751 |
x0 nx add y0 ny add ){A} |
| 752 |
\psdot[linecolor=red](A) |
| 753 |
\pnode(! x0 nx sub y0 ny sub ){B} |
| 754 |
\psdot[linecolor=red](B) \psdot(!t O t mul sin A mul) \psline(A)(B)} |
| 755 |
\parametricplot[linestyle=dashed]{0}{10}{ t O t mul sin A mul } |
| 756 |
\psaxes(0,0)(-1,-3)(10,3) |
| 757 |
\end{pspicture} |
| 758 |
\end{center} |
| 759 |
|
| 760 |
\begin{lstlisting} |
| 761 |
\psset{unit=0.75cm} |
| 762 |
\begin{pspicture}(-1,-3)(10,3) |
| 763 |
\psthick[curveonly,E=2,K=45]{0}{10}{\fonctionSinus{10}{2}} |
| 764 |
\multido{\i=0+1}{11}{% |
| 765 |
\pnode(! /t \i\space def |
| 766 |
/E 2 def /K 45 def |
| 767 |
/dt 10 360 div def |
| 768 |
\fonctionSinus{10}{2} |
| 769 |
/ds dx dup mul dy dup mul add sqrt def |
| 770 |
/dx dx ds div def /dy dy ds div def |
| 771 |
/dx' K cos dx mul K sin dy mul sub def |
| 772 |
/dy' K sin dx mul K cos dy mul add def |
| 773 |
/nx E 2 div dy' mul neg def % normale x |
| 774 |
/ny E 2 div dx' mul def % normale y |
| 775 |
x0 nx add y0 ny add ){A} |
| 776 |
\psdot[linecolor=red](A) |
| 777 |
\pnode(! x0 nx sub y0 ny sub ){B} |
| 778 |
\psdot[linecolor=red](B) \psdot(!t O t mul sin A mul) \psline(A)(B)} |
| 779 |
\parametricplot[linestyle=dashed]{0}{10}{ t O t mul sin A mul } |
| 780 |
\psaxes(0,0)(-1,-3)(10,3) |
| 781 |
\end{pspicture} |
| 782 |
\end{lstlisting} |
| 783 |
|
| 784 |
\begin{center} |
| 785 |
\begin{pspicture}(-1,-3)(10,3) |
| 786 |
\psthick[plotpoints=360,E=2,K=45]{0}{10}{\fonctionSinus{10}{2}}% |
| 787 |
\psaxes(0,0)(-1,-3)(10,3)%\psgrid(0,-3)(10,3) |
| 788 |
\end{pspicture} |
| 789 |
\end{center} |
| 790 |
|
| 791 |
\begin{lstlisting} |
| 792 |
\begin{pspicture}(-1,-3)(10,3) |
| 793 |
\psthick[plotpoints=360,E=2,K=45]{0}{10}{\fonctionSinus{10}{2}} |
| 794 |
\psaxes(0,0)(-1,-3)(10,3) |
| 795 |
\end{pspicture} |
| 796 |
\end{lstlisting} |
| 797 |
|
| 798 |
\subsection{Sur l'épaisseur avec K=80°} |
| 799 |
|
| 800 |
\begin{center} |
| 801 |
\begin{pspicture}(-1,-3)(10,3) |
| 802 |
\psthick[plotpoints=360,E=2,K=80,stylethick=solide]{0}{10}{\fonctionSinus{10}{2}}% |
| 803 |
\psaxes(0,0)(-1,-3)(10,3)%\psgrid(0,-3)(10,3) |
| 804 |
\end{pspicture} |
| 805 |
\end{center} |
| 806 |
|
| 807 |
\begin{lstlisting} |
| 808 |
\begin{pspicture}(-1,-3)(10,3) |
| 809 |
\psthick[plotpoints=360,E=2,K=80,stylethick=solide]{0}{10}{\fonctionSinus{10}{2}} |
| 810 |
\psaxes(0,0)(-1,-3)(10,3)%\psgrid(0,-3)(10,3) |
| 811 |
\end{pspicture} |
| 812 |
\end{lstlisting} |
| 813 |
|
| 814 |
\section{Une frise} |
| 815 |
Obtenue à coups de \Lcs{psclip}\ldots\Lcs{endpsclip}\ldots très laborieux et pas très beau : à revoir ! |
| 816 |
|
| 817 |
\newpsstyle{thicklinejaune}{fillstyle=solid,fillcolor=yellow!50!cyan!50,linecolor=yellow,plotpoints=360} |
| 818 |
\newpsstyle{thicklinevert}{fillstyle=solid,fillcolor=green!50,linecolor=green,plotpoints=360} |
| 819 |
\newpsstyle{onlycurvejaune}{linecolor=yellow,plotpoints=360} |
| 820 |
\def\SinusPhase#1#2#3{% |
| 821 |
/P #1 def % période (10 unités) |
| 822 |
/A #2 def % amplitude |
| 823 |
/F #3 180 div 3.14 mul def |
| 824 |
/O 360 P div def % pulsation 2*pi/P |
| 825 |
/x0 t def |
| 826 |
/y0 t F add O mul sin A mul def % A*sin(O*t) |
| 827 |
/dx dt def |
| 828 |
/dy t F add dt add O mul sin |
| 829 |
t F add O mul sin |
| 830 |
sub |
| 831 |
A mul def } |
| 832 |
\begin{center} |
| 833 |
\psset{unit=0.5} |
| 834 |
\begin{pspicture}(0,-4)(30,4) |
| 835 |
\def\motif{% |
| 836 |
\psclip{\psframe[linestyle=none,dimen=inner](0,-3)(10,3)}% |
| 837 |
\psthick[stylethick=thicklineblue]{-1}{11}{\SinusPhase{10}{2}{90}}% bleu |
| 838 |
\psthick[stylethick=thicklinejaune,E=0.5]{-1}{11}{\SinusPhase{10}{1.25}{-100}}% jaune |
| 839 |
\psthick{-1}{11}{\SinusPhase{10}{2}{0}}% rose |
| 840 |
%1-bleu dans intersection rose et bleu |
| 841 |
\psclip{\psthick[stylethick=vide,E=1.1]{-1}{11}{\SinusPhase{10}{2}{0}}}% rose |
| 842 |
\psthick[stylethick=thicklineblue]{0}{3}{\SinusPhase{10}{2}{90}}% bleu |
| 843 |
\endpsclip% |
| 844 |
% |
| 845 |
\psclip{\psthick[stylethick=vide,E=1.1]{0}{11}{\SinusPhase{10}{2}{90}}}% bleu |
| 846 |
\psthick{5}{9}{\SinusPhase{10}{2}{0}}% rose |
| 847 |
\endpsclip% |
| 848 |
% |
| 849 |
\psclip{\psthick[stylethick=vide,E=0.6]{0}{11}{\SinusPhase{10}{1.25}{-100}}}% jaune |
| 850 |
\psthick[stylethick=thicklineblue]{7}{9}{\SinusPhase{10}{2}{90}}% bleu |
| 851 |
\endpsclip% |
| 852 |
% |
| 853 |
\psclip{\psthick[stylethick=vide,E=1.1]{0}{10}{\SinusPhase{10}{2}{0}}}% rose |
| 854 |
\psthick[stylethick=thicklinejaune,E=0.5]{7}{11}{\SinusPhase{10}{1.25}{-100}}% jaune |
| 855 |
\endpsclip% |
| 856 |
% |
| 857 |
\psclip{\psthick[stylethick=vide,E=1.1]{0}{11}{\SinusPhase{10}{2}{0}}}% rose |
| 858 |
\psthick[stylethick=thicklinejaune,E=0.5]{-0.5}{1}{\SinusPhase{10}{1.25}{-100}}% jaune |
| 859 |
\endpsclip% |
| 860 |
\endpsclip}% |
| 861 |
\motif\rput(10,0){\motif}\rput(20,0){\motif} |
| 862 |
\psline[linewidth=0.1](0,3)(30,3) |
| 863 |
\psline[linewidth=0.1](0,-3)(30,-3) |
| 864 |
\end{pspicture} |
| 865 |
\end{center} |
| 866 |
|
| 867 |
\section{Les limites de la commande \/\texttt{psthick}} |
| 868 |
Si l'épaisseur est trop grande par rapport au rayon de courbure, il apparaît le |
| 869 |
phénomène suivant(points de rebroussement)~: |
| 870 |
|
| 871 |
\begin{center} |
| 872 |
\psset{unit=0.5} |
| 873 |
\begin{pspicture}(0,-6)(10,6) |
| 874 |
\psthick[E=2,stylethick=default,plotpoints=720]{0}{10}{\fonctionSinus{5}{5}}% |
| 875 |
\parametricplot[linestyle=dashed,plotpoints=720,linecolor=red]{0}{10}{% |
| 876 |
/P 5 def % période (5 unités) |
| 877 |
/A 5 def % amplitude |
| 878 |
/O 360 P div def |
| 879 |
t O t mul sin A mul } |
| 880 |
\psaxes[Dx=10,Dy=5](0,0)(0,-5)(10,5) |
| 881 |
\end{pspicture} |
| 882 |
\hspace{2cm}% |
| 883 |
\begin{pspicture}(0,-6)(10,6) |
| 884 |
\parametricplot[plotpoints=720,linewidth=2]{0}{10}{% |
| 885 |
/P 5 def % période (5 unités) |
| 886 |
/A 5 def % amplitude |
| 887 |
/O 360 P div def |
| 888 |
t O t mul sin A mul } |
| 889 |
\psaxes[Dx=10,Dy=5](0,0)(0,-5)(10,5) |
| 890 |
\end{pspicture} |
| 891 |
\end{center} |
| 892 |
|
| 893 |
À droite la courbe obtenue avec la commande classique \Lkeyword{linewidth}=2 |
| 894 |
qui avec un pinceau de peinture noire de largeur 2~cm efface ces points. |
| 895 |
|
| 896 |
\begin{lstlisting} |
| 897 |
\begin{pspicture}(0,-6)(10,6) |
| 898 |
\psthick[E=2,stylethick=default,plotpoints=720]{0}{10}{\fonctionSinus{5}{5}}% |
| 899 |
\end{pspicture} |
| 900 |
\hfill |
| 901 |
\begin{pspicture}(0,-6)(10,6) |
| 902 |
\parametricplot[plotpoints=720,linewidth=2]{0}{10}{% |
| 903 |
/P 5 def % periode (5 unites) |
| 904 |
/A 5 def % amplitude |
| 905 |
/O 360 P div def |
| 906 |
t O t mul sin A mul } |
| 907 |
\end{pspicture} |
| 908 |
\end{lstlisting} |
| 909 |
|
| 910 |
On peut en combinant les deux méthodes arriver à ``gommer'' ces points intérieurs |
| 911 |
de rebroussement tout en gardant le contour. |
| 912 |
|
| 913 |
\begin{center} |
| 914 |
\psset{unit=0.5} |
| 915 |
\begin{pspicture}(0,-6)(10,6) |
| 916 |
\psthick[curveonly,E=2,stylecurve2=onlythecurveblue,linewidth=0.2,plotpoints=720]{0}{10}{\fonctionSinus{5}{5}}% |
| 917 |
\parametricplot[plotpoints=720,linewidth=2,linecolor=yellow]{0}{10}{% |
| 918 |
/P 5 def % periode (5 unités) |
| 919 |
/A 5 def % amplitude |
| 920 |
/O 360 P div def |
| 921 |
t O t mul sin A mul |
| 922 |
} |
| 923 |
\psaxes[Dx=10,Dy=5](0,0)(0,-5)(10,5) |
| 924 |
\end{pspicture} |
| 925 |
\end{center} |
| 926 |
|
| 927 |
\begin{lstlisting} |
| 928 |
\begin{pspicture}(0,-6)(10,6) |
| 929 |
\psthick[curveonly,E=2,stylecurve2=onlythecurveblue,linewidth=0.2]{0}{10}{\fonctionSinus{5}{5}}% |
| 930 |
\parametricplot[plotpoints=720,linewidth=2,linecolor=yellow]{0}{10}{% |
| 931 |
/P 5 def % periode (5 unites) |
| 932 |
/A 5 def % amplitude |
| 933 |
/O 360 P div def |
| 934 |
t O t mul sin A mul } |
| 935 |
\psaxes[Dx=10,Dy=5](0,0)(0,-5)(10,5) |
| 936 |
\end{pspicture} |
| 937 |
\end{lstlisting} |
| 938 |
|
| 939 |
|
| 940 |
\clearpage |
| 941 |
\section{List of all optional arguments for \texttt{pst-am}} |
| 942 |
|
| 943 |
\xkvview{family=pst-thick,columns={key,type,default}} |
| 944 |
|
| 945 |
\nocite{*} |
| 946 |
\bgroup |
| 947 |
\RaggedRight |
| 948 |
\bibliographystyle{plain} |
| 949 |
\bibliography{pst-thick-doc} |
| 950 |
\egroup |
| 951 |
|
| 952 |
\printindex |
| 953 |
|
| 954 |
|
| 955 |
\end{document} |
| 956 |
\begin{lstlisting} |
| 957 |
\end{lstlisting} |