(texdraw)Line vectors


Next: TeX text Prev: Coordinate specification Up: TeXdraw Commands
Enter node , (file) or (file)node

2.5 Line vectors
================

TeXdraw implements moves, line vectors and arrow vectors.  There are
both absolute and relative motion versions of these vector commands.
TeXdraw maintains a current position.  Lines are drawn from the current
position to a new coordinate, with the new coordinate becoming the new
current position.  An explicit move can be used to establish a new
current position.  The position '(0 0)' is used if there is no move to
an initial current position.

   The '\move' and '\rmove' commands establish a new current position
without drawing a line.  The '\lvec' and '\rlvec' commands draw a line
from the current position to a new position, which then becomes the new
current position.  The '\avec' and '\ravec' commands draw a line with an
arrowhead from the current position to a new coordinate, which then
becomes the new current position.  The tip of the arrow is at the new
current position.  The direction of the arrow follows the direction of
the line.  Since this direction is undefined for zero length vectors,
these are not allowed for '\avec' or '\ravec'.  Zero length arrow
vectors will generate a PostScript print error: 'undefinedresult'.  For
any non-zero length vector, the full size arrowhead is drawn, even if
that arrowhead is longer than the line length.

   The absolute motion versions of these commands specify the coordinate
of the final position.

'\move (X Y)'
     Move to coordinate '(X Y)'.  The new current position is '(X Y)'.
'\lvec (X Y)'
     Draw a line from the current position to coordinate '(X Y)'.  The
     new current position is '(X Y)'.
'\avec (X Y)'
     Draw a line with an arrowhead from the current position to '(X Y)'.
     The new current position is '(X Y)'.  The arrowhead is aligned with
     the line, with the tip at '(X Y)'.

   The relative motion versions of these commands interpret the
coordinates as displacements relative to the current position.  Given
the displacements '(DX DY)' as a parameter, each of the relative motion
commands moves DX units in the X direction and DY units in the Y
direction.

'\rmove (DX DY)'
     Move from the current position, DX units in the X direction and DY
     units in the Y direction.  The final position becomes the new
     current position.
'\rlvec (DX DY)'
     Draw a line from the current position, DX units in the X direction
     and DY units in the Y direction.  The final position becomes the
     new current position.
'\ravec (DX DY)'
     Draw a line with an arrowhead from the current position, DX units
     in the X direction and Y units in the Y direction.  The final
     position becomes the new current position.  The arrowhead is
     aligned with the line, with the tip at the new current position.

   Lines can be customized with commands to change the line width, line
pattern and line gray level rendition.  In addition, commands for
changing the type and size of the arrowhead are available.

'\linewd WIDTH'
     Set the line width to WIDTH units.  Initially WIDTH is 0.01 inches
     (corresponding to 3 pixels at 300 pixels to the inch).
'\lpatt (PATTERN)'
     Set lines to have the pattern '(PATTERN)'.  A pattern is a sequence
     of on/off lengths separated by blanks and enclosed in parentheses.
     The lengths alternately specify the length of a dash and the length
     of a gap between dashes.  Each length is interpreted using the
     current scaling and drawing units.  The pattern is used cyclically.
     The empty pattern signifies a solid line.  The initial line pattern
     is a solid line, corresponding to the empty pattern '\lpatt ()'.
'\setgray LEVEL'
     Set the gray level of lines.  Gray levels are real values from 0
     (black) through intermediate values (gray) to 1 (white).  The
     initial gray level is 0 corresponding to black.
'\arrowheadtype t:TYPE'
     Set the arrowhead type to TYPE, where TYPE is one of 'F', 'T', 'W',
     'V', or 'H'.  There are two kinds of arrowheads.  The first kind is
     a triangle.  There are 3 variants: type 'T' is an empty triangle,
     type 'F' is a filled triangle (using the current gray level for
     lines), type 'W' is a triangle filled with white.  The second kind
     of arrowhead is an open ended Vee.  There are 2 variants: type 'V'
     has the stem continue to the tip, type 'H' has the stem stop at the
     base of the arrowhead.  The initial arrowhead type is 'T'.
'\arrowheadsize l:LENGTH w:WIDTH'
     Set the arrowhead size to be LENGTH units long and WIDTH units
     wide.  The width is measured across the "base" of the arrowhead.
     The initial arrowhead size has a LENGTH of 0.16 inches and a WIDTH
     of 0.08 inches.

   Note that the lines which outline the arrowhead will be drawn with
the same line pattern used for the stem.  Normally, arrow vectors are
drawn with the line pattern set for a solid line.  Note that the fill
level used for the 'F' variant of the arrowhead uses the same gray level
as used for lines.  The difference between the 'T' variant and the 'W'
variant only shows up if the arrowhead is placed over non-white areas of
the drawing.  The 'W' variant obliterates the area under the arrowhead.

   Examples of line parameter and arrowhead settings are shown in the
following code.
     \centertexdraw{
       \drawdim in
       \linewd 0.03 \setgray 0.6 \arrowheadtype t:F \avec(0 0.5)
       \linewd 0.01 \setgray 0   \arrowheadtype t:V \avec(0.5 0.5)
       \linewd 0.015 \lpatt(0.067 0.1) \lvec (1 0)
       \linewd 0.02 \lpatt() \arrowheadtype t:T \avec(1.5 0.5)
       \arrowheadtype t:H \avec(2.0 0.5)
       \setgray 0.4 \arrowheadtype t:W \avec(3.0 0)
     }


automatically generated by info2www version 1.2.2.9