如何将节点的横坐标传递给 的前 2 个强制参数\psplot
?我尝试过,\psGetCenterNode
但在 PS 解释阶段产生了错误。
\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pstricks-add,pst-eucl}
\def\foo{x \psPi\space div 180 mul sin}
\def\goo{x \psPi\space div 180 mul cos}
\def\hoo{x}
\begin{document}
\begin{pspicture}[showgrid=bottom](0,-2)(5,2)
\psplot[linecolor=red]{0}{4.5}{\foo}
\psplot[linecolor=blue]{0}{4.5}{\goo}
\pstInterFF{\foo}{\goo}{0}{A}
\pstInterFF{\foo}{\goo}{4}{B}
%\psplot{A.x}{B.x}{\hoo} <== does NOT work!
\end{pspicture}
\end{document}
答案1
\documentclass{article}
\usepackage{pst-plot,pst-eucl}
\def\foo{x RadtoDeg sin}
\def\goo{x RadtoDeg cos}
\def\hoo{x}
\begin{document}
\begin{pspicture}[showgrid=bottom](0,-2)(5,2)
\psplot[linecolor=red]{0}{4.5}{\foo}
\psplot[linecolor=blue]{0}{4.5}{\goo}
\pstInterFF{\foo}{\goo}{0}{A}
\pstInterFF{\foo}{\goo}{4}{B}
\psplot{\psGetNodeCenter{A} A.x}{\psGetNodeCenter{B} B.x}{\hoo}
\end{pspicture}
\end{document}
答案2
只是另一种方法。
\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-eucl,pst-plot}
\def\foo{(sin(x))}
\def\goo{(cos(x))}
\def\hoo{(x)}
\pstVerb{/I2P {AlgParser cvx exec} def}
\begin{document}
\begin{pspicture}[showgrid=bottom,algebraic,saveNodeCoors](0,-2)(5,2)
\psplot[linecolor=red]{0}{4.5}{\foo}
\psplot[linecolor=blue]{0}{4.5}{\goo}
\pstInterFF{\foo I2P}{\goo I2P}{0}{A}
\pstInterFF{\foo I2P}{\goo I2P}{4}{B}
\psplot{N-A.x}{N-B.x}{\hoo}
\end{pspicture}
\end{document}