Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ Contents1. Introduction2. Regions3. Display routines4. SPROGS files5. The file format6. Character fonts7. Index variables8. Efficiency of picture storage9. The sequence list10. Further facilities11. SPROGS on the 1906A12. An example film13. SPROGS preprocessor14. Future extensionsAppendices
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLLiteratureICL 1906A manualsSPROGS
ACLLiteratureICL 1906A manualsSPROGS
ACL ACD C&A INF CCD CISD Archives
Further reading

Contents
1. Introduction
2. Regions
3. Display routines
4. SPROGS files
5. The file format
6. Character fonts
7. Index variables
8. Efficiency of picture storage
9. The sequence list
10. Further facilities
11. SPROGS on the 1906A
12. An example film
13. SPROGS preprocessor
14. Future extensions
Appendices

Chapter 2: REGIONS

Before any output is produced for a graphical device, it is necessary to define its position. For example, in order to draw a line, the two end points must be defined in terms of the units of the graphical device. The device may be such that the initial position is already known (the current pen position) and only the displacements are required. Alternatively, the absolute coordinates of the start and finish of the lines may be required.

The user, however, does not wish to be concerned with the unit system of a particular output device (1024 × 1024 in the case of the SD4020), but, instead, wishes to use units which are relevant to his particular problem. Consequently, an important part of any graphical system is the flexibility with which the user can define his own units and how they relate to the equivalent positions on the display area.

2.1 Line Drawing

The user defines a line between two points (X,Y) and (A,B) in his own coordinate system, which has been defined by selecting an area known as a region. The system must decide whether the whole line is on the display area and, if not, calculate the part that is. In order to allow photographic effects such as wipes, there is also a need to mask certain parts of the output. The system is designed to be both flexible and, if desired, efficient.

Normally it is sufficient just to draw a line. Each line has certain parameters associated with it which define the type of line (for example, the intensity). The type of display may well influence the point where these are taken into account. In the SD4020, none of these parameters can be achieved by hardware and, consequently, they are dealt with by software at a higher level. For the moment, only how a simple line between (X,Y) and (A,B), which gets mapped onto the display area, is considered.

2.2 Region Limits

The routine:

      RGLIM (R, XMIN, YMIN, XMAX, YMAX)

allows the user to set up his own coordinate system in region R, so that, when he selects this region and draws a line from (X,Y) to (A, B), the line coordinates will be interpreted in his own units. The region R can normally be considered as a rectangle whose bottom left-hand corner is (XMIN, YMIN) and whose top right-hand corner is (XMAX, YMAX) (but see RGPRM definition).

      REGION (R)

selects region R. Hence, (using routine VEC to draw the line)

      RGLIM (1.0, 0.0, 0.0, 10.0, 10.0) 
      REGION (1.0) 
      VEC (0.0, 10.0, 10.0, 0.0)

would draw a line from the top left-hand corner to the bottom right-hand corner of the region.

(10,10) (0,0) Region 1 RGLIM(1.0, 0.0, 0.0, 10.0, 10.0) REGION(1.0) VEC(0.0, 10.0, 10.0, 0.0)

Fig. 2.1 Defining Your Own Coordinates

On entry to SPROGS, region 0 is selected, with limits (0.0, 1023.0, 1023.0, 0.0) corresponding exactly to the raster of the SD4020. (Thus, the bottom left-hand corner of the SD4020 raster is (0, 1023).) Note that there is no reason why XMIN and YMIN should be numerically less than XMAX and YMAX respectively.

2.3 Region Chains

It is possible to define one region 1n terms of another.

      RGPLIM (R, P, XPMIN, YPMIN, XPMAX, YPMAX)

defines region R in terms of region P, such that XPMIN, YPMIN, YPMAX, YPMAX are normally the equivalent values of XMIN, YMIN, XMAX, YMAX in the units of region P (but see RGPRM definition).

When a line is drawn in a selected region, the coordinates of the line are converted from the units of the selected region to the units of the next region in the chain, and so on until the chain end is reached (see below). Thus, if region 0 is chosen as the basic output region for the SD4020 (see below), the following command sequence:

      RGLIM (1.0, 0.0 , 0.0 , 10.0 , 10.0) 
      RGPLIM (1.0, 0.0, 0.0, 1023.0, 1023.0, 0.0)
      REGION (1.0) 
      VEC (0.0, 10.0, 10.0, 0.0)

will cause a line to be drawn from the top left-hand corner of the SD4020 frame to the bottom right-hand corner. The line coordinates will be converted from region 1 units to region 0 units, becoming 0.0, 0.0, 1023.0, 1023.0.

(10,10) [1023,0] (0,0) [0,1023] Region 1 Region 0 RGLIM(1.0, 0.0, 0.0, 10.0, 10.0) RGPLIM(1.0, 0.0, 0.0, 1023.0, 1023.0, 0.0) REGION(1.0) VEC(0.0, 10.0, 10.0, 0.0) Region 1 is defined in terms of region 0

Fig. 2.2 Region Chaining

Changing the settings of XPMIN, YPMIN, XPMAX, YPMAX has the effect of moving region R, and all lines drawn in it, with respect to region P. Thus, replacing the RGPLIM call above by:

      RGPLIM (1.0, 0.0 , 0.0 , 1023.0, 511.0, 512.0)

would cause the line to be drawn from top left to bottom right of a square occupying the bottom left hand quarter of the SD4020 frame. Normally, the point (X, Y) in region R will be converted to (X', Y') in region P where:

X' = XPMIN + (X-XMIN) (XPMAX-XPMIN) /(XMAX-XMIN)
Y' = YPMIN + (Y-YMIN) (YPMAX-YPMIN) /(YMAX-YMIN)

[1023,0] (10,10) (0,0) [0,1023] Region 1 Region 0 RGLIM(1.0, 0.0, 0.0, 10.0, 10.0) RGPLIM(1.0, 0.0, 0.0, 1023.0, 511.0, 512.0) REGION(1.0) VEC(0.0, 10.0, 10.0, 0.0) Region 1 is defined in terms of region 0

Fig. 2.3 Region Chaining

However, other forms of conversion are possible.

The routine:

      RGPRM (R, CNV, BSC, XMI, XMO, SWOUTP)

allows the user to select the required conversion to be performed by setting CNV. The allowable values are:

0.0
Conversion as defined above
1.0
Conversion as defined above, followed by a 90° anticlockwise rotation about the region mid-point
X" = (XPMIN+XPMAX+YPMIN+YPMAX)/2 - Y' 
Y" = (YPMIN+YPMAX-XPMIN-XPMAX)/2 + X'
2.0
The arguments of RGPLIM specify a rotation only. The coordinates are rotated about (XPMIN, YPMIN) through XPMAX radians, anticlockwise.
X' = XPMIN+(X-XPMIN)*COS(XPMAX)-(Y-YPMIN)*SIN(XPMAX) 
Y' = YPMIN+(X-XPMIN)*SIN(XPMAX)+(Y-YPMIN)*COS(XPMAX)
The value of YPMAX is ignored.

2.4 Output

SPROGS is designed to run with a variety of output devices. A user can select one or more by:

      DVOUT (DEVS)

where the bit settings of DEVS indicate which devices have been selected. Currently, the devices available are:

1.0
SD4020 microfilm
2.0
SD4020 hardcopy
8.0
lineprinter graphical
16.0
lineprinter
32.0
both SD4020 microfilm and hardcopy

thus:

      DVOUT (9.0)

will select SD4020 microfilm and lineprinter graphical.

Lineprinter graphical output draws lines on the lineprinter, plotting with the character * on a 120 × 120 grid. The plotting character changes to + where lines coincide.

Lineprinter output consists of a listing of the coordinates of lines (after transformation), and is mainly of use for debugging (see below).

If output is required to both microfilm and hardcopy on the SD4020, the user should use:

      DVOUT (32.0)

rather than:

      DVOUT (3.0)

since the latter will lead to excessive camera shutter movement which can damage the device.

As there are a number of different devices connected to SPROGS (and more will be added later), the user can specify which regions are to be treated as the basic output region for a given device. Initially, region 0 is selected to be the basic region for SD4020 microfilm and hardcopy. The routine:

      RGPRM (R, CNV, BSC, XMI, XMO, SWOUTP)

allows the user to select region R as the basic output region for devices specified by the bit pattern in SWOUTP (set in the same way as DEVS in the description of DVOUT). The other arguments will be explained later.

A line drawn in a given region will have its coordinates converted through the region chain until a region is reached which is the basic output region for one of the currently selected devices. At this point, no conversion takes place. Instead, the current coordinates are sent to this device. If more than one device has been selected, and not all the selected devices have been satisfied, conversion continues down the chain until all output is complete.

Thus:

      RGLIM (1.0, 0.0, 0.0, 10.0, 10.0) 
      RGPLIM (1.0, 0.0, 0.0, 1023.0, 1023.0, 0.0) 
      RGPLIM (0.0, 2.0, 0.0, 0.0, 119.0, 119.0) 
      RGLIM (2.0, 0.0, 0.0, 119.0, 119.0) 
      RGPRM (2.0, CNV, BSC, XMI, XMO, 8.0) 
      DVOUT (40.0) 
      REGION (1.0) 
      VEC (0.0, 10.0, 10.0, 0.0)

will cause the line to be output from the top left to bottom right on both microfilm and hardcopy on the SD4020 and on the lineprinter in graphical mode.

Note that the above has assumed that the settings of the other parameters of region 0 are as initialised. The user can of course redefine any of these parameters. Note also that there is no inherent ordering in the region numbering system, the chain defined above being 1 to 0 to 2. Regions may be numbered from 0 to 29 inclusive.

2.5 Scissoring

A region can be considered as dividing the whole plotting area into two parts (inside and outside). In general, a line will be split into three by a region (two parts outside and one part inside) although it may be wholly inside, wholly outside or split only into two. SPROGS allows the user to control the visibility of each line segment by specifying the visibility conditions for inside segments and outside segments. For example, the region could be made to act as a window, by forcing all segments outside it to be invisible. Since each region in a chain can have separate visibility settings, differing effects can be obtained by causing the visibility to depend on the previous region.

At the start of a conversion through the region chain, the line being drawn is split into inside and outside segments. The parameters XMI, XMO in RGPRM define the visibility effect of the region. Possible settings are:

0.0
Lines invisible
1.0
The current visibility (or invisibility) is preserved
2.0
The current visibility (or invisibility) is reversed
3.0
Lines visible

Thus lines which become invisible may revert to being visible aga1n later on in the chain.

Hence:

      RGPRM (R, CNV, BSC, 1.0, 0.0, SWOUTP)

would mean that only visible interior line segments will remain visible. All invisible interior line segments and all exterior line segments (whether originally visible or not) will become invisible. This setting is often chosen for basic output regions since it is not possible to plot off the hardware frame.

Thus, the order of actions when transforming through the region chain is:

  1. divide the line into interior and exterior segments
  2. alter visibility settings, if necessary
  3. check to see if the requested basic output region has been reached. If yes, output coordinates and proceed only if more devices need to be satisfied
  4. convert coordinates to next region units, and repeat cycle.

It can be seen that, for the last basic output region in a chain, the setting of RGPLIM is superfluous, and the settings of RGLIM only affect line visibility (by scissoring).

The argument BSC in RGPRM defines the basic shape of the region, and hence controls what scissoring is to take place. The normal shape of the region is rectangular, but two other shapes have been defined. The three settings are:

0.0
Region is rectangular, with bottom left hand corner (XMIN,YMIN) and top right hand corner (XMAX,YMAX)
1.0
Region is circular, centre (XMIN,YMIN) radius XMAX. YMAX is ignored for scissoring.
2.0
Region is elliptic, centre (XMIN,YMIN), axes lengths XMAX, YMAX parallel to the normal axes.

Note that BSC defines the meaning of the arguments of RGLIM. However, RGPLIM conversion will still make use of the values of XMIN, YMIN, XMAX and YMAX, independent of the region shape.

Before Being Scissored Result XMI = 1.0 and XMO = 0.0

Fig. 2.4 Scissoring Visible Lines

Before Being Scissored Result XMI = 2.0 and XMO = 1.0

Fig. 2.5 Scissoring Invisible Lines

Region 0 Region 2 Region 0 Region 2 Region 1 Region 0 In Region 2, XMI = 1.0 and XMO = 0.0 In Region 1, XMI = 1.0 and XMO = 2.0

2.6 Regions Defined in Terms of Themselves

Normally, this would produce a definition loop. However; if a user defines a region by:

      RGLIM (1.0, XMIN, YMIN, XMAX, YMAX) 
      RGPLIM (1.0, 0.0, XPMIN, YPMIN, XPMAX, YPMAX)

and subsequently writes:

      RGPLIM (1.0, 1.0, XMN, YMN, XMX, YMX)

this is equivalent to writing:

      RGPLIM (1.0, 0.0, XPMN, YPMN, XPMX, YPMX)

where:

XPMN = XPMIN + (XMN - XMIN) (XPMAX - XPMIN) / (XMAX - XMIN)
YPMN = YPMIN + (YMN - YMIN) (YPMAX - YPMIN) / (YMAX - YMIN)
XPMX = XPMIN + (XMX - XMIN) (XPMAX - XPMIN) / (XMAX - XMIN)
YPMX = YPMIN + (YMX - YMIN) (YPMAX - YPMIN) / (YMAX - YMIN)

(assuming CNV = 0.0 for this region)

2.7 Altering the Current Region Parameters

If a negative region number is used in RGLIM, RGPLIM or RGPRM, the currently selected region is assumed. Thus:

      REGION (2.0) 
      RGLIM (-1.0, XMN, YMN, XMX, YMX)

will change the limits of region 2. Also, if any other arguments in RGPRM are negative, the current values of those arguments are retained. Thus:

      RGPRM (R, -1.0, -1.0, 1.0, 0.0, -1.0)

will set the visibility markers for region R but leave the other arguments (CNV, BSC, and SWOUTP) unaltered.

2.8 Common Region Parameter Settings

Initially, region 0 is set up as the basic output region for the SD4020 and region 1 as the basic output region for lineprinter graphical. Various routines are provided to aid the user in oft-required region parameter settings.

      LIMIT (XM, YM, XN, YN)

sets the region limits for the current region.

      PLIMIT (P, XM, YM, XN, YN)

defines the current region in terms of region P.

      VISO (XMI, XMO) 
      VISOR (R, XMI, XMO)

sets the visibility markers for the current region or region R.

      BASE (SWOUTP) 
      BASER (R, SWOUTP)

sets the current region or region R as basic output region for the devices selected by SWOUTP.

      SHAPE (CNV, BSC) 
      SHAPER (R, CNV, BSC)

sets the shape parameters, CNV, BSC for the current region or region R (see Sections 2.3 and 2.5).

      WINDOW

sets the current region visibility to 1.0 inside, 0.0 outside (outside invisible).

SHIELD
      DSALL

sets the current region visibility to 1.0 inside and out (no scissoring).

In terms of the routines previously defined:

LIMIT (XM,YM,XN,YN)    =  RGLIM (-1.0,XM,YM,XN,YN)
PLIMIT (P,XM,YM,XN,YN) =  RGPLIM (-1.0,P,XM,YM,XN,YN)
VISO (XMI,XMO)         =  RGPRM (-1.0,-1.0,-1.0,XMI,XMO,-1.0)
VISOR (R,XMI,XMO)      =  RGPRM (R,-1.0,-1.0,XMI,XMO,-1.0)
BASE (SWOUTP)          =  RGPRM (-1.0,-1.0,-1.0,-1.0,-1.0,SWOUTP)
BASER (R, SWOUTP)      =  RGPRM (R,-1.0,-1.0,-1.0,-1.0,SWOUTP) 
SHAPE (CNV,BSC)        =  RGPRM (-1.0,CNV,BSC,-1.0,-1.0,-1.0)
SHAPER (R,CNV,BSC)     =  RGPRM (R,CNV,BSC,1.0,-1.0,-1.0)
WINDOW                 =  RGPRM (-1.0,-1.0,-1.0,1.0,0.0,-1.0)
SHIELD                 =  RGPRM (-1.0,-1.0,-1.0,0.0,1.0,-1.0)
DSALL                  =  RGPRM (-1.0,-1.0,-1.0,1.0,1.0,-1.0)

The following routines set up regions.

      SDHARD

defines region 1 in terms of region 0, sets region 0 to be the basic output region for SD4020, sets limits of region 1 to (0,0,1023,1023), selects region 1 and SD4020 hardcopy output.

      SDFILM

does the same as SDHARD but selects SD4020 microfilm output.

      LPGRAF

sets region 1 to be the basic output region for lineprinter graphical output, with limits (0,0,119,119), selects region 1 and lineprinter graphical output.

      OUTR (R,XN)

sets region R to be the basic output region for the devices specified by XN, and selects these devices.

2.9 Example

The drawing opposite was produced by the following program. It shows how a complex region chain might be used.

      RGLIM (6.0,10.0,10.0,60.0,50.0) 
      RGPLIM (6.0,5.0,10.0,10.0,60.0,50.0) 
      VISOR (6.0,0.0,3.0)
C
      RGLIM (5.0,30.0,20.0,90.0,70.0) 
      RGPLIM (5.0,4.0,30.0,20.0,90.0,70.0) 
      VISOR (5.0,2.0,1.0)
C
      RGLIM (4.0,20.0,30.0,70.0,60.0) 
      RGPLIM (4.0,3.0,20.0,30.0,70.0,60.0) 
      VISOR (4.0,1.0,2.0)
C
      RGLIM (3.0,80.0,40.0,100.0,50.0) 
      RGPLIM (3.0,2.0,80.0,40.0,100.0,50.0) 
      VISOR (3.0,0.0,1.0)
C
      RGLIM (2.0,50.0,55.0,60.0,75.0) 
      VISOR (2.0,1.0,0.0) 
      BASER (2.0,2.0)
C
      DVOUT (2.0) 
      REGION (6.0)
      DO 10 J=I,12 
      VEC (0.0,0.0,100.0,100.0) 
      DO 10 1=5,100,5 
      XI=I 
      VEC (0.0,XI,100.0-XI,100.0) 
      VEC (XI,0.0,100.0,100.0-XI) 
 10   CONTINUE

Fig. 2.7 Output from region example (the regions have been drawn as well)
⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site