[Programming] Relative moves from nodes

Denis Girou Denis.Girou at idris.fr
Wed Feb 25 23:01:52 CET 1998


-----------------------------------------------------------------------------
This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.
-----------------------------------------------------------------------------

  Looking at another question of Thomas Siegel
<siegel at aix550.informatik.uni-leipzig.de>, I recently discover an interesting
undocumented feature on nodes. The undescribed XnodesepA parameter (not part
of the `pst-beta' macros added to the 0.93a version but introduced in the
never complete and never diffused beta 0.94 version, which we used to build
PST97) allow to define points by relative moves from predefined nodes.

  In conjunction with the offsetA parameter, we can define cartesian moves,
and in conjunction with the angle parameter, polar moves. For clarity, it can
be better to define aliases for these parameters. In my example I use Rx and
Ry.

  It is a powerful feature. For instance, it solve easily a problem for which
I had never found before a convenient and simple solution: on 3d graphics,
how to position precisely some labels in the 2d (not 3d) coordinates system?
Using this parameter, it is now possible to define parts of the 3d objects as
nodes, and to exactly position labels relatively to them - I'll give soon a
complete example.

  Here is a simple demonstration:

\documentclass{article}

\usepackage{pst-node}

\makeatletter
\def\psset at Rx#1{\psset at XnodesepA{#1}}
\def\psset at Ry#1{\psset at offsetA{#1}}
\makeatother

\pagestyle{empty}

\begin{document}

\begin{pspicture}(4,3)
  \SpecialCoor

  \Cnode*(2,3){A}
  \Cnode*(2,2){B}
  \pscircle*[linecolor=red](4,2){0.25}
  \pscircle*[linecolor=green](2,0){0.25}
  \pscircle*[linecolor=yellow](0,0){0.25}
  \pscircle*[linecolor=cyan](4,0){0.25}

  \psline(A)(B)
  \psline[linecolor=red](A)([Rx=2]B)
  \psline[linecolor=magenta](B)([angle=45,Rx=-2]B)
  \psset{Ry=-2} % Active only in there is a node modifier [...]Node
  \psline[linecolor=green](A)([Rx=0]B) % 0 is necessary to join the center
  \psline[linecolor=yellow](A)([Rx=-2]B)
  \psline[linecolor=cyan](A)([Rx=2]B)
\end{pspicture}

\end{document}

D.G.

-----------------------------------------------------------------------------
The list interface (subscription, information, access to the archives) is on:
http://www.tug.org/cgi-bin/lwgate/pstricks
Otherway to unsubscribe, send mail to pstricks-request at mail.tug.org
with a blank subject and in body the line unsubscribe <email-address>
-----------------------------------------------------------------------------



More information about the PSTricks mailing list