Lines TCL UTILITIES USER MANUAL Lines
SYNOPSIS
Draw a set of lines
PACKAGE
TCLGPH
NAME
Line
USAGE
Lines  wnID X Y Z nP {Offset} {Tag}
INPUT DEFINITIONS
wnID - The iD of the window to output the lines in.
X - The array of X coordinates which form the line segments.
Y - The array of Y coordinates which form the line segments.
Z - The array of Z coordinates which form the line segments. This is unused with the TK graphics driver but perhaps not with the VTK driver.
nP - The number of coordinates in the arrays. There is one more orrdinate than lines output.
Offset - An optional input parameter which is an offset into the coordinate arrays to the starting position of the first line to output. The default value is 0.
Tag - Optional input variable which allows the lines to have the designated Tag attached to it. Tagged items can be selectively deleted from a canvas.
RETURN DEFINITION
NONE
DESCRIPTION
Lines draws a set of nP-1 lines from the coordinates (X, Y, Z). The first point in the first line is at position Offset in the arrays. The ending point in one line segment becomes the first point in the next until the number of points to use is exhausted.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1:Examples of various polygons.
set Home [file join $env(TCLTOOLS_HOME)]
source [ file join $Home TclToolInits.tcl ]
TclToolInits GUI GPH PLT UTILS UDF UDFDB UDFUTILS FFT

# INITIALIZE the default gui settings

GUIprefsRead

# SET a window size

set GphInfo(xsScrL) 600
set GphInfo(ysScrL) 500
set GphInfo(xScrL) 600
set GphInfo(yScrL) 500

# START graphics

GraphicsOn TK RainBow SWAP

# ESTABLISH a graphics window coverting the whole canvas 

GenWindow 0 0.0 0.0 0.0 1.0 1.0 1.0 -6.0 -6.0 0.0 6.0 6.0 0.0

# SET up a sawtooth line pattern

set I 0
for { set x -5.0 } { $x <= 5.0 } { set x [expr $x + .25 ] } {
   set X($I) $x
   if [expr $I % 2] { set Y($I) 2.0 } else { set Y($I) -2.0 }
   incr I
}
   
# Current line color to White

PlotColor HOLD $GphInfo(White) OFF

# OUTPUT the lines 

Lines 0 X Y X $I

# CHANGE the linestyle to put arrows ont the second point in each line

LineStyle 0 HOLD last

# SET up another sawtooph pattern identical to the one above but
#   displaced in Y

set I 0
for { set x -5.0 } { $x <= 5.0 } { set x [expr $x + .25 ] } {
   set X($I) $x
   if [expr $I % 2] { set Y($I) -3.0 } else { set Y($I) -4.0 }
   incr I
}

# OUTput just the first 9 lines starting with the 6th point in the
#   array or coordinates

Lines 0 X Y X 10 5
      
Feb 26, 2007