[pstricks] relative coordinates

Fabio Brugnara brugnara at itc.it
Wed Oct 20 09:33:12 CEST 2004


Hello,

first of all I'd like to thank very much both the original developer of
PsTricks and the actual maintainers. It's a very powerful and flexible package.

I'd like to know if there is a way of specifying coordinates relative to a
node as a coordinate parameter to pstricks commands.
For example, suppose I want to draw a polygon around several nodes, leaving
some margin.
The example below shows what I mean. The result can be achieved by first
placing 'pivot' nodes near the vertices, and then using their coordinates in
\pspolygon. But is there a way to achieve the same using directly relative
reference to the nodes? In the example there is an attempt, but it's not
working...

thanks,
best regards,
Fabio Brugnara

=========== EXAMPLE ============

\documentclass{article}
\usepackage{pstcol}
\usepackage{pst-all}

\begin{document}
\SpecialCoor
\hfill{desired result}\hfill{failed attempt}\hspace*{\fill}
\vspace{8ex}

% this gives the desired result
\hfill%
\pstree{\TR[name=a]{a}}{
 \TR[name=b]{b}
 \TR[name=c]{c}
}
\rput(a){\rput(0,1){\pnode{ab}}}
\rput(b){\rput(-1,-1){\pnode{bb}}}
\rput(c){\rput(1,-1){\pnode{bc}}}
\pspolygon(ab)(bb)(bc)
\hfill
% this is a failed attempt to achieve the same without additional nodes
\pstree{\TR[name=a]{a}}{
 \TR[name=b]{b}
 \TR[name=c]{c}
}%
\pspolygon(a|[offset=1]a)([offset=1]c|[offset=-1]c)([offset=-1]b|[offset=-1]b)
\hspace*{\fill}
\end{document}




More information about the PSTricks mailing list