mercredi 5 mars 2014

Thomas Söll : une application de pst-perspective

Une application du package pst-perspective de Thomas : une église joliment dessinée :



Le package pst-perspective est disponible sur le serveur du CTAN :

Concernant le dessin de l'église, voici le listing du fichier source :

\documentclass{article}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor} %% Farben sind im Dokument xcolor.pdf definiert
\usepackage[distiller,rgb]{pstricks}
\usepackage{multido,pst-grad,pst-eucl,pstricks-add}


\makeatletter  %
\pst@addfams{pst-perspective}
\define@boolkey[psset]{pst-perspective}[Pst@]{translineA}[false]{} % showtransline
\define@boolkey[psset]{pst-perspective}[Pst@]{translineB}[false]{} % showtransline
\define@boolkey[psset]{pst-perspective}[Pst@]{translineK}[true]{} % show transline
\define@boolkey[psset]{pst-perspective}[Pst@]{LowPoint}[false]{} % show transline
\define@key[psset]{pst-perspective}{transcolor}[blue]{\def\psk@transTS@transcolor{#1}}
\define@key[psset]{pst-perspective}{transAcolor}[green]{\def\psk@transTS@transAcolor{#1}}
\define@key[psset]{pst-perspective}{transBcolor}[blue]{\def\psk@transTS@transBcolor{#1}}
\define@key[psset]{pst-perspective}{translinestyle}[solid]{\def\psk@transTS@translinestyle{#1}}
\define@key[psset]{pst-perspective}{transAlinestyle}[dashed]{\def\psk@transTS@transAlinestyle{#1}}
\define@key[psset]{pst-perspective}{transBlinestyle}[dashed]{\def\psk@transTS@transBlinestyle{#1}}
\define@key[psset]{pst-perspective}{translinewidth}[0.8pt]{\def\psk@transTS@translinewidth{#1}}
\define@key[psset]{pst-perspective}{transAlinewidth}[0.7pt]{\def\psk@transTS@transAlinewidth{#1}}
\define@key[psset]{pst-perspective}{transBlinewidth}[0.7pt]{\def\psk@transTS@transBlinewidth{#1}}
\define@key[psset]{pst-perspective}{LowP}[{0|0}]{\def\psk@transTS@LowP{#1}}
\define@key[psset]{pst-perspective}{originT}[{0|0}]{\def\psk@transTS@originT{#1}}
\define@key[psset]{pst-perspective}{base}[0]{\def\psk@transTS@base{#1 }} % y-Wert der Basis f\"{u}r die Transformation
\define@key[psset]{pst-perspective}{phi}[45]{\def\psk@transTS@phi{#1 }}% Winkel f\"{u}r das Schr\"{a}gbild
\define@key[psset]{pst-perspective}{vkf}[0.5]{\def\psk@transTS@vkf{#1 }} % Verk\"{u}rzungsfaktor
\psset[pst-perspective]{phi=45,vkf=0.5,base=0,translineA=false,translineB=false,transAcolor=green,transBcolor=blue,%
transAlinewidth=0.7pt,transBlinewidth=0.7pt,transAlinestyle=dashed,transBlinestyle=dashed,%
translineK=true,transcolor=blue,translinewidth=0.8pt,translinestyle=solid,LowPoint=false,LowP={0,0},originT={0,0}}%
\SpecialCoor%
\def\ba{\psk@transTS@base}
\def\pstransTS{\pst@object{pstpstransTS}}%
%
\def\pstpstransTS@i(#1)#2#3{%
\begingroup%
% (#1) Punkt 1
% #2 Node-Name des Startpunktes % #3 Node-Name des transformierten Punktes
\pst@killglue
\use@par
\rput(\psk@transTS@originT){\pnode(#1){#2}}%
\pst@getcoor{#1}\pst@tempA%
\pst@getcoor{\psk@transTS@LowP}\pst@tempB
\rput(\psk@transTS@originT){\pnode(! %
\pst@tempA \tx@UserCoor /y1 ED /x1 ED
\ifPst@LowPoint
\pst@tempB \tx@UserCoor /y2 ED /x2 ED
\else
/y2 \psk@transTS@base def \fi
/lang y2 y1 sub abs \psk@transTS@vkf mul def
/lang2 y2 y1 sub def
lang2 0 ge {/alph2 \psk@transTS@phi 180 sub def} {/alph2 \psk@transTS@phi def} ifelse
lang alph2 PtoC exch x1 add exch y2 add){#3}
\ifPst@translineA
\ifPst@LowPoint
\pcline[linecolor=\psk@transTS@transAcolor,linestyle=\psk@transTS@transAlinestyle,linewidth=\psk@transTS@transAlinewidth](! \pst@tempA \tx@UserCoor pop \pst@tempB \tx@UserCoor exch pop)(#2)
\else
\pcline[linecolor=\psk@transTS@transAcolor,linestyle=\psk@transTS@transAlinestyle,linewidth=\psk@transTS@transAlinewidth](! \pst@tempA \tx@UserCoor pop \psk@transTS@base)(#2)
\fi
\else \fi%
\ifPst@translineB
\ifPst@LowPoint
\pcline[linecolor=\psk@transTS@transBcolor,linestyle=\psk@transTS@transBlinestyle,linewidth=\psk@transTS@transBlinewidth](! \pst@tempA \tx@UserCoor pop \pst@tempB \tx@UserCoor exch pop)(#3)
\else
\pcline[linecolor=\psk@transTS@transBcolor,linestyle=\psk@transTS@transBlinestyle,linewidth=\psk@transTS@transBlinewidth](! \pst@tempA \tx@UserCoor pop \psk@transTS@base)(#3)
\fi
\else \fi%
}%
\endgroup
\ignorespaces
}
%------------------------------------------------------------------
\def\pstransTSK{\pst@object{pstpstransTSK}}%
\def\pstpstransTSK@i(#1)#2#3#4{%
\begingroup%
% (#1) Koordinaten des Punktes (kartesisch oder Polarkoordinaten)
%  #2  Originall\"{a}nge #3  Node-Name des Startpunktes %  #4   Node-Name des transformierten Punktes
\pst@killglue
\use@par
\rput(#1){\pnode(0,0){#3}}
\rput(#1){\pnode(! %
/l1 #2 def
/l2 l1 \psk@transTS@vkf mul def
l2 \psk@transTS@phi PtoC){#4}}
\ifPst@translineK
\pcline[linecolor=\psk@transTS@transcolor,linestyle=\psk@transTS@translinestyle,linewidth=\psk@transTS@translinewidth](#3)(#4)
\else \fi%
\endgroup
\ignorespaces
}
\makeatother


\begin{document}

\psscalebox{1}{%
\begin{pspicture}[showgrid=false](-0.5,-3)(12,14.4)
\psset{linejoin=2,phi=35,vkf=0.5}
\pstransTSK[translineK=false](-3,0){11}{GR1}{GR1'}
\pstransTSK[translineK=false](11,0){11}{GR2}{GR2'}
\pstransTSK[translineK=false](-3,0){-8}{GR3}{GR3'}
\pstransTSK[translineK=false](11,0){-8}{GR4}{GR4'}
\pspolygon[fillstyle=solid,fillcolor=green!60!black!80,linestyle=none](GR1')(GR2')(GR4')(GR3')

{\psset{base=-3}
\multido{\i=0+1,\n=1+1,\ra=-45+22.5,\rb=-22.5+22.5}{12}{%
\pstransTS[originT={4,3}](6;\ra){D\i}{E\i}
\pstransTS[originT={4,3}](6;\rb){F\n}{G\n}
\pstransTS[originT={4,4}](6;\ra){H\i}{I\i}
\pstransTS[originT={4,4}](6;\rb){J\n}{K\n}
\psline(E\i)(G\n)
\psline(I\i)(K\n)
\pspolygon[fillstyle=solid,fillcolor=gray,opacity=1](E\i)(G\n)(K\n)(I\i)
}}

{\psset{translineK=false}%
\pstransTSK(0,0){1}{A1}{B1}
\pstransTSK(2,0){1}{A2}{B2}
\pstransTSK(2,3){1}{A3}{B3}
\pstransTSK(0,2){1}{A4}{B4}
%----------------------------
\pstransTSK(0,0){6}{A1}{C1}
\pstransTSK(2,0){6}{A2}{C2}
\pstransTSK(2,3){6}{A3}{C3}
\pstransTSK(0,2){6}{A4}{C4}
}
\psline[linestyle=dashed](C1)(C4)
\psline[linestyle=dashed](B1)(C1)(C2)
\pspolygon[fillstyle=solid,fillcolor=green!30,opacity=1](B1)(B2)(B3)(B4)
\pspolygon[fillstyle=solid,fillcolor=green!30,opacity=1](B2)(C2)(C3)(B3)
\pspolygon[fillstyle=vlines*,fillcolor=BrickRed,opacity=1,hatchangle=120,hatchsep=1.5pt](B4)(B3)(C3)(C4)
%----------------------------
\pstransTSK(2,0){6}{A5}{C5}
\pstransTSK(6,0){6}{A6}{C6}
\pstransTSK(6,4){6}{A7}{C7}
\pstransTSK(4,6){6}{A8}{C8}
\pstransTSK(2,4){6}{A9}{C9}
%----------------------------
\pspolygon[fillstyle=solid,fillcolor=yellow!50,opacity=1](C5)(C6)(C7)(C9)
\pspolygon[fillstyle=solid,fillcolor=yellow!50,opacity=1](C7)(C8)(C9)
\pspolygon[fillstyle=solid,fillcolor=yellow!50,opacity=1](A5)(A6)(A7)(A9)
\pspolygon[fillstyle=solid,fillcolor=yellow!50,opacity=1](A6)(C6)(C7)(A7)
\pspolygon[fillstyle=vlines*,fillcolor=BrickRed,opacity=1,hatchangle=135,hatchsep=1.5pt](A9)(A8)(C8)(C9)
\pspolygon[fillstyle=vlines*,fillcolor=BrickRed,opacity=1,hatchangle=45,hatchsep=1.5pt](A7)(C7)(C8)(A8)
\pspolygon[fillstyle=solid,fillcolor=yellow!50,opacity=1](A7)(A8)(A9)
%----------------------------
\pstransTSK(6,0){2}{A10}{C10}
\pstransTSK(8,0){2}{A11}{C11}
\pstransTSK(8,12){2}{A12}{C12}
\pstransTSK(6,12){2}{A13}{C13}
\pstransTSK(8.2,12){-0.2}{A14}{B14}
\pstransTSK(5.8,12){-0.2}{A15}{B15}
\pstransTSK(8.2,12){2.2}{A14}{C14}
\pstransTSK(5.8,12){2.2}{A15}{C15}
\pstransTSK[translineK=false](8,14){2}{A16}{C16}
\pstransTSK[translineK=false](6,14){2}{A17}{C17}
\psIntersectionPoint(A16)(C17)(A17)(C16){SB1}
%----------------------------
\pspolygon[fillstyle=solid,fillcolor=cyan!50,opacity=1](C10)(C11)(C12)(C13)
\pspolygon[fillstyle=solid,fillcolor=cyan!50,opacity=1](A10)(A11)(A12)(A13)
\pspolygon[fillstyle=solid,fillcolor=cyan!50,opacity=1](A11)(C11)(C12)(A12)
\pspolygon[fillstyle=vlines*,fillcolor=BrickRed,opacity=1,hatchangle=45,hatchsep=1.5pt](C14)(C15)(SB1)
\pspolygon[fillstyle=vlines*,fillcolor=BrickRed,opacity=1,hatchangle=45,hatchsep=1.5pt](B15)(C15)(SB1)
\pspolygon[fillstyle=vlines*,fillcolor=BrickRed,opacity=1,hatchangle=45,hatchsep=1.5pt](B14)(B15)(SB1)
\pspolygon[fillstyle=vlines*,fillcolor=BrickRed,opacity=1,hatchangle=45,hatchsep=1.5pt](B14)(C14)(SB1)

{\psset{base=-3}
\multido{\i=0+1,\n=1+1,\ra=-45+22.5,\rb=-22.5+22.5}{3}{%
\pstransTS[originT={4,3}](6;\ra){D\i}{E\i}
\pstransTS[originT={4,3}](6;\rb){F\n}{G\n}
\pstransTS[originT={4,4}](6;\ra){H\i}{I\i}
\pstransTS[originT={4,4}](6;\rb){J\n}{K\n}
\psline(E\i)(G\n)
\psline(I\i)(K\n)
\pspolygon[fillstyle=solid,fillcolor=gray,opacity=1](E\i)(G\n)(K\n)(I\i)
}}

%----------- T\"{u}r --------------------------------------
\pstransTSK[translineK=false](1,0){1}{TL}{TL'}
\rput(TL'){%
\psscalebox{1}{%
\pscustom[fillstyle=solid,fillcolor=brown]{%
\psline(0.2,0)(-0.2,0)(-0.2,0.4)
\psarcn(0.2,0.4){0.4}{180}{120}
\psarcn(-0.2,0.4){0.4}{60}{0}
\closepath%
}
\psline[linewidth=0.5pt](0,0)(0,0.75)
\pscircle[linewidth=0.25pt](0.04,0.35){0.025}
\pscircle[linewidth=0.25pt](-0.04,0.35){0.025}
}}
%----------- T\"{u}r --------------------------------------
\rput(4,0){%
%\psscalebox{2}
{\psset{unit=2}%
\pscustom[fillstyle=solid,fillcolor=brown]{%
\psline(0.2,0)(-0.2,0)(-0.2,0.4)
\psarcn(0.2,0.4){0.4}{180}{120}
\psarcn(-0.2,0.4){0.4}{60}{0}
\closepath%
}
\psline[linewidth=0.5pt](0,0)(0,0.75)
\pscircle[linewidth=0.25pt](0.04,0.35){0.025}
\pscircle[linewidth=0.25pt](-0.04,0.35){0.025}
}}

%------- Uhr -------------------------
\rput(7,6){%
\psscalebox{1.5}{%
\pscircle[fillstyle=solid,fillcolor=lightgray!50](0,2.8){0.25}
\rput(0,2.8){%
\psline{c-c}(0,0)(0.14;50)
\psline{c-c}(0,0)(0.19;-30)
}
}}

%---------- Fenster -----------------------------------
\def\fenster{%
\pscustom[fillstyle=solid,fillcolor=white]{%
\psline(0.1,0)(-0.1,0)(-0.1,0.3)
\psarcn(0.1,0.3){0.2}{180}{120}
\psarcn(-0.1,0.3){0.2}{60}{0}
\closepath%
}}
\rput(3,2){%
\psscalebox{1.5}{\fenster}}
\rput(5,2){%
\psscalebox{1.5}{\fenster}}

%---------- Weg -----------------------------------------
\pstransTSK[translineK=false](3.5,0){-8}{W1}{W1'}
\pstransTSK[translineK=false](4.5,0){-8}{W2}{W2'}
\pspolygon[fillstyle=solid,fillcolor=gray!50,linestyle=none](W1)(W1')(W2')(W2)


{\psset{translineK=false,linestyle=none}
\multido{\i=1+1,\n=1+1}{8}{%
\pstransTSK(3.5,0){1 \i\space sub}{WM1a\i}{WM1a'\i}
\pstransTSK(3.5,0){0.5 \i\space sub}{WM1\i}{WM1'\i}
\pstransTSK(3.75,0){1 \i\space sub}{WM2a\i}{WM2a'\i}
\pstransTSK(3.75,0){0.7 \i\space sub}{WM2\i}{WM2'\i}
\pstransTSK(4.0,0){1 \i\space sub}{WM3a\i}{WM3a'\i}
\pstransTSK(4.0,0){0.5 \i\space sub}{WM3\i}{WM3'\i}
\pspolygon[fillstyle=solid,fillcolor=green!40,opacity=1](WM1a'\i)(WM1'\i)(WM2'\i)(WM2a'\i)
\pspolygon[fillstyle=solid,fillcolor=black!50,opacity=1](WM1'\i)(WM2'\i)(WM3'\i)
\pspolygon[fillstyle=solid,fillcolor=blue!40,opacity=1](WM2a'\i)(WM2'\i)(WM3'\i)(WM3a'\i)
\pstransTSK(4,0){0.5 \n\space sub}{WM4a\n}{WM4a'\n}
\pstransTSK(4,0){-\n}{WM4\n}{WM4'\n}
\pstransTSK(4.25,0){0.5 \n\space sub}{WM5a\n}{WM5a'\n}
\pstransTSK(4.25,0){.2 \n\space sub}{WM5\n}{WM5'\n}
\pstransTSK(4.5,0){0.5 \n\space sub}{WM6a\n}{WM6a'\n}
\pstransTSK(4.5,0){-\n}{WM6\n}{WM6'\n}
\pspolygon[fillstyle=solid,fillcolor=green!40,opacity=1](WM4a'\n)(WM4'\n)(WM5'\n)(WM5a'\n)
\pspolygon[fillstyle=solid,fillcolor=black!50,opacity=1](WM4'\n)(WM5'\n)(WM6'\n)
\pspolygon[fillstyle=solid,fillcolor=blue!40,opacity=1](WM5a'\n)(WM5'\n)(WM6'\n)(WM6a'\n)
}}
\end{pspicture}
}
\end{document}

Aucun commentaire:

Enregistrer un commentaire