Poly TCL UTILITIES USER MANUAL Poly
SYNOPSIS
Draw a polygon
PACKAGE
TCLGPH
NAME
Line
USAGE
Polygon  wnID X Y Z nP {Offset} {Tag}
INPUT DEFINITIONS
wnID - The iD of the window to output the polygon in.
X - The array of X coordinates which form the polygon.
Y - The array of Y coordinates which form the polygon.
Z - The array of Z coordinates which form the polygon. This is unused with the TK graphics driver but perhaps not with the VTK driver.
nP - The number of points which make up the polygon.
Offset - An optional input parameter which is an offset into the coordinate arrays to the starting position of the polygon. The default value is 0.
Tag - Optional input variable which allows the polygon to have the designated Tag attached to it. Tagged items can be selectively deleted from a canvas.
RETURN DEFINITION
NONE
DESCRIPTION
Poly draws a polygon consisting of the nP points (X, Y, Z) begining at point Offset. If the first and last point in the polygon are not identical the procedure will add an end point which matches the first set of coordinates.
The polygon is drawn open or filled depending on the status of the current fill color. The the current fill color is set to OFF the polygon consists of just the outline.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1:Examples of various polygons.
# 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 

# 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 polygon

set X(0) -3.0  ; set Y(0) 3.0 
set X(1)  3.0  ; set Y(1) 3.0 
set X(2)  4.0  ; set Y(2) 0.0 
set X(3)  3.0  ; set Y(3) -3.0 
set X(4) -3.0  ; set Y(4) -3.0 
set X(5) -4.0  ; set Y(5)  0.0 

# Current line color to blue

PlotColor HOLD $GphInfo(Blue) OFF

# OUTPUT the polygon open

Poly 0 X Y X 6

# SET up a second polygon

set X(0) -2.0  ; set Y(0) 2.0 
set X(1)  2.0  ; set Y(1) 2.0 
set X(2)  3.0  ; set Y(2) 0.0 
set X(3)  2.0  ; set Y(3) -2.0 
set X(4) -2.0  ; set Y(4) -2.0 
set X(5) -3.0  ; set Y(5)  0.0 

# Current line color and fill to yellow

PlotColor HOLD $GphInfo(Yellow) $GphInfo(Yellow)

# OUTPUT the polygon filled

Poly 0 X Y X 6
      
Feb 22, 2007