### Rectangles and General Polygon Routines.

A polygon is composed of a number of coplanar line segments connected end to end to form a closed shape.

In VOGLE curves are estimated by a series of line segments, and thus may be included easily into polygons.

Regular
A polygon with all sides and interior angles the same. Regular polygons are always convex. See Regular Polygons
Irregular
Each side may a different length, each angle may be a different measure. The opposite of a regular polygon. See Irregular Polygons
Convex
All interior angles less than 180°,and all vertices 'point outwards' away from the interior. The opposite of concave. Regular polygons are always convex. See Convex Polygons
Concave
One or more interior angles greater than 180°. Some vertices push 'inwards' towards the interior of the polygon. The opposite of convex.
Self-intersecting or Crossed
A polygon where one or more sides crosses back over another side, creating multiple smaller polygons. Most of the properties and theorems concerning polygons do not apply to this shape. It is best considered as several separate polygons.
A polygon that in not self-intersecting in this way is called a simple polygon.

#### rect(x1, y1, x2, y2)

Draw a rectangle. Note: rectangles are regarded as polygons, so if polyfill or polyhatch has been called with 1, the rectangle will be filled or hatched accordingly.

```   Fortran:
subroutine rect(x1, y1, x2, y2)
REAL x1, y1, x1, y2
C:
rect(x1, y1, x2, y2)
float x1, y1, x2, y2;

Pascal:
procedure Rect(x1, y1, x2, y2: real)
```

#### polyfill(onoff)

Set the polygon fill flag. This will always turn off hatching. A non-zero integer or LOGICAL .true. turns polyfill on.

```   Fortran:
subroutine polyfill(onoff)
logical onoff
C:
polyfill(onoff)
int  onoff;
Pascal:
procedure PolyFill(onoff: boolean)
```

#### polyhatch(onoff)

Set the polygon hatch flag. This will always turn off fill. A non-zero integer or LOGICAL .true. turns polyhatch on. Note that hatched polygons must initially be defined parallel to the X-Y plane.

```   Fortran:
subroutine polyhatch(onoff)
logical onoff
C:
polyhatch(onoff)
int onoff;

Pascal:
procedure PolyHatch(onoff: boolean)
```

#### hatchang(angle)

Set the angle of the hatch lines. The angle is in degrees. Zero degrees is on the negative X axis. Positive values are counterclockwise.

```   Fortran:
subroutine hatchang(angle)
real angle
C:
hatchang(angle)
float angle;

Pascal:
procedure HatchAng(angle: real)
```

#### hatchpitch(pitch)

Set the distance between hatch lines. The distance is measured in window units (as opposed to viewport or device units).

```   Fortran:
subroutine hatchpitch(pitch)
real pitch
C:
hatchpitch(pitch)
float pitch;

Pascal:
procedure HatchPitch(pitch: real)
```

#### poly2(n, points)

Construct an (x, y) polygon from an array of points provided by the user.

```   Fortran:
subroutine poly2(n, points)
integer n
real points(2, n)
C:
poly2(n, points)
int n;
float  points[][2];
Pascal:
procedure Poly2(n: integer; points: Poly2_array_t)
```

#### poly(n, points)

Construct a polygon from an array of points provided by the user.

```   Fortran:
subroutine poly(n, points)
integer n
real points(3, n)
C:
poly(n, points)
int n;
float points[][3];

Pascal:
procedure Poly(n: integer; points: Poly3_array_t)
```

#### makepoly()

makepoly opens up a polygon which will then be constructed by a series of move-draws and closed by a closepoly.

```   Fortran:
subroutine makepoly
C:
makepoly()
Pascal:
procedure MakePoly
```

#### closepoly()

Terminates a polygon opened by makepoly.

```   Fortran:
subroutine closepoly
C:
closepoly()
Pascal:
procedure ClosePoly
```

#### backface(onoff)

Turns on culling of backfacing polygons. A polygon is backfacing if it's orientation in *screen* coords is clockwise, unless a call to backfacedir is made.

```   Fortran:
subroutine backface(onoff)
logical onoff
C:
backface(onoff)
int  onoff;
Pascal:
procedure BackFace(onoff: boolean)
```

#### backfacedir(clockwise)

Sets the backfacing direction to clockwise or anti-clockwise depending on whether clockwise is 1 or 0. 1 = clockwise (in screen coords) 0 = anticlockwise.

```   Fortran:
subroutine backfacedir(clockwise)
integer clockwise

C:
backfacedir(clockwise)
int  clockwise;
Pascal:
procedure BackFaceDir(clockwise: boolean)
```