1 \documentclass[12pt
]{article
}
2 \usepackage{pst-anamorphosis-add,pst-plot
}
3 \usepackage[T1]{fontenc}
4 \usepackage[ansinew
]{inputenc}
5 \usepackage{amsmath,amssymb
}
6 \usepackage[a4paper]{geometry
}
9 \def\psparametricplotA{\pst@object
{parametricplotA
}}% hv 2008-11-22
10 \def\parametricplotA{\pst@object
{parametricplotA
}}
11 \def\parametricplotA@i
#1#2{\@ifnextchar
[{\parametricplotA@x
{#1}{#2}}{\parametricplotA@x
{#1}{#2}[]}}
12 \def\parametricplotA@x
#1#2[#3]{\@ifnextchar
[{\parametricplotA@xi
{#1}{#2}[#3]}{\parametricplotA@xi
{#1}{#2}[#3][]}}
13 \def\parametricplotA@xi
#1#2[#3][#4]#5{%
17 \@nameuse
{beginplot@
\psplotstyle}%
19 \tx@optionsanamorphosis
20 \tx@optionsanamorphosisAdd
25 /dt t1 t sub
\psk@plotpoints div def
26 /F@pstplot
\ifPst@algebraic (
#5)
27 \ifx\psk@PlotDerivative\@none
\else
28 \psk@PlotDerivative
\space { (t) tx@Derive begin Derive end
} repeat
30 tx@AlgToPs begin AlgToPs end cvx
33 /StillZero
0 def /LastNonZeroStep dt def
34 /F2@pstplot tx@Derive begin (
#5) (t) Derive (t) Derive end
35 \ifx\psk@PlotDerivative\@none
\else
36 \psk@PlotDerivative
\space { (t) tx@Derive begin Derive end
} repeat
38 tx@AlgToPs begin AlgToPs end cvx def
39 %% computation of the tolerance defined by plotpoints
40 /epsilon12
\ifx\psk@VarStepEpsilon\@default
41 tx@Derive begin F2@pstplot end Pyth
43 \else\psk@VarStepEpsilon
\space 12 mul
\fi def
46 { pop StillZero
2 ge
{ LastNonZeroStep
2 mul
} { LastNonZeroStep
} ifelse /StillZero StillZero
1 add def
}
47 { epsilon12 exch div
1 3 div exp /StillZero
0 def
}
51 \ifPst@algebraic F@pstplot
\else #5 \fi
52 \pst@number
\psyunit mul exch
53 \pst@number
\psxunit mul exch
54 tx@anamorphosisPathDict begin Anamorphose end
59 \@nameuse
{testqp@
\psplotstyle}%
60 \if@pst
\parametricplotA@ii
{#4}\else\parametricplotA@iii
{#4}\fi
64 \def\parametricplotA@ii
#1{% para is the post code
67 mark xy \@nameuse
{beginqp@
\psplotstyle}
68 { F2@pstplot Pyth ComputeStep
69 t
2 copy add dup t1 gt
{pop t1
} if /t exch def F2@pstplot Pyth ComputeStep
70 /t
3 -
1 roll def
2 copy gt
{ exch
} if pop
71 /t t
3 -
1 roll add dup t1 gt
{pop t1
} if def
72 xy \@nameuse
{doqp@
\psplotstyle}
73 t t1 eq
{ exit
} if
} loop
}%
77 xy \@nameuse
{beginqp@
\psplotstyle}
78 \psk@plotpoints
1 sub
{
80 xy \@nameuse
{doqp@
\psplotstyle}
85 xy \@nameuse
{doqp@
\psplotstyle}
90 \@nameuse
{endqp@
\psplotstyle}}
92 \def\parametricplotA@iii
#1{%
97 { xy n
2 roll F2@pstplot Pyth
98 ComputeStep t
2 copy add dup t1 gt
{pop t1
} if
99 /t exch def F2@pstplot Pyth ComputeStep
100 /t
3 -
1 roll def
2 copy gt
{ exch
} if pop
101 /t t
3 -
1 roll dup /LastNonZeroStep exch def add dup t1 gt
{pop t1
} if def /n n
2 add def
102 t t1 eq
{ exit
} if
} loop
119 \@nameuse
{endplot@
\psplotstyle}}
121 %%%%%%%\psframeA ---------------------
122 \def\psframeA{\pst@object
{psframeA
}}
123 \def\psframeA@i(
#1)
{%
124 \@ifnextchar(
{\psframeA@ii(
#1)
}{\psframeA@ii(
0,
0)(
#1)
}}
125 \def\psframeA@ii(
#1)(
#2)
{%
127 \pst@getcoor
{#1}\pst@tempa
%
129 \def\pst@linetype
{2}%
131 \tx@optionsanamorphosis
132 \tx@optionsanamorphosisAdd
139 X1 Y1 tx@anamorphosisPathDict begin Anamorphose end
141 0 0.005 1.0 { %(X1,Y1)->(X2,Y1)
143 K X2 mul
1 K sub X1 mul add
145 tx@anamorphosisPathDict begin Anamorphose end
148 0 0.005 1.0 { % (X2,Y1)->(X2,Y2)
151 K Y2 mul
1 K sub Y1 mul add
152 tx@anamorphosisPathDict begin Anamorphose end
155 0 0.005 1.0 { % (X2,Y2)->(X1,Y2)
157 K X1 mul
1 K sub X2 mul add
159 tx@anamorphosisPathDict begin Anamorphose end
162 0 0.005 1.0 { % (X1,Y2)->(X1,Y1)
165 K Y1 mul
1 K sub Y2 mul add
166 tx@anamorphosisPathDict begin Anamorphose end
173 %%%%%%%\translateA ---------------------------
174 \def\translateA{\def\pst@par
{}\pst@object
{translateA
}}
175 \def\translateA@i(
#1)
{{%
178 \tx@optionsanamorphosis
179 \tx@optionsanamorphosisAdd
181 tx@anamorphosisPathDict begin Anamorphose end
185 \title{pst-anamorphosis : extensions possibles
}
186 \author{Jürgen Gilg, Manuel Luque, Jean-Michel Sarlat
}
187 \date{21 octobre
2011}
191 Il est relativement facile d'adapter les commandes de
\textsf{PStricks
} à
\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 été pour ne pas alourdir inutilement le package. Nous allons détailler sur un exemple la façon de procéder.
193 Remarque : toutes les macros ne sont pas adaptables, cela serait le cas si les anamorphoses transformaient une ligne droite en une ligne droite. Or, à part la perspective, ce n'est pas le cas. En conséquence,
\verb+
\psline+,
\verb+
\psframe+,
\verb+
\pspolygon+ doivent être réécrits en divisant le segment initial en un grand nombre de petits segments : pour
\verb+
\pslineA+ par exemple chaque segment initial est divisé en
200 parties et ceci quelle que soit sa longueur, dans l'idéal il faudrait tenir compte de la longueur du segment avant de choisir le nombre de segmentations.
195 \section{\textbackslash{}psparametricplotA
}
196 \subsection{Adaptation
}
197 À partir d'une copie de
\textbackslash{}\textsf{psparametricplot
} :
199 \item On remplace parout
\textsf{psparametricplot
} par
\textsf{psparametricplotA
} ;
200 \item dans le premier
\verb+
\addto@pscode
{%+
203 \tx@optionsanamorphosis
204 \tx@optionsanamorphosisAdd
208 on introduit juste au début les variables de
\textsf{pst-anamorphosis
} ;
209 \item et pour terminer dans
\verb+/xy
{+:
212 \ifPst@algebraic F@pstplot
\else #5 \fi
213 \pst@number
\psyunit mul exch
214 \pst@number
\psxunit mul exch
215 tx@anamorphosisPathDict begin Anamorphose end
218 on insère à la fin les calculs propres à l'anamorphose. C'est terminé, la macro est opérationnelle !
222 \begin{pspicture
}(-
6,-
6)(
6,
6)
223 \pscircle[doubleline=true
]{3}
225 \pscircle[linecolor=blue
](
0,
0)
{1}
226 \pscircleA[linecolor=blue
](
0,
0)
{1}
227 \pscircle[linecolor=blue
](
0,
0)
{2}
228 \pscircleA[linecolor=blue
](
0,
0)
{2}
229 \psframeA[linecolor=blue,fillstyle=solid,fillcolor=cyan
](
1,
1)(
2,
2)
230 \psframeA[linecolor=blue,fillstyle=solid,fillcolor=cyan
](-
1,-
1)(-
2,-
2)
231 \psframeA[linecolor=blue,fillstyle=solid,fillcolor=cyan
](-
1,
1)(-
2,
2)
232 \psframeA[linecolor=blue,fillstyle=solid,fillcolor=cyan
](
1,-
1)(
2,-
2)
233 \psframe[linecolor=blue,fillstyle=solid,fillcolor=cyan
](
1,
1)(
2,
2)
234 \psframe[linecolor=blue,fillstyle=solid,fillcolor=cyan
](-
1,-
1)(-
2,-
2)
235 \psframe[linecolor=blue,fillstyle=solid,fillcolor=cyan
](-
1,
1)(-
2,
2)
236 \psframe[linecolor=blue,fillstyle=solid,fillcolor=cyan
](
1,-
1)(
2,-
2)
237 \parametricplotA[plotpoints=
3600,linecolor=red,linewidth=
1mm
]{0}{360}{%
238 /Radius
1.5 0.5 t
10 mul sin mul add def
242 \parametricplot[plotpoints=
3600,linecolor=red,linewidth=
1mm
]{0}{360}{%
243 /Radius
1.5 0.5 t
10 mul sin mul add def
247 \multido{\n=
0.5+
0.5,
\N=
0.5+
0.5}{4}{%
248 \pnode(!
\n\space -
2)
{A
}
249 \pnode(!
\n\space 2)
{B
}
257 \multido{\n=-
2.0+
0.5,
\N=-
2.0+
0.5}{4}{%
258 \pnode(!
\n\space -
2)
{A
}
259 \pnode(!
\n\space 2)
{B
}
269 \pslineA(
0,-
2)(
0,-
0.5)
271 \pslineA(-
2,
0)(-
0.5,
0)
273 \psdot[dotstyle=x,dotsize=
.2](
0,
0)
277 \parametricplotA[plotpoints=
3600,linecolor=red,linewidth=
1mm
]{0}{360}{%
278 /Radius
1.5 0.5 t
10 mul sin mul add def
282 \parametricplot[plotpoints=
3600,linecolor=red,linewidth=
1mm
]{0}{360}{%
283 /Radius
1.5 0.5 t
10 mul sin mul add def
287 \section{\textbackslash{}psframeA
}
288 \verb+
\psframeA(x1,y1)(x2,y2)+ a les mêmes propriétés que
\verb+
\psframe+
290 \begin{pspicture
}(-
6,-
6)(
6,
6.5)
291 \psset{type=conical,Rmirror=
3}
292 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](-
0.25,-
0.25)(-
0.01,-
0.01)
293 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](-
0.25,
0.25)(-
0.01,
0.01)
294 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](
0.01,
0.01)(
0.25,
0.25)
295 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](
0.01,-
0.01)(
0.25,-
0.25)
296 \multido{\ry=-
2.75+
1,
\rY=-
2.25+
1}{6}{
297 \multido{\n=-
2.75+
1.00,
\N=-
2.25+
1.00}{7}{%
298 \psframeA[fillstyle=solid,fillcolor=red,linecolor=red
](
\n,
\ry)(
\N,
\rY)
}
300 \multido{\ry=-
3.25+
1,
\rY=-
2.75+
1}{3}{
301 \multido{\n=-
3.25+
1.00,
\N=-
2.75+
1.00}{7}{%
302 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](
\n,
\ry)(
\N,
\rY)
}
304 \multido{\ry=
0.75+
1,
\rY=
1.25+
1}{3}{
305 \multido{\n=-
3.25+
1.00,
\N=-
2.75+
1.00}{7}{%
306 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](
\n,
\ry)(
\N,
\rY)
}
308 \multido{\n=-
3.25+
1.00,
\N=-
2.75+
1.00}{3}{%
309 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](
\n,-
0.25)(
\N,
0.25)
}
310 \multido{\n=
0.75+
1.00,
\N=
1.25+
1.00}{3}{%
311 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](
\n,-
0.25)(
\N,
0.25)
}
312 \begin{psclip
}{\pscircle[fillstyle=solid,fillcolor=white,linestyle=none
]{3}}
313 \multido{\ry=-
2.75+
1,
\rY=-
2.25+
1}{6}{
314 \multido{\n=-
2.75+
1.00,
\N=-
2.25+
1.00}{6}{%
315 \psframe*
[linecolor=red
](
\n,
\ry)(
\N,
\rY)
}
317 \multido{\ry=-
3.25+
1,
\rY=-
2.75+
1}{7}{
318 \multido{\n=-
3.25+
1.00,
\N=-
2.75+
1.00}{7}{%
319 \psframe*
[linecolor=blue
](
\n,
\ry)(
\N,
\rY)
}
321 \pscircle[doubleline=true
]{3}
326 \multido{\ry=-
2.75+
1,
\rY=-
2.25+
1}{6}{
327 \multido{\n=-
2.75+
1.00,
\N=-
2.25+
1.00}{7}{%
328 \psframeA[fillstyle=solid,fillcolor=red,linecolor=red
](
\n,
\ry)(
\N,
\rY)
}
330 \multido{\ry=-
3.25+
1,
\rY=-
2.75+
1}{3}{
331 \multido{\n=-
3.25+
1.00,
\N=-
2.75+
1.00}{7}{%
332 \psframeA[fillstyle=solid,fillcolor=blue,linecolor=blue
](
\n,
\ry)(
\N,
\rY)
}
335 \section{\textbackslash{}pspolygonA
}
336 En réalité la macro
\verb+pspolygonA+ n'a pas été écrite. En effet il suffit de servir de
\verb+
\pslineA+ et de boucler le chemin en revenant au point origine.
338 \begin{pspicture
}(-
5,-
5)(
5,
5)
339 \psset{type=conical,Rmirror=
3}
340 \pspolygon[linecolor=red,linewidth=
1mm
](
2.5;
30)(
2.5;
90)(
2.5;
150)(
2.5;
210)(
2.5;
270)(
2.5;
330)
341 \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)
342 \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)
}
343 \multido{\i=
30+
60,
\I=
1+
1}{6}{%
344 \pnode(!
\i\space cos
0.75 mul
1.25 add
\i\space sin
0.75 mul
1 add)
{A
\I}
346 \pslineA[linecolor=blue,fillstyle=solid,linewidth=
1mm,fillcolor=
{[rgb
]{1 0.875 0.5}}](A1)(A2)(A3)(A4)(A5)(A1)
347 \pscircle[doubleline=true
]{3}
348 \psdot[dotstyle=x
](
0,
0)
352 \begin{pspicture
}(-
5,-
5)(
5,
5)
353 \psset{type=conical,Rmirror=
3}
354 \pspolygon[linecolor=red,linewidth=
1mm
](
2.5;
30)(
2.5;
90)(
2.5;
150)(
2.5;
210)(
2.5;
270)(
2.5;
330)
355 \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)
356 \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)
}
357 \multido{\i=
30+
60,
\I=
1+
1}{6}{%
358 \pnode(!
\i\space cos
0.75 mul
1.25 add
\i\space sin
0.75 mul
1 add)
{A
\I}
360 \pslineA[linecolor=blue,fillstyle=solid,linewidth=
1mm,fillcolor=
{[rgb
]{1 0.875 0.5}}](A1)(A2)(A3)(A4)(A5)(A1)
361 \pscircle[doubleline=true
]{3}
362 \psdot[dotstyle=x
](
0,
0)
365 On remarquera que le
\verb+
\rput(
1.25,
1)+ doit être remplacé par un calcul adapté. La macro
\verb+
\rputA+ n'a pas été définie.