(texdraw)Coordinate parsing


Next: Real arithmetic Up: TeXdraw Toolbox
Enter node , (file) or (file)node

B.1 Coordinate parsing
======================

The coordinate parsing macro '\getpos' is useful for creating new
commands.  This macro takes care of stripping leading and trailing
blanks from coordinates specified between parentheses.  In addition,
symbolic coordinates are translated to the corresponding relative
coordinate using the segment offset and scaling in effect.

   The macro '\currentpos' returns the relative coordinates of the
current position.  The returned values are relative to the current
segment and the current scaling.  The macro '\cossin' returns the
real-valued cosine and sine of the direction of the line joining two
points.  The macro '\vectlen' returns the length of a vector.  The
results appear as the value of user supplied macro names.

'\getpos (X Y)\MX\MY'
     Decode coordinate values.  The coordinates specified by '(X Y)' are
     decoded.  Symbolic coordinates are translated to the corresponding
     relative coordinate using the current segment offset and scaling.
     The resulting character strings representing the real-valued
     coordinates are assigned to the macros specified by '\MX' and
     '\MY'.
'\currentpos \MX\MY'
     Return the coordinates of the current position.  The coordinates
     are relative to the current segment offset and scaling.  The
     resulting character strings representing the real-valued
     coordinates are assigned to the macros specified by '\MX' and
     '\MY'.
'\cossin (X1 Y1)(X2 Y2)\COSA\SINA'
     Return the cosine and sine of the direction of a vector joining two
     points.  The cosine and sine of the angle of the vector which goes
     from '(X1 Y1)' to '(X2 Y2)'.  The character strings representing
     these real-valued quantities are assigned to the macros specified
     by '\COSA' and '\SINA'.
'\vectlen (X1 Y1)(X2 Y2)\LEN'
     Return the length of a vector joining two points.  The length of
     the vector is relative to the current scaling.  The character
     string representing the real-valued length is assigned to the macro
     specified by '\LEN'.


automatically generated by info2www version 1.2.2.9