4
\documentclass[border=15pt,pstricks,12pt]{standalone}
\usepackage{pst-node}
\begin{document}
\begin{pspicture}[showgrid](5,3)
\rput(1.5,0.5){\trinode{CN}{NodeA}}
\rput(3.5,2.5){\trinode{EN}{NodeB}}
\pnode(! \psGetNodeCenter{CN} CN.x 2 add CN.y 1 add ){MyCNode}
\ncline[linecolor=red]{MyCNode}{EN}
\ncline[linecolor=blue]{CN}{EN}
\end{pspicture}
\end{document}

enter image description here

From the image, I don't think that the coordinate of MyCNode is (3.5,1.5 !?)

\documentclass[border=15pt,pstricks,12pt]{standalone}
\usepackage{pst-node}
\begin{document}
\begin{pspicture}[showgrid,saveNodeCoors](5,3)
\rput(1.5,0.5){\trinode{CN}{NodeA}}
\rput(3.5,2.5){\trinode{EN}{NodeB}}
\pnode(! N-CN.x 2 add N-CN.y 1 add ){MyCNode}
\ncline[linecolor=red]{MyCNode}{EN}
\ncline[linecolor=blue]{CN}{EN}
\end{pspicture}
\end{document}

enter image description here

From the above code, so (N-CN.x,N-CN.y)=(0,0) !?

P\S: In pst-node documentation, there is a sentence which has the following content: In the following example it doesn’t work because the relative node setting via \rput is not taken into account. Truly, I do not understand it clearly.

3

It is a bit tricky: The "vertical center" of the triangle is placed at the position of \rput. But the node itself is the center of the Text!!

\documentclass[border=15pt,pstricks,12pt]{standalone}
\usepackage{pst-node}
\begin{document}
    \begin{pspicture}[showgrid](5,3)
    \rput(0,0){\trinode{A}{A}}\psdot(A)%
    \rput(1.5,0.5){\trinode{CN}{NodeA}}\psdot(CN)%
    \rput(3.5,2.5){\trinode{EN}{NodeB}}\psdot(EN)%
    \pnode(! \psGetNodeCenter{CN} CN.x 2 add CN.y 1 add ){MyCNode}\psdot(MyCNode)
    \ncline[linecolor=red]{MyCNode}{EN}
    \ncline[linecolor=blue]{CN}{EN}
    \end{pspicture}

\begin{pspicture}[showgrid,saveNodeCoors](-1,-1)(5,3)
\rput(0,0){\trinode{A}{NodeA}}\psdot(A)
\rput(1.5,0.5){\trinode{CN}{NodeA}}\psdot(CN)
\rput(3.5,2.5){\trinode{EN}{NodeB}}\psdot(EN)
\psdot[linecolor=red](! N-CN.x N-CN.y)
\pnode(! N-CN.x 2 add N-CN.y 1 add ){MyCNode}\psdot(MyCNode)
\ncline[linecolor=red]{MyCNode}{EN}
\ncline[linecolor=blue]{CN}{EN}
\end{pspicture}
\end{document}

enter image description here

enter image description here

Using the save node coordinates makes only real sense for nodes defined by \pnode

  • Yes, I see. And with the second question, (N-CN.x,N-CN.y)=(0,0) is set by default !?. ( the coordinates of \rput are not loaded within saveNodeCoors ). – user173875 Feb 10 at 2:22
  • 1
    For nodes which have a contents (box) it makes no sense to use the internal variables N-??.x, N-??.y. Use it only for nodes where you explicitly set the node center: \pnode, \cnode, ... – user2478 Feb 10 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.