Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ Introduction and contents2. The SMOG system3. Mapping to a device4. Line drawing5. Text printing6. Control of the medium7. Command-sets in files8. Economy - Integer routines9. High level routines10. Appendices11. Manual updates
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

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

Introduction and contents
2. The SMOG system
3. Mapping to a device
4. Line drawing
5. Text printing
6. Control of the medium
7. Command-sets in files
8. Economy - Integer routines
9. High level routines
10. Appendices
11. Manual updates

4. LINE DRAWING

The basic line-drawing command consists in the specification of a starting address on the raster of the output medium and then the instruction to draw a straight line segment from the cell with this address to the cell having a specified finishing address. In the SMOG system the issuing of a starting address causes nothing to be drawn, the instruction is output to the device and a current plotting position pointer - (XP,YP) for brevity in this text - is reset. The device awaits the completion of the command which can be the line segment instruction as above or the plotting of a "Point" or other graphic character as part of the picture.

4.1 Drawing Commands - Absolute Position

The subroutines to be described here take the coordinate number specifications by the user to be cell addresses in the raster of the device. If the user has selected Region 1 then the numbers will usually be scaled and the resulting "Point" translated before rounding and assigning to type INTEGER to indicate an addressable cell. If Region 0 is selected, the user's coordinate numbers will be assigned to type INTEGER variables immediately and the nearest raster cell to the indicated "Point" will be addressed. In both cases direct addressing of the raster is performed.

start at (X,Y) 4.1.1
      SET(X,Y)
      JSETXY(IX,IY) 

resets (XP,YP) to (X,Y), no plotting takes place.

draw to (X,Y) 4.1.2
      TOXY(X,Y)
      JTO(IX,IY) 

draws the line segment from (XP,YP) to (X,Y) and resets (XP,YP) to (X,Y). A sequence of calls to this subroutine can thus be used to draw the approximation to a smooth, continuous curve.

draw from (X1,Y1) to (X2,Y2) 4.1.3
      VEC(X1,Y1,X2,Y2)
      JVEC(IX1,IY1,IX2,IY2) 

draws the line segment from (X1,Y1) to (X2,Y2) using the above two instructions and resets (XP,YP) to (X2,Y2). Redundancy in the resulting machine-coded instructions can be reduced, where context permits, by use of the following four subroutines:

reset X 4.1.4
      SETX(X)
      JSET(IX) 

resets (XP,YP) to (X,YP)

reset Y 4.1.5
      SETY(Y)
      JSET(IY) 

resets (XP,YP) to (XP,Y)

draw horizontal 4.1.6
      TOX(X)
      JTOX(IX) 

draws the line segment from (XP,YP) to (X,YP), resets (XP,YP) to (X,YP)

draw vertical 4.1.7
      TOY(Y)
      JTOY(IY) 

draws the line segment from (XP,YP) to (XP,Y), resets (XP,YP) to (XP,Y).

Example: SMOG Interpretation 4.1.8

      CALL HPACK                       Select pen-plotter
      CALL LIMIT(-3.2,-1.1,3.2,1.1)    Set scales to whole area
      A=3.1416
      B=0.02*A
      CALL SETXY(A,0.0)                (XP,YP)=(3.141.6,0.0)
      DO 10 I=1,100                    draw ...
      CALL TOXY(A,SIN(A))
      A=A-B
 10   CONTINUE                         ... curve
      CALL ADVFLM                      new frame
      CALL ENDSPR                      end graphics

Note: (i) Region 1 was selected automatically by CALL HPACK

(ii) CALL HPACK and CALL ENDSPR are the necessary delimiters.

draw vector family 4.1.9
      VECFAM(X1,Y1,X2,Y2,X3,Y3,X4,Y4,N)
      JVECFM(IX1,IY1,IX2,IY2,IX3,IY3,IX4,IY4,N) 

This vector family routine draws the two lines (X1,Y1) to (X2,Y2) and (X3,Y3) to (X4,Y4) and draws N-1 lines between these two. The N-1 lines are such as to partition the space between the two lines into N equal areas. The lines are of the form:

(X1+α(X3-X1),Y1+α(Y3-Y1)) to 
(X2+α(X4-X2),Y2+α(Y4- Y2))
where 0<α<1

The two lines can be in any direction and may intersect. For example, if (X1,Y1) = (X3,Y3), a fan of lines is produced. Of course, spacing between lines will not be constant along their length and so a coloured fan would vary in brightness. This routine does not update the current point; its value is the same on exit as it was on entry.

Two high-level routines use the vector family to draw a graticule over a rectangular area defined by two parallel lines:

partition X 4.1.10
      HGRATX(X1,Y1,X2,Y2,N) 

draws the two extreme line segments:

l1 from (X1,Y1) to (X1,Y2) and
l2 from (X2,Y1) to X2,Y2); 

the rectangular region defined by l1 and l2 is then partitioned by N-1 lines equally spaced and parallel to the Y axis in the selected Region. A grating or graticule is thus produced.

partition Y 4.1.11
      HGRATY(X1,Y1,X2,Y2,N)  

draws N+1 lines as above but, in this case, the lines are parallel to the X-axis in the selected Region.

4.2 Drawing Commands - Relative Position

The subroutines in Section 4.1 all map the user's coordinate specifications to unique cells in the raster on the output medium. The cells are, as it were, directly addressed from the currently selected region. The next set of subroutines allows relative displacements from the current plotting position (XP,YP) and can be thought of as indirectly addressing the raster. The subroutine identifiers have the mnemonic "DX", "DY", "DXY" included to indicate their incremental nature. They find their greatest use to be in the definition of Files of picture information (see Section 7). These instructions, stored as command-sets in files, allow particular structures to be defined once only but used many times, often at different positions on the output medium:

reset relative horizontal 4.2.1
      UPDX(DX)
      JUPDX(IDX) 

resets (XP,YP) to (XP+DX,YP)

reset relative vertical 4.2.2
      UPDY(DY)
      JUPDY(IDY) 

resets (XP,YP) to (XP,YP+DY)

reset relative 4.2.3
      UPDXY(DX,DY)
      JUPDXY(IDX,IDY) 

resets (XP,YP) to (XP+DX,YP+DY)

draw relative horizontal 4.2.4
      TODX(DX)
      JTODX(IDX) 

draws the line segment from (XP,YP) to (XP+DX,YP) and resets (XP,YP) to (XP+DX,YP)

draw relative vertical 4.2.5
      TODY(DY)
      JTODY(IDY) 

draws the line segment from (XP,YP) to (XP,YP+DY) and resets (XP,YP) to (XP,YP+DY)

draw relative 4.2.6
      TODXY(DX,DY)
      JTODXY(IDX,IDY)

draws the line segment from (XP,YP) to (XP+DX,YP+DY), resetting (XP,YP) to (XP+DX,YP+DY).

Since these subroutines have incremental effect the user should be aware of the possibility of plotting out of the visible area - often for no immediately apparent reason!

Example 4.2.7:

      SUBROUTINE CIRCLE(RAD)
C        DRAW A CIRCLE, RADIUS "RAD" ABOUT 
C        THE CURRENT PLOTTING POSITION(XP,YP).
      TH=0.0
      PH=0.0 
      DTH=0.031416 
      CALL UPDX(RAD) 
      DO 10 I=1,200 
      TH=TH+DTH
      DX=RAD*(COS(TH)-COS(PH)) 
      DY=RAD*(SIN(TH)-SIN(PH)) 
      CALL TODXY(DX.DY) 
  10  FH=TH
      CALL UPDX(-RAD)
      RETURN
      END

Note:

  1. this will draw a circle of any diameter at any point in the selected region,
  2. the scaling currently being applied to the selected region will apply to this set of commands whenever they are obeyed,
  3. plotting outside the visible area can easily occur using this subroutine leading to missing segments in the picture,
  4. the current plotting position is left unchanged.
draw vector family 4.2.8
      VECFAR(DX1,DY1,DX2,DY2,DX3,DY3,N)
      JVECFR(IDX1,IDY1,IDX2,IDY2,IDX3,IDY3,N) 

This routine is a relative version of the VECFAM routine. The first point is assumed to be the current point (XP,YP) and the other points are all defined relative to this one. The routine draws the two lines (XP,YP) to (XP+DX1,YP+DY1) and (XP+DX2,YP+DY2) to (XP+DX3,YP+DY3) and N-1 lines in between.

This routine does not update the current point; its value is the same on exit as it was on entry.

The routines VECFAM and VECFAR should be used wherever possible to shade solid areas.

⇑ 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