Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ Contents1. Introduction2. Definition of regions3. Line drawing4. Character typing and plotting5. Control procedures7. Extended facilities10. References
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

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

Contents
1. Introduction
2. Definition of regions
3. Line drawing
4. Character typing and plotting
5. Control procedures
7. Extended facilities
10. References

Chapter 2: THE DEFINITION OF REGIONS

The user will, in general, prefer to define the plotting area in terms of his own units rather than have to convert them into inches of paper, millimetres of microfilm, or raster positions. Almost always, he will have some co-ordinate system and units of his own that he will prefer to use. Consequently, as soon as the graphical output has been identified (see Chapter 6), the user should call:

limits (xmin, ymin, xmax, ymax) ;

This defines the minimum and maximum values of x and y which coincide with the corners of the 7!" square page in the user's own units. All references to positions on the page will now be defined in terms of this scaling defined by the user. Apart from being more convenient for the user, it also means that the system, as far as the user is concerned, is independent of the type of graphical device being used. The scaling in both the x and y directions is assumed to be linear. For example, the x-value halfway between 'xmin' and 'xmax' will be equivalent to the centre point of the page.

To draw the function y = sin(x) for x = 0 to 2π so that it covers the complete plotting area, we could write:

limits (0, -1 , 2*pi, 1 ) ;
for x := 0 step dx until 2*pi - dx do 
vector (x, sin (x), x + dx, sin(x + dx) ) ;
Example 2.1

The procedure 'vector(x1,y1,x2,y2)' is assumed to draw a straight line between the points (x1,y1) and (x2,y2) If 'dx' is sufficiently small then the graph produced will approximate to the smooth sine curve. By changing the call of the procedure 'limits' in the example above to:

limits (-pi, -2, 3*pi, 2) ;

the graph would have been drawn within a 3.75in square area in the centre of the page. The procedure 'limits' may be called many times so that the user can have several different sets of units if he so desires. This constant changing of units could be inconvenient and the GROATS system is defined so that the plotting area can be divided into separate regions each having its own co-ordinate system.

2.1 SUB-REGIONS

Normally, apart from the desired graph, additional information such as titles will be on the plotting area. Although the user will appreciate being able to plot points in terms of his own units, it would be unreasonable to expect the user to define the position of his titles in the same units. It is therefore quite useful to be able to define sub-regions of the total plotting area with their own particular scaling.

A sub-region is defined by:

region(xmn, ymn, xmx, ymx, I) ;

This defines sub-region I as that part of the currently selected region which has minimum and maximum values (xmn,ymn) and (xmx,ymx). Initially the region selected is the whole plotting area and this is region 0. The scaling for this region is defined by the initial call of 'limits'. The arguments of the procedure 'region' are in the units of the selected region. For example:

limits (0, 0, 3, 3);
region(1, 1, 2, 2, 1);

defines the units to be used for the whole plotting area. The sub-region 1 is then defined as the 2.5 square in the centre of the plotting area. This is shown in Fig 2.1.

Plotting area (3,3) (0,0) (2,2) (1,1) Region 1

Fig. 2.1

Once more than one region has been defined, it is necessary to define which region is being referred to. Initially region 0 is selected. A sub-region I can be selected by:

select region (I) ;

All subsequent commands now refer to region I and not region 0 which was selected originally. However, no units and scaling have been defined for region I and, before generating any graphical output, this must be defined by a call of procedure 'limits'. The maximum and minimum values defined by the call of 'limits' always refer to the currently selected region. For example, the 'sine' curve plotted in the centre of the plotting area in Figure 2.2 could have been produced by:

limits (0, 0, 3, 3) ;
region (1, 1, 2, 2, 1) ;
select region (1) ;
limits (0, -1, 2*pi, 1) ;
for x := 0 step dx until 2*pi - dx do
vector (x, sin (x), x + dx, sin(x + dx) ) ;

Region 1 is defined as in Fig 2.1. The region is then selected and the bottom left-hand corner is defined as the point (0, -1) and the top right-hand corner as (2π,1). The sine curve is then drawn across region 1 as shown in Fig 2.2.

Plotting area (3,3) (0,-1) (2π,1) (0,-1) Region 1

Fig. 2.2

In this example, not too much has been gained by the definition of region 1. However, if four separate graphs were required in the four quarters of the plotting area and each required a different set of units then this would best be done by defining four separate subregions rather than redefining the units to be used for the complete region.

The procedures 'limits' and 'region' may be called more than once for each sub-region. This greatly increases the flexibility of the system. For example, the same graph can be plotted at different positions on the plotting area by redefining the position of the subregion by calling 'region' again. Also different magnitudes of the same graph in the same region can be produced by redefining the scaling using 'limits'. These facilities, which are useful in normal graphical work, become essential when making a film. The redefinition of the position of a sub-region over several frames of film can be used to simulate camera movement or, alternatively, the movement of objects in the region. Similarly, by redefinition of the scaling by calls of 'limits', it is possible to simulate camera zoom.

It is important to remember that all GROATS procedures will have their positional arguments defined in terms of the units of the currently selected region and a conversion is made automatically to give the value in terms of the plotting area.

Additional points of interest which might be overlooked are:

  1. Regions can be defined which may be partially or completely outside the plotting area. This can be quite useful when producing films. Gradually moving the position of a region until it appears on the plotting area simulates the movement of a scene onto the visible area of a film.
  2. Regions can be redefined in terms of their own units.
  3. Sub-regions can be defined in terms of units of other sub-regions. It will probably be usual to define the sub-regions in terms of the main region but in some recursive situation it may be quite useful to have a nested set of region definitions.

The terms 'region' and 'sub-region' have been used rather loosely in the above section. All regions, other than region 0, are thought of as sub-regions. However once more than one region or sub-region has been defined, they all have equal standing so that the terms then become interchangeable. The superiority of region 0 is only that initially it is defined as the whole plotting area and that the initial call of 'limits' refers to it. Currently, the allowed regions are numbered 0 to 10.

2.2 WINDOWS

A region can be thought of as defining a window through which part of an infinite scene can be viewed. All regions are initially defined so that they act as windows which stop the appearance of any information plotted outside the boundary of the currently selected region. In the example (2.1), the sine curve was only drawn between 0 and 2π so that the limits of the sine curve coincided with the boundary of the region. If instead we had:

limits (0, -1, 2*pi, 1) ;
for x := -50*pi step dx until 50*pi do
vector (x, sin(x), x + dx, sin(x +dx) ) ;
Example 2.4

then many periods of the sine curve would attempt to be drawn. However, as the selected region is a window containing the viewable plotting area within the boundaries of the region, the curve actually plotted in (2.1) and (2.4) would be the same. This automatic 'scissoring' can often be very helpful to the user as it saves him from worrying too much about what happens at the edges of the region. This is taken care of by the system.

A region need not always be defined as 'containing' the graphical output. There is a second mode of operations where any drawing on the plotting area will be displayed even if it is outside the boundaries of the selected region. This is achieved by calling the procedure:

extend;

From this point onwards the currently selected region's boundary and limits act only as a means for defining the units to be used. For example:

limits (0, 0, 3, 3) ;
region (1, 1, 2,2, 1) ;
select region (1) ;
limits (0,-1, 2*pi, 1) ;
for x := -2*p i step dx until 4*pi - dx do
vector (x, sin(x), x + dx, sin(x + dx) ) ;
Example 2.5

would define region 1 in the centre of the plotting area and, as the region 1 is initially defined as contained, only the middle cycle of the sine curve (that is the one inside the boundaries of region 1) would be displayed. This is shown in Fig 2.2. However, if we had:

limits (0, 0, 3, 3) ;
region (1, 1, 2,2, 1) ;
select region (1) ;
limits (0,-1, 2*pi, 1) ;
extend ;
for x := -2*p i step dx until 4*pi - dx do
vector (x, sin(x), x + dx, sin(x + dx) ) ;
Example 2.6

then all three cycles would be drawn stretching from one side of the plotting region to the other. A region, which has been defined as 'extended', can later be redefined as a containing window by calling:

contain;

when the region is selected.

2.3 PASSIVE REGION

In example (2.6) there does not appear to be any mechanism for stopping a user attempting to plot information off the allowable SC 4020 plotting area. For example:

limits (0, 0, 3, 3) ;
region (1, 1, 2,2, 1) ;
select region (1) ;
limits (0,-1, 2*pi, 1) ;
extend ;
for x := -50*p i step dx until 50*pi - dx do
vector (x, sin(x), x + dx, sin(x + dx) ) ;
Example 2.7

This program looks as though it will attempt to draw cycles of the sine curve several feet away from the 7.5in square plotting area of the SC 4020 hardcopy! There must be some mechanism ensuring that, in extended mode, a user does not plot outside the bounds of the SC 4020 plotting area. This could have been done by having the GROATS package insert a constant test just before plotting. Instead, a slightly more flexible approach was adopted. In the GROATS system, one region is always defined as the passive region. Initially, region 0 is defined as the passive region. The passive region always acts as a window which contains all plotting within its boundary independent of which region is selected. Region 0 is initially passive and, as its boundary is initialised to coincide with the boundary of the SC 4020 plotting area, it will always ensure that no illegal plotting takes place. There is no reason why a different region should not be defined as the passive region. However, under no circumstances should a larger region be defined as the passive region. Unless familiar with the system, it is probably wise not to alter the region defined as passive or its boundaries. A region smaller than the complete SC 4020 plotting area can be defined as the passive region. This would ensure that all plotting was contained within a smaller region than the 7.5in square SC 4020 hardcopy page. A region may be defined as the passive region by calling:

passive;

which defines the currently selected region as the passive region. In example (2.7), the original setting of region 0 as the passive region ensures that only the three cycles of the sine curve that appear on the SC 4020 plotting area will be plotted. However, if, for example, we had:

limits (0, 0, 3, 3) ;
region (0.5, 1, 2.5, 2, 2)
select region (2) ;
passive ;
select region (0) 
region ( 1, 1, 2, 2, 1 ) ;
select region (1) ;
limits (0, -1, 2*pi, 1 ) ;
extend ;
for x := -50*pi step dx until 50*pi do 
vector (x, sin (x) , x + dx, sin(x + dx) ) ;

then, although the extend mode of region 1 would normally allow the three cycles of the sine curve to be displayed, the new passive region 2 restricts the curve plotted to the two cycles between x = -π and 3π.

2.4 REFLECTION, ROTATION, AND EXPANSION OF REGIONS

So far,it has been assumed that the mapping of points and lines defined in a selected region onto the plotting area is linear and is done in a straightforward manner. That is, if the limits of the plotting area and sub-region are defined by:

limits (XMIN,YMIN,XMAX,YMAX) ;
region (XMN,YMN,XMX,YMX,1) ;
region (1) ;
limits(xmin,ymin,xmax,ymax) ;

then the point (x,y) in units of region 1 is equivalent to the point (X,Y) on the plotting area in units of region 0 where:

X = XMN + (x - xmin) (XMX - XMN)/ (xmax - xmin)

Y = YMN + (y - ymin) (YMX - YMN)/ (ymax - ymin)

That is the standard conversion that is done and it will produce the normal results expected. If, for example, in region 1 a procedure is called which produces the letters EXAMPLE by vectors then the word will appear in this form on the plotting area. If, instead, the declaration of region 1 had been:

region (XMX,YMN,XMN,YMX,1) ;

then

EXAMPLE

Fig. 2.3

would have been plotted. Similarly by interchanging the maximum and minimum y values in the region declaration, the characters could be turned upside down.

It is also possible to allow a rotation or expansion of the material defined in the selected region before doing the conversion to a position on the plotting area. For example, before the conversion given above, the point (x,y) could first be mapped into the point (x' ,y' ) where:

x' = xorig + e × ( (x - xorig) cos(alpha) - (y-yorig) sin(alpha) )

y' = yorig + e × ( (x - xorig) sin(alpha) - (y-yorig) cos(alpha) )

The point (xorig,yorig) is defined as the centre of rotation and expansion. The conversion, shown above, consists of a rotation of alpha radians anti-clockwise about this centre together with an expansion by a factor 'e' about the same centre. The GROATS package allows either expansion or rotation of this form to be specified. The only limitation is that, if both are defined, then the same centre of rotation must be used for both the expansion and rotation. Rotation is achieved by the call:

rotate (xorig, yorig, alpha) ;

while expansion 1S achieved by:

expand (xorig, yorig, e)

It is important to remember that basically all regions are defined in terms of the plotting area even though they may have been defined in terms of other regions. This means that, in attempting to define the position of the point (x,y) on the plotting area, only the rotation and expansion defined for the selected region will be applied. The rotations and expansions of other regions, in terms of which the selected region may have been defined, have no effect on the conversion. Similarly, if a region is defined in terms of a rotated region, its definition will be as if no rotation had been defined on this region. This ensures that all regions are defined as rectangular with boundaries parallel to the x and y axes. The rotation and expansion are local to the plotting of points in the selected region.

In subsequent Chapters, procedures will be described having x and y values as arguments. These arguments are always in the units of the currently selected region.

2.5 SHIELDING

In section 2.2 regions were defined as windows which contained the plotting that could be seen. An alternative is to define a region as a shield which only allows plotting outside the bounds of the selected region. The currently selected region can be defined as a shield by calling:

shield;

The region can be redefined as a window by calling:

window;

Together with the contain/extend switch this allows the four possibilities:

The 'shield' facility is particularly useful for doing wipes starting from the centre of the picture in cine films.

2.6 ACTIVE REGION

One drawback with the local shielding is that the shielding or masking will only affect plotting in the selected region. Consequently, if plotting is being done in several different regions it is not possible to define a mask that will affect plotting in all the regions. The active region is similar to the passive region in that its action is global to all regions. The passive region only has meaning if it is a window and contains all plotting within it. Conversely, the active region only has effect when it is also defined as a shield. In this case only plotting outside the active region will be displayed. The currently selected region is defined as the active region by calling

active;

For example

1imits (0, 0, 10, 10) ;
region (1, 1, 9, 9, 1) ;
region (3, 3, 7, 7, 2) ;
select region (1) ;
passive; window;
select region (2);
active; shield;
select region (0);
scene;

will allow only that part of the scene defined between the limits of regions 1 and 2 to be displayed.

⇑ 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