![如何為 \psVolume 重複使用中綴到後綴運算子?](https://rvso.com/image/286348/%E5%A6%82%E4%BD%95%E7%82%BA%20%5CpsVolume%20%E9%87%8D%E8%A4%87%E4%BD%BF%E7%94%A8%E4%B8%AD%E7%B6%B4%E5%88%B0%E5%BE%8C%E7%B6%B4%E9%81%8B%E7%AE%97%E5%AD%90%EF%BC%9F.png)
約束條件
假設我不想infix-RPN
出於未知的邏輯原因使用包(認真的)。相反,我想使用我自己的A2P
描述,如下所示。在第一種情況下成功,但在第二種情況下失敗。
案例1(成功)
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\pstVerb{/A2P {exec AlgParser cvx /t ED exec 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]{2 Pi mul neg}{4 Pi mul}{\RR{x}}
\pscircle*[linecolor=red ](!\RR{7*Pi/2} \TT{7*Pi/2} A2P){2pt}
\pscircle*[linecolor=green](!{(2^(t/10))} {(3*Pi/2)} A2P){2pt}
\pscircle*[linecolor=blue ](!\RR{t} \TT{5*Pi/2} A2P){2pt}
\end{pspicture}
\end{document}
案例2(失敗)
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-func}
\pstVerb{/A2P {exec AlgParser cvx /t ED exec AlgParser cvx exec t RadtoDeg PtoC} def }
\def\f(#1){(sin(#1)+1.2)}%
\begin{document}
\begin{pspicture}(-0.5,-3)(7,3)
\psVolume[fillstyle=solid,fillcolor=orange!50,linecolor=blue](0,\psPiTwo){10}{{\f(x)} A2P}
\end{pspicture}
\end{document}
問題
我怎樣才能重複使用
\pstVerb{/A2P {exec AlgParser cvx /t ED exec AlgParser cvx exec t RadtoDeg PtoC} def }
為了\psVolume
?
答案1
在第一種情況下,您套用A2P
x 和 y 值。然而的函數參數\psVolume
僅計算為單一值:
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-func}
\pstVerb{/A2P {exec AlgParser cvx exec} def }
\def\f(#1){(sin(#1)+1.2)}%
\begin{document}
\begin{pspicture}(-0.5,-3)(7,3)
\psVolume[fillstyle=solid,fillcolor=orange!50,linecolor=blue](0,\psPiTwo){10}{{\f(x)} A2P}
\end{pspicture}
\end{document}