DRAW

BASin

DRAW

Statement/Command

DRAW is used to draw straight lines and curves on the screen.

How to use DRAW

DRAW is normally used to for a statement in a program. If a straight line is required, it is followed by two numeric values separated by a comma, for example

40 DRAW x,y

A straight line is then drawn on the high-resolution graphics grid from from the position defined by the previous PLOT statement or the previous DRAW statement, whichever is last. Both values following DRAW are rounded to the nearest integer if necessary. The first value (x above) defines the horizontal distance from this position, and the second value (y) the vertical distance. These values are negative if the line is to go to the left or down respectively, and the position reached must be within the display area.

If there is no previous PLOT or DRAW statement, DRAW commences at position 0,0 (the bottom left-hand corner of the screen).

DRAW is affected by colour statements or commands and may include embedded statements with the same effects as with PLOT and CIRCLE.

DRAWing curved lines

DRAW may be followed by a third value to produce a curve that is a part of a circle, for example

40 DRAW x,y,z

The third value (z above) defines the angle (in radians) through which the line turns as it is drawn. The line turns to the left if this is positive, and to the right if it is negative. Values of PI or -PI produce a circle.

Example

The following program draws a triangle:

10 PLOT 127,50
20 DRAW 70,-100
30 DRAW -140,0
40 DRAW 70,100

Adding 1 or -1 to the DRAW statement causes the sides to curve in or out respectively.

Format

  • DRAW [statement;] int-num-expr, int-num-expr[, int-num-expr]

See also

Chapter 17.