POLYGON(3G)
NAME
polygon − define polygonal region to be filled and/or edged.
partial_polygon − define group of polygon vertices that begins as subpolygon or non-edged boundary.
SYNOPSIS
C Syntax:
void polygon2d(fildes,clist,numverts,flags);
int fildes,flags,numverts;
float clist[];
void partial_polygon2d(fildes,clist,numverts,flags,closure);
int fildes,numverts,flags,closure;
float clist[];
void polygon3d(fildes,clist,numverts,flags);
int fildes,flags,numverts;
float clist[];
void partial_polygon3d(fildes,clist,numverts,flags,closure);
int fildes, numverts,flags,closure;
float clist[];
void dcpolygon(fildes,clist,numverts,flags);
int fildes,flags,numverts;
int clist[];
void dcpartial_polygon(fildes,clist,numverts,flags,closure);
int fildes,numverts,flags,closure,clist[];
FORTRAN77 Syntax:
subroutine polygon2d(fildes,clist,numverts,flags)
integer*4 fildes,flags,numverts
real clist(numverts*(2+flags))
subroutine partial_polygon2d(fildes,clist,numverts,flags,closure)
integer*4 fildes,numverts,flags,closure
real clist(numverts*(2+flags))
subroutine polygon3d(fildes,clist,numverts,flags)
integer*4 fildes,flags,numverts
real clist(numverts*(3+flags))
subroutine partial_polygon3d(fildes,clist,numverts,flags,closure)
integer*4 fildes,numverts,flags,closure
real clist(numverts*(3+flags))
subroutine dcpolygon(fildes,clist,numverts,flags)
integer*4 fildes,flags,numverts
integer*4 clist(numverts*(2+flags))
subroutine dcpartial_polygon(fildes,clist,numverts,flags,closure)
integer*4 fildes,numverts,flags,closure
integer*4 clist(numverts*(2+flags))
Pascal Syntax:
procedure polygon2d(fildes:integer;
var clist:array[lo..hi:integer] of real;
numverts,flags:integer);
procedure partial_polygon2d(fildes:integer;var clist:
array[lo..hi:integer] of real;numverts,flags,
closure:integer);
procedure polygon3d(fildes:integer;
var clist:array[lo..hi:integer]of real;
numverts,flags:integer);
procedure partial_polygon3d(fildes:integer;var clist:
array[lo..hi:integer] of real;numverts,flags,
closure:integer);
procedure dcpolygon(fildes:integer;
var clist:array[lo..hi:integer] of integer;
numverts,flags:integer);
procedure dcpartial_polygon(fildes:integer;var clist:
array[lo..hi:integer] of integer;numverts,flags,
closure:integer);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
flags polygon: If set to FALSE (0), all edges are drawn if interior_style is set to be edged.
partial_polygon: If FALSE (0), the first vertex represents a non-drawn boundary. The remaining vertices represent drawn boundaries if interior_style is set to be edged.
polygon and partial_polygon: If set to TRUE (1), each polygon edge can be either a drawn boundary or a non-drawn boundary, depending on the value of the corresponding move/draw indicator and whether or not interior_style is set to be edged. If the indicator is non-zero (draw) and interior_style is set to edged, the boundary is drawn. Otherwise, it is not drawn. Non-drawn boundaries simply define the edges of the filled area.
clist polygon: Array of real endpoint data or device coordinate data with or without move/draw indicators embedded after each endpoint.
partial polygon: An array of integer (for dcpartial_polygon) or real (for partial_polygon) endpoint values with or without move/draw indicators embedded after each endpoint.
closure partial_polygon: If TRUE (1), the polygon vertex list is non-empty, and the last subpolygon is not yet closed, a boundary is added to close that subpolygon within the boundary. If the first polygon vertex in the partial polygon had a draw indicator, the closure boundary is drawn. Otherwise, it is not drawn. The partial_polygon then adds the vertices in clist to the polygon vertex list.
numverts Number of polygon vertices in the clist array. If the value is less than zero, zero is substituted.
Discussion - Polygon
A boundary of a polygonal region is defined by connecting each vertex to it successor in the vertex list.
The polygon is filled and/or outlined according to current interior style, fill color and perimeter attributes. As with all output primitives it is affected by the current drawing mode and write enable.
Move/draw indicators occupy the same space as one coordinate (a single 32-bit value), and are interspersed with the coordinate data. For polygon2d, each (x,y) pair of coordinates is followed by a move/draw indicator if flags is TRUE (1 for Pascal). For polygon_3d, each (x,y,z) triplet is followed by a move/draw indicator if flags is TRUE (1 for Pascal).
Each entry in the clist can contain any number of coordinates. The actual number depends on the coord parameter specified in vertex_format. The coord parameter can be used to skip over any extra coordinates following the usual 2, 3, or 4 that can be specified with this procedure. Vertex move/draw flags follow the skipped extra coordinates.
The use parameter specified in vertex_format determines whether any of the extra parameters are used to determine the color of the primitive. The following list shows in what order the data is expected. Any extra coordinates are skipped.
use=0 For 2d,dc: x,y,...,(flag)
For 3d: x,y,z,...,(flag)
use=1 For 2d,dc: x,y,i,...,(flag)
For 3d: x,y,z,i,...,(flag)
use=3 For 2d,dc: x,y,a,b,c,...,(flag)
For 3d: x,y,z,a,b,c,...,(flag)
Upon entry, the polygon vertex list is added to, not cleared, upon entry. The polygon list is then processed by filling all vertices in the list, and cleared upon exit. The flag at the beginning of partial_polygon. is used to create sub-polygons.
The current position is updated to the first vertex in the first partial_polygon/polygon upon completion of the polygon.
If per-polygon normal is set in vertex_format, the first vertex in polygon3d is used as a normal to that polygon, and the number of vertices in the clist should be numverts + 1. The normal must contain the same number of coordinates as every other vertex (extra coordinates are ignored).
Discussion - Partial Polygon
Partial_polygon puts polygon vertices into an internal polygon data structure. Only after a call is made to polygon or rectangle will the polygon be rendered. Partial_polygon is most commonly used to create "holes" in polygons.
Each vertex in the clist can contain any number of coordinates. The actual number depends on the coord parameter specified in vertex_format. The coord parameter can be used to skip over any extra coordinates following the usual 2, 3, or 4 that can be specified with this procedure.
The use parameter specified in vertex_format determines whether any of the extra parameters are used to determine the color of the primitive. The following list shows in what order the data is expected for each vertex. Any extra coordinates are skipped.
use=0 For 2d,dc: x,y,...,(flag)
For 3d: x,y,z,...,(flag)
use=1 For 2d,dc: x,y,i,...,(flag)
For 3d: x,y,z,i,...,(flag)
use=3 For 2d,dc: x,y,a,b,c,...,(flag)
For 3d: x,y,z,a,b,c,...,(flag)
If normals per polygon is specified in vertex_format, the normal is contained in the polygon vertex list; not in the partial_polygon list. If a normal needs to be calculated, the first 3 points of the first partial_polygon are used. The vertex list for the first partial polygon must contain at least 3 points or the normal cannot be calculated correctly.
SEE ALSO
drawing_mode(3G), fill_color(3G), interior_style(3G), perimeter_color(3G),
perimeter_type(3G), perimeter_repeat_length(3G), write_enable(3G),
vertex_format(3G).
NOTE
Any Starbase call other than partial_polygon2d, partial_polygon3d, partial_arc, partial_ellipse, or dcpartial_polygon, in the middle of a list of these procedure calls and before a call to polygon or rectangle produces unpredictable, device-dependent results.
Hewlett-Packard Company — May 11, 2021