[Programming] How to fix the position of points relatively to others

Denis Girou Denis.Girou at idris.fr
Mon Mar 27 19:46:20 CEST 2000

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.

  I recently have a question about the way to fix the position of points
relatively to others.

  If we know the cartesian coordinates of the points, we can of course make
some computations on them, using the standard TeX macros or some extensions
like `realcalc' or `fp', which allow complex arithmetic opérations. We can
also save the coordinates in some TeX macros and make the computations in
PostScript, using the ! indicator for PostScript special coordinates
(documentation page 72).

  But if we do not know the values of the coordinates of the points (when for
instance they are arbitrary nodes), we have nevertheless a powerful way to
manipulate them and to build new points relatively to them, for instance to
put a point at a defined fraction of a segment joining two arbitrary points.
For that, we must define the points as nodes, then to use the \ncput macro
with the "npos" parameter (Beta documentation pages 20-21).

  \ncput is a macro primilarly defined to put labels on line connections,
but we can use it too to define new nodes or to execute some arbitrary code.
If the position is not a known fraction of the segment, we can also compute it
using `realcalc' or `fp'.







  \ncput{\pnode{A}}              % Middle of (1,0) and (1,8) -> (1,4)
  \ncput{\pnode{B}}              % Middle of (5,6) and (5,8) -> (5,7)
  % Join (0,0), which is the middle of the segment joining G and H, with H
  \ncput{\pnode{I}}              % I is the middle of the segment joining G and H
  \ncput[npos=0.25]{\pnode{J}}   % J is the middle of the segment joining G and I
  \ncput[npos=0.3333]{\pnode{T}} % T is the third of the segment joining R and S



The list interface (subscription, information, access to the archives) is on:
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