[pstricks] PSTricks Coordinate Computations and Nodes
Herbert Voss
herbert49 at googlemail.com
Mon Jul 9 19:28:33 CEST 2007
Randy Yates wrote:
> It Would Be Nice (TM) if ... PSTricks allowed coordinate
> computations using defined nodes. For example,
>
> \pnode(!0 0){MyNode}
>
> and then
>
> \pnode(!MyNode.x 4 add MyNode.y -2 add){MySecondNode}
>
> (as just an example - any PSTricks object that permitted special coordinates
> would do).
>
> Is this possible?
\documentclass{minimal}
\usepackage{pstricks,pst-node}
\SpecialCoor
\makeatletter
\def\GetCenter#1{ tx at NodeDict begin /N@#1 load GetCenter end
\pst at number\psyunit mul /#1.y ED
\pst at number\psxunit mul /#1.x ED }
\makeatother
\begin{document}
\pnode(!0 0){MyNode}%
%
\pnode(! \GetCenter{MyNode} % x y of MyNode
MyNode.x 2 sub MyNode.y 4 add){MySecondNode}
\ncline[linecolor=red]{<->}{MyNode}{MySecondNode}
\end{document}
Herbert
--
http://PSTricks.tug.org
http://www.dante.de/CTAN/info/math/voss/
More information about the PSTricks
mailing list