[pstricks] PSTricks Coordinate Computations and Nodes

Herbert Voss Herbert.Voss at fu-berlin.de
Mon Jul 9 21:02:56 CEST 2007


Herbert Voss wrote:
> 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 }
>   
sorry, should be

  \pst at number\psyunit div /#1.y ED
  \pst at number\psxunit div /#1.x ED }


Herbert


> \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
>
>
>   




More information about the PSTricks mailing list