POLYGON

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 Picomite CMM2

Syntax:
POLYGON n, xarray%(), yarray%() [, bordercolour] [, fillcolour]
POLYGON n(), xarray%(), yarray%() [, bordercolour()] [, fillcolour()]
POLYGON n(), xarray%(), yarray%() [, bordercolour] [, fillcolour]

Description:

Draws a filled or outline polygon with n xy-coordinate pairs in xarray%() and yarray%(). 
If ‘fillcolour’ is omitted then just the polygon outline is drawn. 
If ‘bordercolour’ is omitted then it will default to the current default foreground colour. 
If the last xy-coordinate pair is not the same as the first the firmware will automatically create an additional xy-coordinate pair to complete the polygon. 
The size of the arrays should be at least as big as the number of x,ycoordinate pairs. 
'n' can be an array and the colours can also optionally be arrays as follows: 
POLYGON n(), xarray%(), yarray%() [, bordercolour()] [, fillcolour()] 
POLYGON n(), xarray%(), yarray%() [, bordercolour] [, fillcolour] 
The size of the n array determines the number of polygons that will be drawn. 
The elements of array n() define the number of xy-coordinate pairs in each of the polygons. e.g DIM n(1)=(3,3) would define that 2 polygons are to be drawn with three vertices each. 
The xy-coordinate pairs for all the polygons are stored in xarray%() and yarray%(). 
The xarray%() and yarray%() parameters must have at least as many elements as the total of the values in the n array. 
Each polygon can be closed with the first and last elements the same. If the last element is not the same as the first the firmware will automatically create an additional xy-coordinate pair to complete the polygon. 
If fill colour is omitted then just the polygon outlines are drawn. 
The colour parameters can be a single value in which case all polygons are drawn in the same colour or they can be arrays with the same cardinality as n. 
In this case each polygon drawn can have a different colour of both border and/or fill. For example, this will draw 3 triangles in yellow, green and red: 

DIM c%(2)=(3,3,3)
DIM x%(8)=(100,50,150,100,50,150,250,200,300)
DIM y%(8)=(50,100,100,150,200,200,150,200,200)
DIM fc%(2)=(RGB(YELLOW),RGB(GREEN),RGB(RED))
CLS
POLYGON c%(),x%(),y%(),fc%(),fc%()


Last edited: 24 February, 2023