PolyLine, PolyFill Commands

Purpose

Draws connected lines with an arbitrary number of corners.

Syntax

PolyFill n, x(), y() [OffSet x0,y0]

PolyLine n, x(), y() [OffSet x0,y0]

niexp
x0, y0:floating-point expression
x(), y():avar floating-point array

Description

PolyLine n, x(),y() [OffSet x0,y0] draws connected lines with n corners. The x,y coordinates of the corner points are in arrays x() and y(). The first corner point is defined in x(0),y(0) and the last in x(n-1),y(n-1). The first and last corner points are automatically connected. Optionally, a horizontal and/or vertical offset (x0 or y0) can be added to these coordinates.

Polyfill works in the same way and fills the drawn polygon with the colour and/or pattern defined by DefFill.

Use caution when using Option Base 1; if an array has been defined to start at element one, then the first corner will be stored in x(1), y(1) rather than x(0), y(0) and the last corner in x(n), y(n).

Example

Option Base 0

OpenW # 1

Dim x!(3), y!(3), a%, i%

// Draws a triangle

Data 120,120,170,170,70,170,120,120

For i% = 0 To 3

Read x(i%), y(i%)

Next i%

PolyLine 4, x(), y()

// Draw two filled stars, offset horizontally and vertically

Option Base 1

Data -59,-81,0,100,59,-81,-95,31,95,31

Dim x1!(5), y1!(5)

For i% = 1 To 5

Read x1(i%), y1(i%)

Next i%

DefFill 5

QBColor 0

DefFill 10

PolyFill 5, x1(), y1() Offset ScaleWidth / 4, ScaleHeight * 2 / 3

DefFill 2

PolyFill 5, x1(), y1() Offset 3 * ScaleWidth / 4, ScaleHeight * 2 / 3

Do : Sleep : Until Me Is Nothing

See Also

Box, RBox, BkColor, DefFill, DefLine, DrawMode, RBox, PRBox, Box3D, PBox3D

{Created by Sjouke Hamstra; Last updated: 10/01/2016 by James Gaite}