\listfiles \documentclass[a4paper,fleqn]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsmath,amssymb} \usepackage[frenchb]{babel} %\usepackage{mathptmx} \usepackage[charter]{mathdesign} \usepackage[margin=2.5cm]{geometry} \usepackage{multicol} \usepackage{listings} \usepackage[svgnames]{xcolor} \usepackage{showexpl} \usepackage[nomessages]{fp} \usepackage{xspace} \usepackage{pst-plot,pst-solides3d,pst-anamorphosis-add,pst-3d} \usepackage{pst-grad} \usepackage[absolute,notitlepage]{pst-abspos} \usepackage{url} \psset{path=C:/Dokumente und Einstellungen/Besitzer/Desktop/bergen/bergen/} %\def\epsRoot{C:/Dokumente und Einstellungen/Besitzer/Desktop/bergen/bergen/} \renewcommand{\ttdefault}{lmtt} \definecolor{syracuseGRIS}{HTML}{C1C1C1} \definecolor{syracuseVERT}{HTML}{029235} \definecolor{sepia}{rgb}{1,0.8,0.8} \definecolor{grisclair}{rgb}{0.8,0.8,0.8} \definecolor{BleuCiel}{cmyk}{0.2,0,0,0} \definecolor{OrangePale}{cmyk}{0,0.2,0.4,0} \lstset{% language=[LaTeX]TeX,% float=hbp,% basicstyle=\ttfamily\small, % texcsstyle=*\color{blue},% identifierstyle=\color{black}, % keywordstyle=\color{syracuseVERT}, % otherkeywords={$, \{, \}, \[, \]}, stringstyle=\color{syracuseVERT}, % commentstyle=\color{syracuseVERT}, % backgroundcolor=\color{syracuseGRIS!30},% columns=flexible, % tabsize=4, % frame=single, % %frame=shadowbox, % %rulesepcolor=\color{syracuseGRIS!30},% extendedchars=true, % showspaces=false, % showstringspaces=false, % numbers=left, numbersep=0.8em, numberstyle=\tiny, % breaklines=true, % breakautoindent=true,% captionpos=b,% xleftmargin=1em,% sensitive=true,% morekeywords=[6]{pspicture,center},% keywordstyle=[6]\color{FireBrick},% %morekeywords=[7]{(,)},% %keywordstyle=[7]\color{syracuseVERT} } \renewcommand{\lstlistingname}{Source} \renewcommand{\labelitemi}{$\bullet$} \newcommand\cs[1]{\texttt{\char`\\#1}} \newcommand\file[1]{\texttt{#1}} \parindent0pt \parskip5pt \def\syracuseTitle{Les anamorphoses : extensions possibles} %\def\syracuseGraphic{eiffel2} \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}} % %%%%%%%\psframeA --------------------- \def\psframeA{\pst@object{psframeA}} \def\psframeA@i(#1){% \@ifnextchar({\psframeA@ii(#1)}{\psframeA@ii(0,0)(#1)}} \def\psframeA@ii(#1)(#2){% \begin@ClosedObj \pst@getcoor{#1}\pst@tempa% \pst@@getcoor{#2}% \def\pst@linetype{2}% \addto@pscode{% \tx@optionsanamorphosis \tx@optionsanamorphosisAdd \pst@tempa \pst@coor /Y2 ED /X2 ED /Y1 ED /X1 ED X1 Y1 tx@anamorphosisPathDict begin Anamorphose end moveto 0 0.005 1.0 { %(X1,Y1)->(X2,Y1) /K exch def K X2 mul 1 K sub X1 mul add Y1 tx@anamorphosisPathDict begin Anamorphose end lineto } for 0 0.005 1.0 { % (X2,Y1)->(X2,Y2) /K exch def X2 K Y2 mul 1 K sub Y1 mul add tx@anamorphosisPathDict begin Anamorphose end lineto } for 0 0.005 1.0 { % (X2,Y2)->(X1,Y2) /K exch def K X1 mul 1 K sub X2 mul add Y2 tx@anamorphosisPathDict begin Anamorphose end lineto } for 0 0.005 1.0 { % (X1,Y2)->(X1,Y1) /K exch def X1 K Y1 mul 1 K sub Y2 mul add tx@anamorphosisPathDict begin Anamorphose end lineto } for }% \showpointsfalse \end@ClosedObj} % %%%%%%%\translateA --------------------------- \def\translateA{\def\pst@par{}\pst@object{translateA}} \def\translateA@i(#1){{% \pst@@getcoor{#1}% \addto@pscode{ \tx@optionsanamorphosis \tx@optionsanamorphosisAdd \pst@coor tx@anamorphosisPathDict begin Anamorphose end translate}}}% % \begin{document} %% === BEGIN == Page de garde ================================================= \thispagestyle{empty} \pstPutAbs(0,-29.7){% \begin{pspicture}(0,0)(21,29.7) \pspolygon[fillstyle=solid,linecolor=syracuseVERT,fillcolor=syracuseVERT](0,0)(10.5,14.85)(21,0) \pspolygon[fillstyle=solid,linecolor=syracuseGRIS,fillcolor=syracuseGRIS](0,0)(21,29.7)(0,29.7) \pspolygon[fillstyle=solid,linecolor=syracuseGRIS!50,fillcolor=syracuseGRIS!50](21,0)(10.5,14.85)(21,29.7) \end{pspicture} } \pstPutAbs(2.5,-3.75){% \includegraphics[scale=1]{pst-anamorphosis} } \pstPutAbs(2.5,-5.25){% \LARGE \textbf{\syracuseTitle} } \pstPutAbs(2.5,-13.5){% \begin{pspicture}(0,0)(12,12) \rput(4,4){\includegraphics[height=8cm]{Eiffel}} %\rput(4,4){\includegraphics[height=8cm]{\syracuseGraphic}} %\psframe(0,0)(8,8) \end{pspicture} } \pstPutAbs(12.5,-15){% \parbox{0.4\textwidth}{\Large\raggedleft {\LARGE\textbf{Contributeurs}}\\[0.2cm] J\"{u}rgen \textsc{Gilg}\\ Manuel \textsc{Luque}\\ Jean-Michel \textsc{Sarlat} }} \vfill \begin{center} \textcolor{white}{\textbf{\today}}\\[0.3cm] \textcolor{white}{\url{http://melusine.eu.org/syracuse/G/pst-anamorphosis/}}\\ \includegraphics[scale=0.4]{logo_syracuse} \end{center} %% == END == Page de garde ==================================================== \newpage \begin{abstract} Il est relativement facile d'adapter les commandes de \textsf{PSTricks} \`{a} \textsf{pst-anamorphosis}. C'est ainsi que la plupart des macros de \textsf{pst-anamorphosis-add} sont des adaptations de celles de \textsf{PStricks}. Toutes ne l'on pas \'{e}t\'{e} pour ne pas alourdir inutilement le package. Nous allons d\'{e}tailler sur un exemple la fa\c{c}on de proc\'{e}der. Remarque : toutes les macros ne sont pas adaptables, cela serait le cas si les anamorphoses transformaient une ligne droite en une ligne droite. Or, \`{a} part la perspective, ce n'est pas le cas. En cons\'{e}quence, \verb+\psline+, \verb+\psframe+, \verb+\pspolygon+ doivent \^{e}tre r\'{e}\'{e}crits en divisant le segment initial en un grand nombre de petits segments : pour \verb+\pslineA+ par exemple chaque segment initial est divis\'{e} en 200 parties et ceci quelle que soit sa longueur, dans l'id\'{e}al il faudrait tenir compte de la longueur du segment avant de choisir le nombre de segmentations. \end{abstract} \section{\textbackslash{}psparametricplotA} \subsection{Adaptation} \`{A} partir d'une copie de \textbackslash{}\textsf{psparametricplot} : \begin{enumerate} \item On remplace parout \textsf{psparametricplot} par \textsf{psparametricplotA} ; \item dans le premier \verb+\addto@pscode{%+ \begin{lstlisting} \addto@pscode{% \tx@optionsanamorphosis \tx@optionsanamorphosisAdd #3 %prefix PS code \psplot@init \end{lstlisting} on introduit juste au d\'{e}but les variables de \textsf{pst-anamorphosis} ; \item et pour terminer dans \verb+/xy {+: \begin{lstlisting} /xy { \ifPst@algebraic F@pstplot \else #5 \fi \pst@number\psyunit mul exch \pst@number\psxunit mul exch tx@anamorphosisPathDict begin Anamorphose end } def \end{lstlisting} on ins\`{e}re \`{a} la fin les calculs propres \`{a} l'anamorphose. C'est termin\'{e}, la macro est op\'{e}rationnelle ! \end{enumerate} \subsection{Exemple} \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} \psframeA[linecolor=blue,fillstyle=solid,fillcolor=cyan](1,1)(2,2) \psframeA[linecolor=blue,fillstyle=solid,fillcolor=cyan](-1,-1)(-2,-2) \psframeA[linecolor=blue,fillstyle=solid,fillcolor=cyan](-1,1)(-2,2) \psframeA[linecolor=blue,fillstyle=solid,fillcolor=cyan](1,-1)(2,-2) \psframe[linecolor=blue,fillstyle=solid,fillcolor=cyan](1,1)(2,2) \psframe[linecolor=blue,fillstyle=solid,fillcolor=cyan](-1,-1)(-2,-2) \psframe[linecolor=blue,fillstyle=solid,fillcolor=cyan](-1,1)(-2,2) \psframe[linecolor=blue,fillstyle=solid,fillcolor=cyan](1,-1)(2,-2) \parametricplotA[plotpoints=3600,linecolor=red,linewidth=1mm]{0}{360}{% /Radius 1.5 0.5 t 10 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 10 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} \begin{lstlisting} \parametricplotA[plotpoints=3600,linecolor=red,linewidth=1mm]{0}{360}{% /Radius 1.5 0.5 t 10 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 10 mul sin mul add def Radius t cos mul Radius t sin mul \end{lstlisting} \section{\textbackslash{}psframeA} \verb+\psframeA(x1,y1)(x2,y2)+ a les m\^{e}mes propri\'{e}t\'{e}s que \verb+\psframe+ \begin{center} \begin{pspicture}(-6,-6)(6,6.5) \psset{type=conical,Rmirror=3} \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](-0.25,-0.25)(-0.01,-0.01) \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](-0.25,0.25)(-0.01,0.01) \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](0.01,0.01)(0.25,0.25) \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](0.01,-0.01)(0.25,-0.25) \multido{\ry=-2.75+1,\rY=-2.25+1}{6}{ \multido{\n=-2.75+1.00,\N=-2.25+1.00}{7}{% \psframeA[fillstyle=solid,fillcolor=red,linecolor=red](\n,\ry)(\N,\rY)} } \multido{\ry=-3.25+1,\rY=-2.75+1}{3}{ \multido{\n=-3.25+1.00,\N=-2.75+1.00}{7}{% \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](\n,\ry)(\N,\rY)} } \multido{\ry=0.75+1,\rY=1.25+1}{3}{ \multido{\n=-3.25+1.00,\N=-2.75+1.00}{7}{% \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](\n,\ry)(\N,\rY)} } \multido{\n=-3.25+1.00,\N=-2.75+1.00}{3}{% \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](\n,-0.25)(\N,0.25)} \multido{\n=0.75+1.00,\N=1.25+1.00}{3}{% \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](\n,-0.25)(\N,0.25)} \begin{psclip}{\pscircle[fillstyle=solid,fillcolor=white,linestyle=none]{3}} \multido{\ry=-2.75+1,\rY=-2.25+1}{6}{ \multido{\n=-2.75+1.00,\N=-2.25+1.00}{6}{% \psframe*[linecolor=red](\n,\ry)(\N,\rY)} } \multido{\ry=-3.25+1,\rY=-2.75+1}{7}{ \multido{\n=-3.25+1.00,\N=-2.75+1.00}{7}{% \psframe*[linecolor=blue](\n,\ry)(\N,\rY)} } \pscircle[doubleline=true]{3} \end{psclip} \end{pspicture} \end{center} \begin{lstlisting} \multido{\ry=-2.75+1,\rY=-2.25+1}{6}{ \multido{\n=-2.75+1.00,\N=-2.25+1.00}{7}{% \psframeA[fillstyle=solid,fillcolor=red,linecolor=red](\n,\ry)(\N,\rY)} } \multido{\ry=-3.25+1,\rY=-2.75+1}{3}{ \multido{\n=-3.25+1.00,\N=-2.75+1.00}{7}{% \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue](\n,\ry)(\N,\rY)} } \end{lstlisting} \section{\textbackslash{}pspolygonA} En r\'{e}alit\'{e} la macro \verb+pspolygonA+ n'a pas \'{e}t\'{e} \'{e}crite. En effet il suffit de servir de \verb+\pslineA+ et de boucler le chemin en revenant au point origine. \begin{center} \begin{pspicture}(-5,-5)(5,5) \psset{type=conical,Rmirror=3} \pspolygon[linecolor=red,linewidth=1mm](2.5;30)(2.5;90)(2.5;150)(2.5;210)(2.5;270)(2.5;330) \pslineA[linecolor=red,linewidth=1mm](2.5;30)(2.5;90)(2.5;150)(2.5;210)(2.5;270)(2.5;330)(2.5;30) \rput(1.25,1){\pspolygon[linecolor=blue,fillstyle=solid,linewidth=1mm,fillcolor={[rgb]{1 0.875 0.5}}](0.75;30)(0.75;90)(0.75;150)(0.75;210)(0.75;270)(0.75;330)} \multido{\i=30+60,\I=1+1}{6}{% \pnode(!\i\space cos 0.75 mul 1.25 add \i\space sin 0.75 mul 1 add){A\I} } \pslineA[linecolor=blue,fillstyle=solid,linewidth=1mm,fillcolor={[rgb]{1 0.875 0.5}}](A1)(A2)(A3)(A4)(A5)(A1) \pscircle[doubleline=true]{3} \psdot[dotstyle=x](0,0) \end{pspicture} \end{center} \begin{lstlisting} \begin{pspicture}(-5,-5)(5,5) \psset{type=conical,Rmirror=3} \pspolygon[linecolor=red,linewidth=1mm](2.5;30)(2.5;90)(2.5;150)(2.5;210)(2.5;270)(2.5;330) \pslineA[linecolor=red,linewidth=1mm](2.5;30)(2.5;90)(2.5;150)(2.5;210)(2.5;270)(2.5;330)(2.5;30) \rput(1.25,1){\pspolygon[linecolor=blue,fillstyle=solid,linewidth=1mm,fillcolor={[rgb]{1 0.875 0.5}}](0.75;30)(0.75;90)(0.75;150)(0.75;210)(0.75;270)(0.75;330)} \multido{\i=30+60,\I=1+1}{6}{% \pnode(!\i\space cos 0.75 mul 1.25 add \i\space sin 0.75 mul 1 add){A\I} } \pslineA[linecolor=blue,fillstyle=solid,linewidth=1mm,fillcolor={[rgb]{1 0.875 0.5}}](A1)(A2)(A3)(A4)(A5)(A1) \pscircle[doubleline=true]{3} \psdot[dotstyle=x](0,0) \end{pspicture} \end{lstlisting} On remarquera que le \verb+\rput(1.25,1)+ doit \^{e}tre remplac\'{e} par un calcul adapt\'{e}. La macro \verb+\rputA+ n'a pas \'{e}t\'{e} d\'{e}finie. \end{document}