GRAPHIC ARC statement  

Purpose

Draw an arc in the selected graphic window.

Syntax

GRAPHIC ARC (x1!, y1!) - (x2!, y2!), arcStart!, arcEnd! [, rgbColor&]

Remarks

An arc is a section of a circle or an ellipse. To specify a particular arc, you would first define the full circle or ellipse of which it is a part, and then specify the points on the ellipse where the arc starts and stops.

The full circle or ellipse is defined by its bounding rectangle, which is defined as the smallest rectangle which can be drawn around the circle or ellipse. For example, if the circle is centered at position (400,400), with a radius of 100 pixels, the upper left corner (x1!, y1!) of the bounding rectangle is (300,300), and the lower right corner (x2!, y2!) is (500,500).  The start point and end point of the arc are specified by their angle, which must be given in radians. A complete circle or ellipse is 2*pi radians. On a 12-hour clock-face, the values 0 and 2*pi both refer to the position of 3 o'clock, while the value 1*pi refers to the position of 9 o'clock. Other positions are specified by a radian value relative to these.  In PowerBASIC, arcs are always drawn counter-clockwise from the starting point to the ending point.

Prior to any graphical operations, the graphic target must first be selected with GRAPHIC ATTACH. The Coordinates are specified in the same terms (pixels or dialog units) as the parent dialog (or world coordinates, if those were chosen with GRAPHIC SCALE).  Line width can be set using GRAPHIC WIDTH. If line width is set to 1 (the default), the line style can be set with GRAPHIC STYLE. Because of the nature of an arc, GRAPHIC ARC neither uses, nor updates, graphic POS (last point referenced).

x1!, y1!

The upper left corner of the bounding rectangle of the full circle or ellipse.

x2!, y2!

The lower right corner of the bounding rectangle of the full circle or ellipse.

ArcStart!

The starting angle of the arc, in radians, from 0 to 2*pi.

ArcEnd!

The ending angle of the arc, in radians, from 0 to 2*pi radians.  Note that arcs are always drawn counter-clockwise from arcStart! to arcEnd!.  Compared with a 12-hour clock-face, 0 or 2*pi radians is at 3 o'clock, and 1*pi radians is at 9 o'clock.

rgbColor&

Optional RGB color for the arc. If omitted (or -1), the current foreground color for the graphic window is used.

See also

GRAPHIC ATTACH, GRAPHIC COLOR, GRAPHIC ELLIPSE, GRAPHIC PIE, GRAPHIC STYLE, GRAPHIC WIDTH

Example

' Draw two arcs that combine into a circle.

' The upper half uses the default foreground color.

' The lower half is drawn in red.

LOCAL Pi AS DOUBLE

Pi = 4 * ATN(1)                             ' Calculate Pi

GRAPHIC ARC (5, 5) - (105, 105), 0,  Pi      ' Upper half

GRAPHIC ARC (5, 5) - (105, 105), Pi, 0, %RED ' Lower half