是什么原因导致绿线无法到达多边形相应的顶点呢?
\documentclass[pstricks]{standalone}
\usepackage{pst-node,pst-plot}
\begin{document}
\pstVerb{realtime srand}%
\psLoop{10}{%
\begin{pspicture}[saveNodeCoors](-2,-2)(2,2)
\curvepnodes[plotpoints=10]{0}{360}{Rand 1 add t PtoC}{P}
\psnpolygon(0,\numexpr\Pnodecount-1){P}
\curvepnodes[plotpoints=50]{0}{N-P3.x N-P3.y Pyth}{t N-P3.y N-P3.x atan PtoC}{Q}
\psnline[linecolor=green](0,\Qnodecount){Q}
\end{pspicture}}
\end{document}
编辑
如果我按如下方式缓冲节点,问题就消失了P3
。
\documentclass[pstricks]{standalone}
\usepackage{pst-node,pst-plot}
\begin{document}
\pstVerb{realtime srand}%
\psLoop{10}{%
\begin{pspicture}[saveNodeCoors](-2,-2)(2,2)
\curvepnodes[plotpoints=10]{0}{360}{Rand 1 add t PtoC}{P}
\psnpolygon(0,\numexpr\Pnodecount-1){P}
\pnode(P3){T}
\curvepnodes[plotpoints=50]{0}{N-T.x N-T.y Pyth}{t N-T.y N-T.x atan PtoC}{Q}
\psnline[linecolor=green](0,\Qnodecount){Q}
\end{pspicture}}
\end{document}
答案1
\documentclass[pstricks]{standalone}
\usepackage{pst-node,pst-plot}
\begin{document}
\pstVerb{realtime srand}
\psLoop{10}{%
\begin{pspicture}(-2,-2)(2,2)
\edef\COOR{}\multido{\iA=0+36,\iB=0+1}{10}{%
\pnode(!Rand 1 add \iA\space PtoC){P\iB}\xdef\COOR{\COOR(P\iB)}}
\expandafter\pspolygon\COOR
\psline[linecolor=green,arrows=-*](P3)
\end{pspicture}}
\end{document}