From: Manuel Date: Wed, 19 Oct 2011 19:12:54 +0000 (+0200) Subject: Une transformation d'une figure géométrique (sinus autour d'un cercle) dans serie02... X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=commitdiff_plain;h=87a7f47428d63f5a1a7bd977d7501fb01f5e45c3;p=pst-anamorphosis.git Une transformation d'une figure géométrique (sinus autour d'un cercle) dans serie02. J'expérimente \parametricplotA qui est une copie de ce lui de pst-plot à peine modifié. J'ai corrigé une erreur dans \pscircleA : j'ai donc placé la nouvelle versionainsi que toutes les autres pour rappel. --- diff --git a/img/serie02/anamorphosis.pro b/img/serie02/anamorphosis.pro new file mode 100644 index 0000000..698afca --- /dev/null +++ b/img/serie02/anamorphosis.pro @@ -0,0 +1,152 @@ +%! +% 12 octobre 2011 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === Capture de commandes de systemdict -------------------------------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/LINETO { systemdict /lineto get exec } def +/MOVETO { systemdict /moveto get exec } def +/CURVETO { systemdict /curveto get exec } def +/CLOSEPATH { systemdict /closepath get exec } def +/RLINETO { systemdict /rlineto get exec } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === Transformation des commandes de construction des path(s) ---------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% 12/10/2011 : version incomplète et un peu brute ! +/tx@anamorphosisPathDict 50 dict def tx@anamorphosisPathDict begin +/moveto { + /s@y ED /s@x ED /c@x s@x def /c@y s@y def + s@x s@y Anamorphose MOVETO +} bind def +/lineto { + /c@yt ED /c@xt ED /dx c@xt c@x sub 50 div def /dy c@yt c@y sub 50 div def + 1 1 50 {dup dx mul c@x add exch dy mul c@y add Anamorphose LINETO} for + /c@x c@xt def /c@y c@yt def +} bind def +/closepath { + s@x s@y lineto CLOSEPATH +} bind def +/curveto { + /c@yt ED /c@xt ED + /c@yb ED /c@xb ED + /c@ya ED /c@xa ED + 1 1 20 { + 20 div /s ED 1 s sub /t ED + t c@x mul 3 s c@xa mul mul add t mul 3 s s c@xb mul mul mul add t mul s 3 exp c@xt mul add + t c@y mul 3 s c@ya mul mul add t mul 3 s s c@yb mul mul mul add t mul s 3 exp c@yt mul add + Anamorphose LINETO + } for + /c@x c@xt def /c@y c@yt def +} bind def +/curvetoinv { + /c@ya ED /c@xa ED + /c@yb ED /c@xb ED + /c@yt ED /c@xt ED + 1 1 20 { + 20 div /s ED 1 s sub /t ED + t c@x mul 3 s c@xa mul mul add t mul 3 s s c@xb mul mul mul add t mul s 3 exp c@xt mul add + t c@y mul 3 s c@ya mul mul add t mul 3 s s c@yb mul mul mul add t mul s 3 exp c@yt mul add + Anamorphose LINETO + } for + /c@x c@xt def /c@y c@yt def +} bind def +/rlineto { + c@y add exch c@x add exch lineto +} bind def +end +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === L'anamorphose cylindrique ----------------------------------------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/pst-cylindrical { + /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def + /a Xv Xp sub dup mul Yv Yp sub dup mul add def + /b Xv Xp mul Yv Yp mul add Xv dup mul sub Yv dup mul sub def + /c R neg Xv dup mul add Yv dup mul add def + /d b dup mul a c mul sub 0.5 exp def + /rho b neg d sub a div def + /alpha 2 1 rho div sub def + /xi Xv dup Xp sub rho mul sub def + /yi Yv dup Yp sub rho mul sub def + /k 2 Xv xi mul Yv yi mul add mul R div def + /xv k xi mul Xv sub def + /yv k yi mul Yv sub def + xv dup xi sub alpha mul sub + yv dup yi sub alpha mul sub +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === L'anamorphose conique --------------------------------------------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/pst-conical { + /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def + /rP Xp dup mul Yp dup mul add 0.5 exp def + /k Rmirror Zs Zv sub mul Zs rP mul Zv Rmirror mul sub div def + /Xi k Xp mul def + /Yi k Yp mul def + k 0 eq {/Zi Zs def}{/Zi Zv 1 k sub mul def} ifelse + /BETA rP Zv Atan def + /THETA Rmirror Zs Atan def + /ALPHA 90 2 THETA mul sub BETA add def + /rI Xi dup mul Yi dup mul add 0.5 exp def + /KP' Zi ALPHA sin ALPHA cos div div def + /rP' rI KP' add def + rP' Xp rP div mul + rP' Yp rP div mul +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === L'anamorphose spherique --------------------------------------------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/pst-spherical {% + /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def + /rV Xv dup mul Yv dup mul add Zv dup mul add def + /rP Xp dup mul Yp dup mul add def + /A rP rV add Xv Xp mul Yv Yp mul add 2 mul sub def + /B rP neg Xv Xp mul add Yv Yp mul add def + /C rP R sub def + /Discriminant B dup mul A C mul sub 0.5 exp def + /solution1 B neg Discriminant add + A div def + /solution2 B neg Discriminant sub + A div def + solution1 0 gt {/Coeff1 solution1 def}{/Coeff1 solution2 def} + ifelse + /Xi Xp 1 Coeff1 sub mul Coeff1 Xv mul add def + /Yi Yp 1 Coeff1 sub mul Coeff1 Yv mul add def + /Zi Coeff1 Zv mul def + /Coeff2 2 Xv Xi mul Yv Yi mul add Zv Zi mul add mul R div def % k+2 + /Xv2 Coeff2 Xi mul Xv sub def + /Yv2 Coeff2 Yi mul Yv sub def + /Zv2 Coeff2 Zi mul Zv sub def + /Coeff3 Zi Zi Zv2 sub div def + /Ximage Xi Coeff3 Xv2 Xi sub mul add def + /Yimage Yi Coeff3 Yv2 Yi sub mul add def + Ximage Yimage} + def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === La perspective --------------------------------------------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/pst-perspective{ + /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def + Xp xD mul + Yp ua add xD add div % x' + ua yH xD add mul Yp yH mul add + Yp ua add xD add div % y' + } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === La perspective inversee -------------------------------------------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/pst-inverseperspective{ + /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def + Xp ua yH sub mul + Yp yH sub div % x' + ua yH xD add mul ua xD add Yp mul sub + Yp yH sub div % y' + } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === Les commandes ----------------------------------------------------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/Image { + gsave + /showpage {} def + t@@x t@@y translate s@@x s@@y scale + fichier run + grestore +} def diff --git a/img/serie02/exemple_sinus.pdf b/img/serie02/exemple_sinus.pdf new file mode 100644 index 0000000..5f8ff04 Binary files /dev/null and b/img/serie02/exemple_sinus.pdf differ diff --git a/img/serie02/exemple_sinus.tex b/img/serie02/exemple_sinus.tex new file mode 100644 index 0000000..b9ef406 --- /dev/null +++ b/img/serie02/exemple_sinus.tex @@ -0,0 +1,169 @@ +\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} \ No newline at end of file diff --git a/img/serie02/exemple_sinus_conique.png b/img/serie02/exemple_sinus_conique.png new file mode 100644 index 0000000..c73362e Binary files /dev/null and b/img/serie02/exemple_sinus_conique.png differ diff --git a/img/serie02/pst-anamorphosis-add.sty b/img/serie02/pst-anamorphosis-add.sty new file mode 100644 index 0000000..78f33e9 --- /dev/null +++ b/img/serie02/pst-anamorphosis-add.sty @@ -0,0 +1,8 @@ +\RequirePackage{pstricks} +\ProvidesPackage{pst-anamorphosis-add}[2011/10/12 package wrapper for + pst-anamorphosis-add.tex] +\input{pst-anamorphosis-add.tex} +\ProvidesFile{pst-anamorphosis-add.tex} + [\filedate\space v\fileversion\space `PST-anamorphosis-add'] +\endinput +%% End of file `pst-anamorphosis-add.sty'. \ No newline at end of file diff --git a/img/serie02/pst-anamorphosis-add.tex b/img/serie02/pst-anamorphosis-add.tex new file mode 100644 index 0000000..2ccbe12 --- /dev/null +++ b/img/serie02/pst-anamorphosis-add.tex @@ -0,0 +1,391 @@ +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. + +\csname PSTANAMORPHOSISAddLoaded\endcsname +\let\PSTANAMORPHOSISAddLoaded\endinput +% Requires some packages +\ifx\PSTANAMORPHOSISLoaded\endinput\else \input pst-anamorphosis \fi +\ifx\PSTnodesLoaded\endinput\else\input pst-node \fi +\ifx\MultidoLoaded\endinput\else \input multido.tex \fi +\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi +\def\fileversion{0.3} +\def\filedate{2011/10/19} +\message{`PSTANAMORPHOSISAdd' v\fileversion, \filedate} + + +\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax +\SpecialCoor +\psset{dimen=middle} +% +\pst@def{optionsanamorphosisAdd}<% +\psk@Anamorphose@translate + /t@@y exch unit def + /t@@x exch unit def +> + +% Built from \psline +\def\pslineA{\pst@object{pslineA}} +\def\pslineA@i{% +\addto@pscode{ + \tx@optionsanamorphosis + \tx@optionsanamorphosisAdd + }% + \pst@getarrows{% + \begin@OpenObj + \pst@getcoors[\pslineA@ii% + }% +} +\def\pslineA@ii{% + \ifx\pslinestyle\psls@@symbol\addto@pscode{ \psls@symbol SymbolLine }% + \else% + \addto@pscode{ + ] /lespoints ED +/n1 lespoints length 2 div cvi def % nbre de points +/i 0 def +/TableauPoints [ +n1 { + [ lespoints i get + lespoints i 1 add get + ] + /i i 2 add def + }repeat + ] def +% Tableau general des points +/TAB [ +0 1 n1 2 sub {/i ED + TableauPoints i get aload pop + /Y1 ED /X1 ED + TableauPoints i 1 add get aload pop + /Y2 ED /X2 ED +0 0.01 1.0 { % k + /K exch def + [ + K X2 mul 1 K sub X1 mul add + K Y2 mul 1 K sub Y1 mul add + tx@anamorphosisPathDict begin Anamorphose end + ] + } for +} for +] def +/n2 TAB length def +[0 1 n2 1 sub { + /compteur exch def + TAB compteur get aload pop + } for +% \ifPst@noCurrentPoint\else\pst@cp\fi % current point? + \pslineA@iii % arc and lineto type + \tx@Line % .pro function + }% + \fi% + \end@OpenObj% +} +\def\pslineA@iii{ + \ifdim\pslinearc>\z@ + /r \pst@number\pslinearc def + /Lineto { \tx@Arcto } def + \else + /Lineto /lineto load def + \fi + \ifshowpoints true \else false \fi + \tx@setlinejoin % +}% +% +\def\pscircleA{\def\pst@par{}\pst@object{pscircleA}} +\def\pscircleA@i{\@ifnextchar({\pscircleA@do}{\pscircleA@do(0,0)}} +\def\pscircleA@do(#1)#2{% + \begin@ClosedObj + \pst@@getcoor{#1}% + \pssetlength\pst@dimc{#2}% + \def\pst@linetype{4}% + \addto@pscode{ + \tx@optionsanamorphosis + \tx@optionsanamorphosisAdd + \pst@coor /yC exch def /xC exch def + \ifPst@SpecialLength \pst@SpecialLength \else \pst@number\pst@dimc \fi + \psk@dimen CLW mul sub + /rayon exch def + rayon xC add yC + tx@anamorphosisPathDict begin Anamorphose end + moveto + 0 1 360 {/iA exch def + iA cos rayon mul xC add + iA sin rayon mul yC add + tx@anamorphosisPathDict begin Anamorphose end + lineto + } for + \ifPst@variableLW \pst@flattenpath \fi + closepath + }% + \showpointsfalse + \end@ClosedObj + }% +% +\def\psbezierA{\pst@object{psbezierA}} +\def\psbezierA@i{% +\addto@pscode{ + \tx@optionsanamorphosis + \tx@optionsanamorphosisAdd + } + \pst@getarrows{% + \begin@OpenObj + \pst@getcoors[\psbezierA@ii% + }% +} +\def\psbezierA@ii{% + \addto@pscode{ + ] /lespoints ED + [0 2 lespoints length 2 sub {/iP ED + lespoints iP get + lespoints iP 1 add get + tx@anamorphosisPathDict begin Anamorphose end + } for + \ifPst@noCurrentPoint\else\pst@cp\fi + \ifshowpoints true \else false \fi + \ifx\pslinestyle\psls@@symbol \psls@symbol OpenSymbolBezier + \else + \tx@OpenBezier + \ifshowpoints \tx@BezierShowPoints \fi + \fi + }% + \def\pst@linetype{1}% + \ifx\pslinestyle\psls@@symbol\def\pslinestyle{none}\fi% + \end@OpenObj} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\pscurveA{\pst@object{pscurveA}} +\def\pscurveA@i{% +\addto@pscode{ + \tx@optionsanamorphosis + \tx@optionsanamorphosisAdd + } + \pst@getarrows{% + \begin@OpenObj + \pst@getcoors[\pscurveA@ii% \pst@coors on stack + }% +} +\def\pscurveA@ii{% + \addto@pscode{ + ] /lespoints ED + [0 2 lespoints length 2 sub {/iP ED + lespoints iP get + lespoints iP 1 add get + tx@anamorphosisPathDict begin Anamorphose end + } for + \ifPst@noCurrentPoint\else\pst@cp\fi % current point + \psk@curvature\space /c ED /b ED /a ED + \ifshowpoints true \else false \fi + \ifx\pslinestyle\psls@@symbol \psls@symbol OpenSymbolCurve \else \tx@OpenCurve \fi + \ifPst@variableLW \pst@flattenpath \fi + }% + \ifx\pslinestyle\psls@@symbol\def\pslinestyle{none}\fi% + \end@OpenObj% +} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\psccurveA{\pst@object{psccurveA}} +\def\psccurveA@i{% +\addto@pscode{ + \tx@optionsanamorphosis + \tx@optionsanamorphosisAdd + } + \pst@getarrows{% + \begin@OpenObj + \pst@getcoors[\psccurveA@ii% \pst@coors on stack + }% +} +\def\psccurveA@ii{% + \addto@pscode{ + ] /lespoints ED + [0 2 lespoints length 2 sub {/iP ED + lespoints iP get + lespoints iP 1 add get + tx@anamorphosisPathDict begin Anamorphose end + } for + \ifPst@noCurrentPoint\else\pst@cp\fi % current point + \psk@curvature\space /c ED /b ED /a ED + \ifshowpoints true \else false \fi + \ifx\pslinestyle\psls@@symbol \psls@symbol ClosedSymbolCurve \else \tx@ClosedCurve \fi + \ifPst@variableLW \pst@flattenpath \fi + }% + \ifx\pslinestyle\psls@@symbol\def\pslinestyle{none}\fi% + \end@OpenObj% +} +% +\def\pnodeA{\def\pst@par{}\pst@object{pnodeA}} +\def\pnodeA@i(#1)#2{{% +\pst@@getcoor{#1}% +\pnode(! + \tx@optionsanamorphosis + \tx@optionsanamorphosisAdd + \pst@coor + tx@anamorphosisPathDict begin Anamorphose end + \pst@number\psyunit div exch + \pst@number\psxunit div exch + ){#2}}% +\ignorespaces% +} +% +\def\movetoA{\def\pst@par{}\pst@object{movetoA}} +\def\movetoA@i(#1){{% +\pst@@getcoor{#1}% +\addto@pscode{ + \tx@optionsanamorphosis + \tx@optionsanamorphosisAdd + \pst@coor +tx@anamorphosisPathDict begin Anamorphose end + moveto}}}% +% +% choix de la police et de la taille des caracteres en cm !! +\define@key[psset]{pst-anamorphosis}{PSfont}{\def\pst@Anamorphose@PSfont{/#1 }} +\define@key[psset]{pst-anamorphosis}{fontsize}{\def\pst@Anamorphose@fontsize{#1 }} +%\define@key[psset]{pst-anamorphosis}{RotationAngleText}{\edef\psk@Anamorphose@RotationAngleText{#1 }}% +\psset[pst-anamorphosis]{PSfont=Times-Roman,fontsize=35}%,RotationAngleText=0} + +\def\pstextA{\def\pst@par{}\pst@object{pstextA}} +\def\pstextA@i{\@ifnextchar({\pstextA@do}{\pstextA@do(0,0)}} +\def\pstextA@do(#1)#2{% #2 = texte à transformer +\begingroup% + \begin@SpecialObj% + \pst@@getcoor{#1}% +\addto@pscode{ + \pst@coor /t@@y ED /t@@x ED % Translate + \tx@optionsanamorphosis +/fontsize {\pst@Anamorphose@fontsize } bind def +/PSfont {\pst@Anamorphose@PSfont} def +%/RotationAngleText \psk@Anamorphose@RotationAngleText def +%% D'après un fichier original de +%%(c) P. Kleiweg 1997 +%% adapté par : +%% Manuel Luque +%% Arnaud Schmittbuhl +%% Jean-Paul Vignault +%% les commentaires sont de Jean-Paul Vignault +%% juin 2006 +%% Caractères accentués +/ReEncode { exch findfont +dup length dict begin { 1 index /FID eq {pop pop} {def} ifelse +}forall /Encoding ISOLatin1Encoding def currentdict end definefont +pop }bind def +/Font PSfont /ISOfont ReEncode /ISOfont def +%% decalage en picas du texte en +%% dessous de la ligne y=0 +%% la procedure de base pour la transformation des points du chemin + /warp { +3 dict begin + tx@anamorphosisPathDict begin Anamorphose end +end +} bind def +%% pour remplacer 'move' +/warpmove{ + %% on teste le booleen place 2 tokens plus en avant sur la pile + %% si c'est 'true', alors on en est au 1er appel => on initialise + %% le chemin + 2 index { + newpath + } if + %% puis on applique warp a notre point + warp moveto + %% on enleve le 'true' pour mettre un 'false' a la place + pop false +} bind def +%% pour remplacer 'lineto +/warpline { + warp lineto +} bind def +%% pour remplacer 'curveto' +/warpcurve { + 6 2 roll warp + 6 2 roll warp + 6 2 roll warp + curveto +} bind def +%% 'warpit' declenche la transformation du chemin courant +/warpit { +true +{ warpmove } { warpline } { warpcurve } { closepath } pathforall +pop +} bind def +%% definition des differentes constantes +% taille de des caracteres +Font findfont fontsize scalefont setfont +/warptxt (#2) def % texte a deformer +/warpwidth warptxt stringwidth pop def % largeur horizontale du texte +/warphalf warpwidth 2 div def % demi-largeur horizontale +%% le chemin constitue avec la chaine de caracteres +warptxt warphalf neg 0 moveto %% on se deplace (init chemin) +true charpath %% on cree le chemin +%% maintenant on y va +warpit %% on applique le pathforall +gsave +\pst@usecolor\psfillcolor + fill +grestore +stroke +% le texte dans le cercle +t@@x t@@y translate +s@@x s@@y scale +warptxt warphalf neg 0 moveto %% on se deplace (init chemin) +true charpath +gsave +\pst@usecolor\psfillcolor + fill +grestore +stroke + }% + \end@SpecialObj% +\endgroup% +} + + + +%% ============================================================================= +%% AFP : Anamorphose à partir d'un Fichier PST. +%% Le code de pscustom est évalué après reroutage de la macro. Il est exécuté +%% dans le contexte tx@anamorphosisPathDict +%% ============================================================================= +%% Début et Fin +\def\pst@begin@AFP{\xdef\pst@code{\pst@code + tx@anamorphosisPathDict begin + \tx@optionsanamorphosis + \tx@optionsanamorphosisAdd\space}} +\def\pst@end@AFP{\xdef\pst@code{\pst@code end\space}} +%% pscustom adapté à la tâche +\def\pscustomAFP{\def\pst@par{}\pst@object{pscustomAFP}} +\long\def\pscustomAFP@i#1{% + \begin@SpecialObj% + \pst@begin@AFP% + \the\pst@customAFPdefs + \setbox\pst@hbox=\hbox{#1}% + \psk@fillstyle% + \pst@stroke% + \pst@end@AFP% + \end@SpecialObj} +%% pscustomdefs associé +\newtoks\pst@customAFPdefs +\pst@customAFPdefs{% + \def\moveto(#1){\pst@@getcoor{#1}\addto@pscode{\pst@coor moveto}}% + \def\psline(#1){\pst@@getcoor{#1}\addto@pscode{\pst@coor lineto}}% + \def\closepath{\addto@pscode{closepath}}% + \def\newpath{\addto@pscode{newpath}}% + \def\stroke{\def\pst@par{}\pst@object{stroke}}% + \def\fill{\def\pst@par{}\pst@object{fill}}% +} +\def\AFP#1{% + \begingroup + \def\curvetoinv{\pst@getcoors{\space}\fcurvetoinv} + \def\fcurvetoinv{\addto@pscode{curvetoinv}} + \let\SAUVEpscustom\pscustom + \let\SAUVEpsbezier\psbezier + \let\pscustom\pscustomAFP + \let\psbezier\curvetoinv + \input{#1} + \let\psbezier\SAUVEpsbezier + \let\pscustom\SAUVEpscustom + \endgroup% +}% +%%%% Fin de AFP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/img/serie02/pst-anamorphosis.sty b/img/serie02/pst-anamorphosis.sty new file mode 100644 index 0000000..af3cce7 --- /dev/null +++ b/img/serie02/pst-anamorphosis.sty @@ -0,0 +1,12 @@ +\RequirePackage{pstricks} +\ProvidesPackage{pst-anamorphosis}[2011/10/10 package wrapper for + pst-anamorphosis.tex] +\input{pst-anamorphosis.tex} +\IfFileExists{anamorphosis.pro}{% + \ProvidesFile{anamorphosis.pro} + [2011/10/10 v. 0.1, PostScript prologue file] + \@addtofilelist{anamorphosis.pro}}{}% +\ProvidesFile{pst-anamorphosis.tex} + [\filedate\space v\fileversion\space `PST-anamorphosis'] +\endinput +%% End of file `pst-anamorphosis.sty'. \ No newline at end of file diff --git a/img/serie02/pst-anamorphosis.tex b/img/serie02/pst-anamorphosis.tex new file mode 100644 index 0000000..a63dfb7 --- /dev/null +++ b/img/serie02/pst-anamorphosis.tex @@ -0,0 +1,128 @@ +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. + +\csname PSTANAMORPHOSISLoaded\endcsname +\let\PSTANAMORPHOSISLoaded\endinput +% Requires some packages +\ifx\PSTricksLoaded\endinput\else \input pstricks \fi +\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi +\def\fileversion{0.21} +\def\filedate{2011/10/14} +\message{`PSTANAMORPHOSIS' v\fileversion, \filedate} + +\pstheader{anamorphosis.pro} + +\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax +\SpecialCoor +\psset{dimen=middle} + +\pst@addfams{pst-anamorphosis} + +\define@key[psset]{pst-anamorphosis}{Rmirror}{\edef\psk@Anamorphose@Rmirror{#1 }}% +\psset[pst-anamorphosis]{Rmirror=3} +% +%% === Options spécifiques à l'anamorphose cylindrique ------------------------- +\define@key[psset]{pst-anamorphosis}{Xv}{\edef\psk@Anamorphose@Xv{#1 }}% +\define@key[psset]{pst-anamorphosis}{Yv}{\edef\psk@Anamorphose@Yv{#1 }}% +\psset[pst-anamorphosis]{Xv=0,Yv=-10} +% +%% === Options spécifiques à l'anamorphose conique ----------------------------- +\define@key[psset]{pst-anamorphosis}{Zs}{\edef\psk@Anamorphose@Zs{#1 }}% +\define@key[psset]{pst-anamorphosis}{Zv}{\edef\psk@Anamorphose@Zv{#1 }}% +\psset[pst-anamorphosis]{Zs=10,Zv=50} +% +%% === Options spécifiques à l'anamorphose spherique ----------------------------- +\define@key[psset]{pst-anamorphosis}{Zv}{\edef\psk@Anamorphose@Zv{#1 }}% +\psset[pst-anamorphosis]{Zv=10} +% +%% === Options spécifiques à la perspective ----------------------------- +\define@key[psset]{pst-anamorphosis}{ua}{\edef\psk@Anamorphose@ua{#1 }}% +\define@key[psset]{pst-anamorphosis}{F}{\edef\psk@Anamorphose@H{#1 }}% +\define@key[psset]{pst-anamorphosis}{D}{\edef\psk@Anamorphose@D{#1 }}% +\psset[pst-anamorphosis]{ua=2,F=10,D=4} +% +%% === Options scale pour placer une image EPS --------------------- +\define@key[psset]{pst-anamorphosis}{scale}{\edef\psk@Anamorphose@scale{#1 }}% +\psset[pst-anamorphosis]{scale=1 1} +% +%% === Options translate pour placer une image PST--------------------- +\define@key[psset]{pst-anamorphosis}{translate}{\edef\psk@Anamorphose@translate{#1 }}% +\psset[pst-anamorphosis]{translate=0 0} +% +%% === Option pour ne pas dessiner l'image anamorphosée--------------------- +\newif\ifPst@Anamorphose@draw +\define@key[psset]{pst-anamorphosis}{drawanamorphosis}[true]{\@nameuse{Pst@Anamorphose@draw#1}} +\psset[pst-anamorphosis]{drawanamorphosis=true} +% +%% Reservation des noms de macros +% adaptation de la macro de pst-solides3d +% #1=type de reservation associee a une liste qui +% doit forcement etre du type pst@anamorphosis@list@#1 +\def\pst@anamorphosis@reservednames#1{% +\edef\@tempa{\csname pst@anamorphosis@list@#1\endcsname} +\@for \name:=\@tempa\do{% + \expandafter\def\csname pst@anamorphosis@#1@\name\endcsname{}% +}} +% nature de l'anamorphose +\def\pst@anamorphosis@list@type{% + cylindrical,conical,spherical,perspective,inverseperspective} +% +%% Reservation de macros correspondants aux types +\pst@anamorphosis@reservednames{type} +\define@key[psset]{pst-anamorphosis}{type}{% + \ifcsname pst@anamorphosis@type@#1\endcsname + \def\psk@anamorphosis@type{pst-#1}% + \else + \@pstrickserr{The anamorphosis #1 is not defined, the anamorphosis by default is + drawn}{}% + \fi} +% anamorphose par defaut +\psset[pst-anamorphosis]{type=cylindrical}% +% +\pst@def{optionsanamorphosis}<% +/unit {\pst@number\psunit mul } def +/Xv \psk@Anamorphose@Xv unit def +/Yv \psk@Anamorphose@Yv unit def +/Zv \psk@Anamorphose@Zv unit def +/Zs \psk@Anamorphose@Zs unit def +/Rmirror \psk@Anamorphose@Rmirror unit def +/R Rmirror dup mul def +/ua \psk@Anamorphose@ua unit def +/yH \psk@Anamorphose@H unit def +/xD \psk@Anamorphose@D unit def +/Anamorphose {\psk@anamorphosis@type} def +\psk@Anamorphose@scale +% pour tenir d'un changement d'échelle global + /s@@y exch \pst@number\psyunit mul 28.45274 div def + /s@@x exch \pst@number\psxunit mul 28.45274 div def +> + +\def\psanamorphosis{\def\pst@par{}\pst@object{psanamorphosis}} +\def\psanamorphosis@i{\@ifnextchar({\psanamorphosis@do}{\psanamorphosis@do(0,0)}} +\def\psanamorphosis@do(#1)#2{% #1 = fichier.eps à transformer +\begingroup% +\use@par% + \begin@SpecialObj% + \pst@@getcoor{#1}% + \addto@pscode{ + \pst@coor /t@@y ED /t@@x ED % Translate + /fichier (#2) def + \tx@optionsanamorphosis + Image +\ifPst@Anamorphose@draw + tx@anamorphosisPathDict begin + gsave + /showpage {} def + fichier run + grestore + end +\fi + }% + \end@SpecialObj% +\endgroup% +} \ No newline at end of file