[pstricks] Node Coordinates

Douglas Reid douglas.reid at dunvegan.co.uk
Sun Jun 4 15:10:36 CEST 2006


Hello,
Having just joined this list, I should appreciate assistance with the following two questions.

Question 1:
Given a node name, how can I subsequently determine the coordinates x and y?

As the simplest example, if I have previously defined node A as a point node
\pnode(10,20){A}
how can a macro (command) that uses node A, recover the original coordinates x and y?

There are various applications for which this would be useful.

Question 2:
For example, to measure the distance between two nodes.  Let this be the related question 2: how to measure horizontal and vertical distances between two nodes.

It is related to question 1 since if it is possible to measure the horizontal and vertical distances between two nodes, one of which is the origin, it provides a solution to question 1.

I have tried various indirect ways to measure the distance between nodes. For example,
\pnode(10,20){A}
\pnode(30,40){B}
\newlength{\temp}
\SpecialCoor
\settoheight{\temp}{%
\psframe(A)(B)
}%
\NormalCoor

The idea was to define an object based on the two nodes and then measure the height of the object, thereby determining the vertical distance between the two nodes.  Similarly, \settowidth could in principle be used to measure the horizontal distance.  However, this approach is unsuccessful as a result of the PSTricks object (\psframe in this example) having no physical size!  This is as documented on page 41 of the original manual.

On the same page of the manual it states that a pspicture can be used to reserve a certain size.  So, for attempt two, I tried:

\pnode(10,20){A}
\pnode(30,40){B}
\newlength{\temp}
\SpecialCoor
\settoheight{\temp}{%
\begin{pspicture}(A)(B)%
\end{pspicture}
}%
\NormalCoor

TeX seems to be unhappy with the use of Special Coordinates for pspicture!  The error message is
! Argument of \pst@@picture has an extra }

I tried using other types of Special Coordinates unrelated to nodes
\begin{pspicture}(! 10 20 )(! 30 40)%
\end{pspicture}
Again TeX is unhappy (same error message).  The conclusion is that pspicture only works with Cartesian coordinates.

Any ideas on solutions to these two questions would be much appreciated!

Douglas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20060604/7d3bd111/attachment.html 


More information about the PSTricks mailing list