Background
Let
\def\RR#1{(2^(#1/10))}
\def\TT#1{(#1)}
be the radius and angle functions, respectively.
Christoph defined a PS operator AAA
as follows.
/AAA {AlgParser cvx exec exch AlgParser cvx exec exch RadtoDeg PtoC} def
It can be used to translate
\pscircle*[linecolor=red](!\RR{7*Pi/2} \TT{7*Pi/2} AAA){2pt}
from polar infix to polar postfix. However 7*Pi/2
are repeated, it breaks DRY (Don't Repeat Yourself) principle and cannot make use of t
as explained shortly below.
I modified Herbert's operators as follows
/BBB {/TT ED TT AlgParser cvx /t ED /RR ED RR AlgParser cvx /r ED r t RadtoDeg PtoC} def
/CCC { AlgParser cvx /t ED AlgParser cvx exec t RadtoDeg PtoC} def
to allow me to write two styles as follows.
\pscircle*[linecolor=green](!{(2^(t/10))} {(3*Pi/2)} BBB){2pt}
\pscircle*[linecolor=blue](!\RR{t} \TT{5*Pi/2} CCC){2pt}
The first does not make use of \RR
and \TT
and the last does make use of \RR
and \TT
.
Complete code
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\pstVerb
{
/AAA {AlgParser cvx exec exch AlgParser cvx exec exch RadtoDeg PtoC} def
/BBB {/TT ED TT AlgParser cvx /t ED /RR ED RR AlgParser cvx /r ED r t RadtoDeg PtoC} def
/CCC { AlgParser cvx /t ED AlgParser cvx exec t RadtoDeg PtoC} def
}
\def\RR#1{(2^(#1/10))}
\def\TT#1{(#1)}
\begin{document}
\begin{pspicture}[showgrid](-3,-3)(3,3)
\psplot[algebraic,polarplot]{TwoPi}{TwoPi 2 mul}{\RR{x}}
\pscircle*[linecolor=red](!\RR{7*Pi/2} \TT{7*Pi/2} AAA){2pt}
\pscircle*[linecolor=green](!{(2^(t/10))} {(3*Pi/2)} BBB){2pt}
\pscircle*[linecolor=blue](!\RR{t} \TT{5*Pi/2} CCC){2pt}
\end{pspicture}
\end{document}
Question
Can I combine BBB
and CCC
to create DDD
as simple as AAA
but they must still work for the following?
\pscircle*[linecolor=green](!{(2^(t/10))} {(3*Pi/2)} DDD){2pt}
\pscircle*[linecolor=blue](!\RR{t} \TT{5*Pi/2} DDD){2pt}
Bonus question: I still don't understand why Herbert used only one exec
while Christoph used 2 exec
s? What does exec
do actually?
\def\RT#1{\RR{#1} \TT{#1}}
and calling\pscircle*[linecolor=red](!\RT{7*Pi/2} AAA){2pt}
, so that DRY is not broken ? – Adam B. Nov 28 '13 at 8:02\RR
cannot be represented as an expression witht
when passed as a point. – kiss my armpit Nov 28 '13 at 8:14