X-Git-Url: https://melusine.eu.org/syracuse/G/git/?p=pst-anamorphosis.git;a=blobdiff_plain;f=doc%2Fanamorphose_cylindrique_verticale.tex;fp=doc%2Fanamorphose_cylindrique_verticale.tex;h=fc299403d6129bf6f6d41fa898637cd2118b9b1a;hp=0000000000000000000000000000000000000000;hb=3d50dcaf4523ae589de4270650d4a7b95bacd96d;hpb=55f1efea4238aaec8b4922d2454539f634b08064 diff --git a/doc/anamorphose_cylindrique_verticale.tex b/doc/anamorphose_cylindrique_verticale.tex new file mode 100644 index 0000000..fc29940 --- /dev/null +++ b/doc/anamorphose_cylindrique_verticale.tex @@ -0,0 +1,456 @@ + +\documentclass[12pt]{article} +\usepackage[a4paper,margin=2cm]{geometry} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{amsmath,amssymb} +\usepackage[garamond]{mathdesign} +\usepackage{pst-anamorphosis-add} +\usepackage{pst-solides3d} +\usepackage[colorlinks=true]{hyperref} +\def\Cadre{{% +\multido{\n=-2.0+0.5}{9}{% + \pnode(! \n\space 0){A} + \pnode(! \n\space 5){B} + \psline(A)(B) + \pslineA(A)(B) + } +\multido{\N=0+0.5}{11}{% + \pnode(!-2 \N){A} + \pnode(!2 \N){B} + \pslineA(A)(B) + \psline(A)(B) + }}} +\makeatletter +%% === Echelle pour l'image ----------------------------------------------- +\define@key[psset]{pst-solides3d}{unitPicture}{\edef\psk@solides@unitPicture{#1 }} +\psset{unitPicture=28.45} +%% === nombre de divisions des segments ----------------------------------------------- +\define@key[psset]{pst-solides3d}{divisions}{\edef\psk@solides@divisions{#1 }} +\psset{divisions=10} +%% +\def\psImage{\pst@object{psImage}} +\def\psImage@i{\@ifnextchar({\psImage@ii}{\psImage@ii(0,0)}} +\def\psImage@ii(#1,#2){{% + \ifPst@solidmemory\use@par\else\begin@ClosedObj\fi% +\addto@pscode{ +%% === adapté de Jean-Michel Sarlat dans pst-anamorphosis ---------------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% === 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) ---------------- +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/tx@projectionDict 20 dict def +tx@projectionDict begin +/moveto { + /s@y ED /s@x ED /c@x s@x def /c@y s@y def + s@x unit_image div + s@y unit_image div + 2 copy + sinPhi mul neg exch cosPhi mul add % x' + 3 1 roll + cosPhi mul exch sinPhi mul add % y' + /Ypoint exch def + /Xpoint exch def + projectionimage + MOVETO +} bind def +/lineto { + /c@yt ED /c@xt ED /dx c@xt c@x sub ND div def /dy c@yt c@y sub ND div def + 1 1 ND {dup dx mul c@x add exch dy mul c@y add +%/Ypoint exch unit_image div def +%/Xpoint exch unit_image div def + unit_image div exch + unit_image div exch + 2 copy + sinPhi mul neg exch cosPhi mul add % x' + 3 1 roll + cosPhi mul exch sinPhi mul add % y' + /Ypoint exch def + /Xpoint exch def + projectionimage + 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 NDC { + NDC 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 + unit_image div exch + unit_image div exch + 2 copy + sinPhi mul neg exch cosPhi mul add % x' + 3 1 roll + cosPhi mul exch sinPhi mul add % y' + /Ypoint exch def + /Xpoint exch def + projectionimage + LINETO + } for + /c@x c@xt def /c@y c@yt def +} bind def +end +%%%%%%%%%%%%%%%%%%%% fin %%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/Atan { /atan load stopped { pop pop 0 } if } def +save +\tx@optionssolides + SolidesDict begin +/cm {\pst@number\psunit mul } bind def +/cm_1 {\pst@number\psunit div } bind def +/unit_image \psk@solides@unitPicture def +/fichier (\pst@solides@file) def +/Normale {\pst@solides@normal\space unitaire3d } bind def +/ND \psk@solides@divisions def +/NDC {\psk@solides@divisions 3 mul} bind def +/origin {\pst@solides@origin\space } def +/cosPhi {phi cos} bind def +/sinPhi {phi sin} bind def +Normale +/nz exch def +/ny exch def +/nx exch def +/Phi {90 nz arccos sub} bind def +/Theta {ny nx Atan} bind def +/sinT {Theta sin} bind def +/cosT {Theta cos} bind def +/sinP {Phi sin} bind def +/cosP {Phi cos} bind def +origin + /zO' exch def + /yO' exch def + /xO' exch def +/projectionimage { +% projection sur le plan +Xpoint sinT mul neg Ypoint sinP cosT mul mul sub xO' add % x' +Xpoint cosT mul Ypoint sinP mul sinT mul sub yO' add % y' +Ypoint cosP mul zO' add % z' +3dto2d % + } def + projectionsifacevisible not origin Normale planvisible? or { + /showpage {} def +gsave +tx@projectionDict begin +#1 sinT mul neg #2 sinP cosT mul mul sub +#1 cosT mul #2 sinP mul sinT mul sub +#2 cosP mul +3dto2d +translate +fichier run +end +grestore + } if +end +restore +}% + \ifPst@solidmemory\else\end@ClosedObj\fi}\ignorespaces% +} +\makeatother +\parindent=0pt +\title{Anamorphose cylindrique : l'image dans le cylindre est vue verticalement} +\date{6 avril 2013} +\begin{document} +\maketitle +C'est un complément au package `\textsf{pst-anamorphosis}'\footnote{\url{http://melusine.eu.org/syracuse/G/pst-anamorphosis/doc/}} qui traite déjà de l'anamorphose cylindrique dans le cas où l'image vue est dans un plan horizontal. + +Les calculs sont identiques à ceux de l'anamorphose 3D\footnote{\url{http://manuel.luque.perso.neuf.fr/Anamorphoses/anamorphose3D/}}. Si l'on suppose que l'image doit être vue dans le plan $Oyz$ il suffit donc de faire $x_P=0$. + +Objet et image obéissent aux lois de la réflexion de l'optique géométrique : +\begin{itemize} + \item rayon incident et rayon réfléchi appartiennent à un même + plan ; + \item rayon incident et rayon réfléchi sont symétriques par + rapport à la normale au miroir au point d'incidence. +\end{itemize} +L'image non déformée (celle qui est vue dans le miroir) est +placée, dans cet exemple, au centre du miroir. Un rayon incident partant de +l'objet anamorphique se réfléchit sur le miroir et après réflexion +parvient à l'{\oe}il de notre observateur. L'observateur a +l'illusion que le rayon provient du point image. +Il faut donc reconstruire mathématiquement la marche d'un tel +rayon lumineux en partant de l'image dans le miroir.\par +L'observateur est suffisamment éloigné du miroir pour pouvoir être +considéré comme ponctuel. +\section{Les calculs} +Soit $P$ un point de l'image, $V$ l'{\oe}il de l'observateur. Traçons un +droite $PV$ et déterminons le point d'intersection $I$ avec le +cylindre : c'est le point d'incidence.\par +$V(x_V,y_V,z_V)$ et $P(x_P,y_P,z_P)$\par +L'équation paramétrique de la droite $(PV)$ s'écrit $\overrightarrow{IV}=\rho\overrightarrow{PV}$: +$$\left\lbrace + \begin{array}{lcl} + x_V-x_I&=&\rho x_V\\ + y_V-y_I&=&\rho(y_V-y_P)\\ + z_V-z_I&=&\rho(z_V-z_P) + \end{array} + \right. + \Longrightarrow + \left\lbrace + \begin{array}{lcl} + x_I&=&x_V(1-\rho)\\ + y_I&=&y_V(1-\rho)+\rho y_P\\ + z_I&=&z_V(1-\rho)+\rho z_P + \end{array} + \right. + $$ +Le point $I$ appartenant au cylindre, ses coordonnées vérifient la +relation : +$$x_I^2+y_I^2=R$$ +Après développement, on obtient l'équation du second degré en $\rho$~: +$$a\rho^2+2b'\rho+c=0$$ avec : + $$\left\lbrace + \begin{array}{l} + a=x_V^2+(y_V+y_P)^2\\ + b'=x_Vx_P+y_Vy_P-x_V^2-y_V^2\\ + c=x_V^2+y_V^2-R^2 + \end{array} + \right. + $$ +La résolution de cette équation nous donne les solutions +classiques: +$$\left\lbrace + \begin{array}{l} + \rho'=\dfrac{-b'+\sqrt{\Delta'}}{a}\\ + \rho''=\dfrac{-b'-\sqrt{\Delta'}}{a} + \end{array} + \right. + \qquad \Delta'=b'^2-ac + $$ +On retiendra la plus petite valeur positive des deux, que par la suite j'appelle $\rho$. +\par +$IV$ représente le rayon réfléchi par le miroir. Le rayon incident est +défini par la droite symétrique de $IV$ par rapport à la normale +au miroir en $I$. Je cherche le symétrique de $V$, nommé $V'$ par rapport à +cette normale $IN$. Ce point $V'$ remplit deux conditions : +\begin{enumerate} + \item $\overrightarrow{IV}+\overrightarrow{IV'}=k\overrightarrow{IN}$ + \item $\overrightarrow{VV'}.\overrightarrow{IN}=0$ +\end{enumerate} +La normale $(IN)$ a pour vecteur directeur +$\overrightarrow{IN}(x_I,y_I,0)$\\ +La première condition se traduit par : +$$\left\lbrace + \begin{array}{l} + x_V-x_I+x_{V'}-x_I=kx_I\\ + y_V-x_I+y_{V'}-y_I=ky_I\\ + z_V-z_I+z_{V'}-z_I=0 + \end{array} + \right. + \Longrightarrow + \left\lbrace + \begin{array}{l} + x_{V'}=kx_I+2x_I-x_V\\ + y_{V'}=ky_I+2y_I-y_V\\ + z_{V'}=2z_I-z_V + \end{array} + \right. + $$ +La deuxième par : +$$(x_{V'}-x_V)x_I+(y_{V'}-y_V)y_I=0$$ +En remplaçant $x_{V'}$ et $y_{V'}$ tirés de la première condition +dans la deuxième : +$$k(x_I^2+y_I^2)+2x_I^2-2x_Vx_I+2y_I^2-2y_Vy_I=0$$ +$$kR^2+2R^2=2(x_Vx_I+y_Vy_I)$$ +$$k+2=\dfrac{2}{R^2}(x_Vx_I+y_Vy_I)$$ +Les coordonnées de $V'$ s'en déduisent : +$$ \left\lbrace + \begin{array}{l} + x_{V'}=(k+2)x_I-x_V\\ + y_{V'}=(k+2)y_I-y_V\\ + z_{V'}=z_V(1-2\rho) + \end{array} + \right. + $$ +Il reste à trouver l'intersection de $(IV')$ avec le plan +horizontal $z=0$.\par +\'Equation paramétrique de $IV'$, M étant un point courant : +$\overrightarrow{MV'}=\alpha\overrightarrow{IV'}$ +$$ \left\lbrace + \begin{array}{l} + x_{V}'-x=\alpha(x_{V'}-x_I)\\ + y_{V'}-y=\alpha(y_{V'}-y_I)\\ + z_{V'}-z=\alpha(z_{V'}-z_I) + \end{array} + \right. + $$ +$z=0\Longrightarrow \alpha=\dfrac{z_{V'}}{z_{V'}-z_I}$ soit +$$\alpha=\dfrac{(1-2\rho)z_V+\rho z_P}{-\rho z_V+\rho z_P}$$ +En remplaçant $\alpha$ par son expression, nous obtenons les coordonnées du point de l'objet +anamorphique. +$$ \left\lbrace + \begin{array}{l} + x=x_{V'}-\alpha(x_{V'}-x_I)\\ + y=y_{V'}-\alpha(y_{V'}-y_I) + \end{array} + \right. + $$ +Cette série de calculs doit être appliquée à tous les points de +l'image « normale » afin d'obtenir l'objet anamorphique (déformé) +dont le miroir « redressera » la forme. + +On notera que la position en hauteur de l'observateur $z_V$ intervient dans le coefficient $\alpha$. + +%\begin{verbatim} +% /Zp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def +% /a Xv Xp sub dup mul Yv dup mul add def +% /b Xv Xp mul 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 +% /rho1 b neg d sub a div def +% /rho2 b neg d add a div def +% rho2 rho1 ge {/rho rho1 def}{/rho rho2 def} ifelse +% /xi Xv dup Xp sub rho mul sub def +% /yi Yv 1 rho sub mul def +% /zi Zv dup Zp sub rho mul sub def +% /alpha 2 zi mul Zv sub zi Zv sub div 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 +%\end{verbatim} + +\begin{center} +\begin{pspicture}(-8,-8)(10,6) +\psframe(-8,-8)(10,6) +\psset{viewpoint=100 -20 40 rtp2xyz,Decran=60,lightsrc=viewpoint} +\psSolid[object=plan, + definition=normalpoint, + args={0 0 0 [1 0 0 90]}, + action=draw,linecolor=red, +% planmarks, +% showBase, + base=-11 11 0 6] +\psSolid[object=plan, + definition=normalpoint, + args={0 0 0 [0 0 1 -90]}, + action=draw,linecolor=red, +% planmarks, +% showBase, + base=-11 11 -8 13] +\psset{solidmemory} +\psImage[file=sylvestreA4.eps,normal=0 0 1,origine=0 0 0,divisions=2,unitPicture=23](0,7) +\defFunction[algebraic]{Cylindre}(t){2*cos(t)}{2*sin(t)}{0} +\psSolid[object=cylindre,function=Cylindre,%unit=0.035, + range=1.57 4.71, + axe=0 0 1,h=6, + ngrid=1 42,grid, + incolor=yellow!50, + linecolor=blue!20, + fillcolor=blue!20](0,0,0) +\multido{\n=-2.0+0.5}{9}{\psLineIIID(0,\n,0)(0,\n,5)} +\multido{\nz=0.0+0.5}{11}{\psLineIIID(0,-2,\nz)(0,2,\nz)} +\psImage[file=sylvestre.eps,normal=1 0 0,origine=0 0 0,divisions=5](0,2.5) +\defFunction[algebraic]{Cylindre}(t){2*cos(t)}{2*sin(t)}{0} +\psSolid[object=cylindre,function=Cylindre, + range=-1.57 1.57,opacity=0.2, + axe=0 0 1,h=6, + ngrid=1 42,grid, + incolor=yellow!50, + linecolor=blue!20, + fillcolor=blue!20](0,0,0) +\psSolid[object=plan, + definition=equation, + args={[0 0 1 -6]}, + action=none, + name=monplan] +\psProjection[object=cercle,plan=monplan, + args=0 0 2, + range=0 360] +\psSolid[object=plan, + definition=equation, + args={[0 0 1 0]}, + action=none, + name=monPlan] +\psProjection[object=cercle,plan=monPlan, + linestyle=dotted, + args=0 0 2, + range=0 360] +\psLineIIID[linecolor=red](0,-11,6)(0,11,6)%} +\axesIIID(0,0,0)(14,14,7) +\end{pspicture} +\end{center} +\section{Le nouveau paramètre} +Pour garder la compatibilité avec le package `\textsf{pst-anamorphosis}', une nouvelle option a été rajoutée \colorbox{yellow}{\texttt{type=cylindricalV}}. +\begin{center} +\psscalebox{0.75}{ +\begin{pspicture}(-11,-12)(11,7) +\pscircle{2} +\rput(0,6){\parbox{4cm}{Cette image est en \\ + réalité perpendiculaire au plan de la figure}} +\psset{Yv=-15,Xv=0,Zv=15,type=cylindricalV,Rmirror=2} +\Cadre +\psanamorphosis[drawanamorphosis=true](0,2.5){sylvestre.eps} +\end{pspicture}} +\end{center} +\begin{verbatim} +\begin{pspicture}(-11,-12)(11,7) +\pscircle{2} +\rput(0,6){\parbox{4cm}{Cette image est en \\réalité perpendiculaire au plan de la figure}} +\psset{Yv=-15,Xv=0,Zv=15,type=cylindricalV,Rmirror=2} +\Cadre +\psanamorphosis[drawanamorphosis=true](0,2.5){sylvestre.eps} +\end{pspicture} +\end{verbatim} + +Une autre option a encore été rajoutée permettant de placer ou non l'image vue dans le cylindre : \colorbox{yellow}{\texttt{image}}. +\newpage +\section{Un autre exemple} +La carte est extraite du jeu proposé par \url{http://sourceforge.net/projects/vector-cards/?source=dlp}. +\begin{center} +\psscalebox{0.66}{ +\begin{pspicture}(-10,-12)(10,9) +\pscircle[doubleline=true]{2} +\psset{Yv=-15,Xv=0,Zv=15,type=cylindricalV,Rmirror=2} +\psanamorphosis[drawanamorphosis=true,scale=0.6 0.6](0,0){KH_2.eps} +{% +\psset{linestyle=dotted,linecolor=red} +\multido{\n=-2+0.5}{9}{% + \pnode(! \n\space 0){A} + \pnode(! \n\space 5.5){B} + \psline(A)(B) + \pslineA(A)(B) + } +\multido{\N=0.0+0.5}{12}{% + \pnode(!-2 \N){A} + \pnode(!2 \N){B} + \pslineA(A)(B) + \psline(A)(B) + }} +\rput(0,6.5){\parbox{4cm}{Cette carte est en \\réalité perpendiculaire au plan de la figure}} +\end{pspicture}} +\end{center} +\begin{verbatim} +\begin{pspicture}(-10,-12)(10,12) +\pscircle[doubleline=true]{2} +\psset{Yv=-15,Xv=0,Zv=15,type=cylindricalV,Rmirror=2} +\psanamorphosis[drawanamorphosis=true,scale=0.6 0.6](0,0){KH_2.eps} +{% +\psset{linestyle=dotted,linecolor=red} +\multido{\n=-2+0.5}{9}{% + \pnode(! \n\space 0){A} + \pnode(! \n\space 5.5){B} + \psline(A)(B) + \pslineA(A)(B) + } +\multido{\N=0.0+0.5}{12}{% + \pnode(!-2 \N){A} + \pnode(!2 \N){B} + \pslineA(A)(B) + \psline(A)(B) + }} +\end{pspicture} +\end{verbatim} +\end{document} \ No newline at end of file